Home Forums SQL Server 2008 T-SQL (SS2K8) how to alter the existing id values to idetity(1,1) RE: how to alter the existing id values to idetity(1,1)

  • kapil_kk (8/30/2013)


    ScottPletcher (8/29/2013)


    ALTER TABLE dbo.tblemployee

    ADD ident int IDENTITY(1, 1) NOT NULL

    Edit: Added "NOT NULL"

    You are adding a new column with IDENTITY property and it works..

    The thing is that we cant add IDENTITY property to any existing column of table...

    No, you simply cannot do that directly.

    You would have to export the table, recreate the table definition, then import with IDENTITY_INSERT ON to use an existing column as an IDENTITY value.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.