Friday, 16 May 2025

How to update Identity Column in SQL Server





-- Set Identity insert on so that value can be inserted into this column
SET IDENTITY_INSERT YourTable ON GO -- Insert the record which you want to update with new value in the identity column INSERT INTO YourTable(UserId, otherCol) VALUES(13,'myValue') GO --Now set the idenetity_insert OFF to back to the previous track SET IDENTITY_INSERT YourTable OFF

No comments:

Post a Comment