sql server 2008 - how to write T-SQL to compare and copy data? -
i have 2 sql server 2008 enterprise databases (on 2 machines), , 1 of databases master database , database slave database.
i want transfer update table in source database table in destination database (two tables of same schema, both of them using single column unique primary key). transfer rule (in short, rule keeping destination database same source database because of update of source database),
- if there new row in source database not in destination database, insert row in destination database;
- if row not exists in source database exists in destination database, delete row in destination database;
- if row's content (i.e. columns other primary key columns) changes in source database, update new content destination database.
thanks in advance, george
you can use sql server project wizard visual studio (vsts) [check out tutorial learn more], in can select master database, select other configuration in wizard.
finally fetch data/schema master database can compare other sql server database data or schema compare.
it generates update script , can directly apply changes slave database.
you need visual studio team system database edition support.
Comments
Post a Comment