April 22, 2015 at 9:29 am
Perhaps there is a better approach? So the part of my sproc that copies the data from one server / db/ table to another is working fine, no problem.
The whole reason behind adding the column is to preserve the source Identity value until I can copy over the source identity with the new identity to a translation table.
SO here is the scoop. I have a table on server A. and on server B there is the same database and same tables; clones (Except the data)
Now I need to take the data from A and bring it over to a table in B of the same name / schema. We will use the table (Node) as an example.
Now we will be doing this with nearly every table in the database. Many of these have an FK to another table or other tables FK to them. SO I need to update values in these other tables as to their new relationship.
In the case of our sample table (Node) we have a primary Key NodeID int. When I bring over the data from Server A to server B my destination (Node) table will give these records a new value for the primary key. I need to keep what the value WAS so that I can re-map things. SO after the import I would bring over the information I just inserted into B ex: (SourceServerName, SourceDBName, SourceSchemaName, SourceTableName, Destination... (same as all the source fields) then at the end DestinationIdentityValue, SourceIdentityValue) of course I would have the field name as well, you get the idea.
So is there a way on insert I can grab the Original and new Identity columns? Maybe a trigger but again I can't really do that either because my destination server could change. Ideally I do this as I explained at the beginning of the post.
<hr noshade size=1 width=250 color=#BBC8E5> Regards,Jeffery Williams http://www.linkedin.com/in/jwilliamsoh
April 22, 2015 at 9:34 am
spaghettidba
ARE YOU KIDDING ME RIGHT NOW??? Dude if you were here I would hug you and give you a big sloppy kiss (glad your not here)..
It worked!!! I have never used quotename, I will need to read up on that a bit.
Thank you so much!
<hr noshade size=1 width=250 color=#BBC8E5> Regards,Jeffery Williams http://www.linkedin.com/in/jwilliamsoh
April 22, 2015 at 9:39 am
Jeffery Williams (4/22/2015)
spaghettidbaARE YOU KIDDING ME RIGHT NOW??? Dude if you were here I would hug you and give you a big sloppy kiss (glad your not here)..
It worked!!! I have never used quotename, I will need to read up on that a bit.
Thank you so much!
Gosh! Glad I'm not there too 😀
You're welcome, glad I could help
-- Gianluca Sartori
April 22, 2015 at 9:40 am
LMAO...
You have no idea the relief. I just could not get this. Thanks again!
<hr noshade size=1 width=250 color=#BBC8E5> Regards,Jeffery Williams http://www.linkedin.com/in/jwilliamsoh
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply