Hi All,
I have three tables TableA and TableB and TableC
I wanted to write a stored procedure to copy data row by row from TableA to TableB and then update TableC by replacing any record that has the old id (before copying) to the new id after copying the data.
here is the steps
iterate throw all the rows in tableA ( probably with a foreach)
in each iteration we will do the following:
Get current ID (identity) for each record in TableA ( will call it @oldID)
Insert the row in TableB
Get the new ID for the row from TableB will call it (@NewID)
find rows in tableC that has the (@oldID)
replace all ids in tableC with @oldID to @NewID
Thanks in advance
I have three tables TableA and TableB and TableC
I wanted to write a stored procedure to copy data row by row from TableA to TableB and then update TableC by replacing any record that has the old id (before copying) to the new id after copying the data.
here is the steps
iterate throw all the rows in tableA ( probably with a foreach)
in each iteration we will do the following:
Get current ID (identity) for each record in TableA ( will call it @oldID)
Insert the row in TableB
Get the new ID for the row from TableB will call it (@NewID)
find rows in tableC that has the (@oldID)
replace all ids in tableC with @oldID to @NewID
Thanks in advance