sql - How to move data between multiple database's table while maintaining foreign-key relationships/referential integrity? -


I am trying to figure out the best way to move / merge two tables of data from multiple databases.

I have a schema like the following:

  Make the table product (Product ID inti recognition (1,1) No, name varchar (250) No, details Varchar ( 1000) False, image image with a foreign key of the image (image image identification (1,1) faucet, image data does not create image faucet) Create  image  

ImageID Image '.

What is the best way to move data from multiple source databases into a destination database with a single schema in this table? My primary issue maintains links between products and their respective pictures. .

In SQL Server, you enable identification applicants:

  Turn on SET IDENTITY_INSERT newtables & lt; Insert questions here & gt; SET IDENTITY_INSERT NewTable OFF  

While privacy entry is enabled, you can insert a value in the Identity column like any other column. This allows you to copy the table, for example from a linked server:

  into newdb.dbo. Select from NewTable * oldserver.olddb.dbo.OldTable  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -