I have a data request to import all SQL Server table of same schema into one new table (Master_table) regularly.
I have tables created daily like,
table_20150701 table_20150702 table_20150703 table_20150705 . . . table_20150716 like this everyday I will get data feeds from external sources to a table in on of my database, the table has a lastUpdate column as well with the datestamp.
My request is to import all the tables data into one single table (Master_table) and add the next days data directly into the new file
Next day when it creates a table_2015xxxx... it should automatically load data int to new table (Master_table)
This is a continuous process so we can use the new table for analysis purpose.
Appreciate your quick help!!
Here's a quick sample to get you going.
1) Create Master_table with columns to match daily tables plus a date column to show what date the row was originally imported and a nice little identity column for the clustered index
2) Create insert statements to load the daily tables into Master_table then drop the daily tables.
3) Run the generated statements
answered Jul 18, 2015 at 06:03 AM