Results 1 to 2 of 2

Thread: How to set Identity property

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Cape Town, SA
    Posts
    144

    How to set Identity property

    Hi

    How do I set the Identity property to a column in an existing table through Transact-SQL?

    Thanking you in advance

    PORRASTAR

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313
    Not sure that you can set an existing column to an IDENTITY. You can add a new identity column like this:
    Code:
    ALTER TABLE myTable
    ADD newIDColumn int IDENTITY(1,1)
    Or the brute-force way to do it would be to create a temporary table with your data, DROP the table, recreate it with the IDENTITY column and repopulate it from your temp table...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width