SQL Server, How to set auto increment after creating a table without data loss?

后端 未结 7 1745
天涯浪人
天涯浪人 2020-11-22 09:54

I have a table table1 in SQL server 2008 and it has records in it.

I want the primary key table1_Sno column to be an auto-incrementing col

7条回答
  •  暖寄归人
    2020-11-22 10:22

    No, you can not add an auto increment option to an existing column with data, I think the option which you mentioned is the best.

    Have a look here.

提交回复
热议问题