Change . Let me rephrase this completely, because I'm not sure if there is an XML way as I originally described.
Another edit . This should be a repeatable process, and it needs to be configured in such a way that it can be called in C # code.
In database A, I have a set of tables related to PK and FK. Let's say a parent table with tables for children and grandchildren.
I want to copy a rowset from database A to database B , which has identical table and field names. For each table, I want to insert it into the same table in database B. But I cannot restrict the use of the same primary keys. The copy procedure must create new PKs for each row in database B and must propagate them to child rows. In other words, I keep the same relationship between the data, but not the exact same PK and FK.
How would you solve this? I am open to suggestions. SSIS is not completely ruled out, but it doesn't seem to me that this will do just that. I am also open to a solution in LINQ, either using typed datasets or using some kind of XML thing or anything that will work in SQL Server 2005 and / or C # (.NET 3.5). A better solution would not require SSIS and would not require writing a lot of code. But I agree that this “best” solution may not exist.
(I did not do this task myself, nor restriction, so it was given to me.)
source
share