开发者

updating a table with the data from another

i have two sites that sell the same products (same database structure and everything). One of them has recently had all its pr开发者_Python百科oducts updated and we need to take the data from three tables on the updated site and override those same three tables on the out of date site. is there a way to do this is Sql Server MS? ive tried truncating the tables in sql to then do a "insert into db1table select * from db2table" but i just get errors from the foreign keys. Someone showed me a trick a while in visual studio enterprise for comparing data where vs spits out a .sql file you can run to update your table but i only have vs professional 2010 and this doesnt seem to be part of the package.


Assuming you have the same foreign key constraints in both the databases and if foreign key constraints are the only issue -

why don't you just

1) Disable all the foreign keys

2) Load the data

3) Enable all the foreign keys

I come from Oracle background, it should not be very hard to disable/enable all foreign key constraints using a script at one go in SQL Server too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜