-
setting identity column
Hi All,
How do can I set the identity property using T_SQL instead of SQL EM?
Thanks in advance for any response.
-
Sorry Guys,
More details ... we have a replicated table that has 1000s of rows with the identity property turned off in the SID [int] col. After we turn off repl, is there a way to set identity (1,1) on the replicated SID col using t-sql?
-
AFAIK you can only set identity propert when you create the column. To use the existing create a new one with identity property, use SET IDENTITY_INSERT ON and copy values from old column, set the IDENTITY_INSERT OFF then drop the old column and rename the new one.
-
Thanks Skhanal, looks like I'll have to do it like you said (like an extended alter) or in SQL EM. I was hoping I could add a t-sql script to set the identity in my disaster recovery procedures & scripts. Thanks again for the response.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|