I have 2 databases with same tables. DBProduction and DBLocal both have testTable. How can i replace testTable of DBProduction with of DBLocal? There are some new rows inserted and some updated rows in testTable of DBLocal.
Using SQL Server 2008
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If they are on the same server and have the same table structure you could do this:
If they are on different servers, you could run the truncate statement as above then right click the DBProduction and select Import Data. This will launch the wizard and import the data for you.
EDIT:
I should also add that if the table structure is different, you should
Drop Table DBProduction.dbo.testTableand then use the Import Data wizard to import (and by default recreate) the testTable in DBProduction.EDIT 2:
If you want to insert (without listing all columns) when a column is set as Identity you need to do the following:
This will temporarily ignore the identity seeding.
HTH
Barry