update data from one SQL database to another
Posted on 2012-03-29
I have two identical databases. All except, of course, the name of the data base itself.
These data bases are called
Each of the tables in the databases are identical.
In the company_2011 there is a table called plant_city. In this table there are several computed columns.
I need to be able to update the data from the table plant_city in company_2011 to plant_city in grower_2011.
I do this now with a query that looks like this:
INSERT INTO GROWER_2011.DBO.PLANT_CITY (THIS_COLUMN, THAT_COLUMN, THE_OTHER_COLUMN)
SELECT THIS_COLUMN, THAT_COLUMN, THE_OTHER_COLUMN
WHERE (THAT_COLUMN = 'GROWER_NAME')
The reason I delete the table first is I have found if I do not then the query fails and tells me that the table already exists.
All I really need to do is update the data in this table every day and have the computed columns stay in tact.
What would be a better way to accomplish what I need to do??