I have to turn off the identity on a table in redshift and insert the historical values into that.
If I try to insert values into an identity column I am getting below error
ERROR: 0A000: cannot set an identity column to a value
IDENTITY_INSERT off in SQL Server Once you have turned the IDENTITY_INSERT option OFF, you cannot insert explicit values in the identity column of the table. Also, the value will be set automatically by increment in the identity column if you try to insert a new record.
If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value. The setting of SET IDENTITY_INSERT is set at execute or run time and not at parse time.
you can do it by following simple 2 step approach.
explicit_ids
as parameter in your copy command.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With