Results 1 to 4 of 4

Thread: setting identity column

  1. #1
    Join Date
    Mar 2003
    Location
    Monrovia, CA
    Posts
    10

    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.

  2. #2
    Join Date
    Mar 2003
    Location
    Monrovia, CA
    Posts
    10
    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?

  3. #3
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    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.

  4. #4
    Join Date
    Mar 2003
    Location
    Monrovia, CA
    Posts
    10
    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
  •