April 12, 2020 at 4:00 pm
Hi everyone,
I have a giant table 'A' with an identity key and also a foreign key that references the identity key in the same table. My goal is load some data in this table from some other table 'B' for some data analysis. Approach i took was remove the identity key form tbale, truncate the table and load the data in table A from table B. After the data is loaded, I tried to set up the identity key for the original column but sql won't let me do that. Is there a way to load the data to table 'B' and also preserve the value of identitykey?
Thanks,
Rohit
April 12, 2020 at 4:06 pm
If I understand what you are asking, SET IDENTITY_INSERT may be what you are looking for.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
April 12, 2020 at 9:13 pm
let me explain my issue again:
April 13, 2020 at 2:48 pm
Please explain your thinking behind removing and adding the IDENTITY column. Why not leave the IDENTITY column there during data load?
The PK is a separate matter, and there may be value in dropping that before the load. Thorough testing will provide the answer to that.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply