Unanswered: Moving data from one database table to others on the basis of criteria
I have huge amount of data in text files and I need to upload the same in an sql server database tables Now for e.g. I have text file which contains data for entire 2009 year but I have a sql database tables for each quater separately.
For e.g. I have following tables.
Now what I want to do is that I will import the data into a table named as Data_2009FullYear. Now I require a query which will copy / move data to above mentioned quarter tables from Data_2009Fullyear database table. for e.g. I have a Period column in my data where we have months in numbers like 1,2,3,4 and so on, so the query should check the column "Period" in Data_2009FullYear and if it finds the rows / records in which in column period the numbers is between 1 to 3 then it should copy / move that data records to Data_2009Qtr1 and if it between 4 to 6 then it should copy data records to Data_2009Qtr2.
Moving data from one database table to others on the basis of criteria
Thanks a lot for your reply.. but I am unable to figure out that which is the table name which is the column name in the below query. Following are my details
my database name : DATA_META my database table name which contains full year data : Data_2009FullYear Database tables in which I want to move the data : Data_2009Qtr1, Data_2009Qtr2, Data_2009Qtr3 and Data_2009Qtr4. Common column in the above mentioned database tables : Period
Can you please provide me an example using above parameters. I want to select all columns when moving the data from Data_2009FullyYear to quarterly tables but using month criteria from period column which is common in fullyear and quarterly tables. Something like Select * from Data_2009Fullyear and copy to quarterly tables based on period criteria.