简体   繁体   中英

Transfer a record and all dependent data from one SQL Server to another

I have 2 servers running SQL Server 2008 Express. Both servers host a structural identical database (same table structure). Each database contains different customer data. Now I need to move one customer from one server to the other. Copying the record from the customer table would be easy, but there are about 50 more tables with dependent data (foreign key ralations) that I need to copy as well.

Is there any tool that is able to detect the dependancies and export / import the data accordingly?

I have also started to code the export in C# myself. Problem here is that I haven't found a way yet to detect dependencies dynamically. Therefore it would be a static export and I would need to adjust it every time the database structure changes. Any hint here would also be very helpful. (VS 2010 .net 4.0)

I suggest to use some kind of ORM . That way you can easily find dependents. Then you should move hole family at a time.

Let me know if you have question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM