如何使用主键和标识更改列

时间:2013-07-02 13:49:54

标签: sql-server sql-server-2012

如何在现有表中更改主键和标识的列。我尝试了以下查询,但显示Incorrect syntax near the keyword 'identity'.

alter table IAM_Software_Licence_Master
alter column SoftwareLicId int  identity(1,1) primary key

我怎样才能做到这一点..

1 个答案:

答案 0 :(得分:0)

由于我不知道表格结构或是否将其用作外键,因此很难说出改变这一问题的原因是什么。但是下面的链接可以为您提供所需的一切: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/04d69ee6-d4f5-4f8f-a115-d89f7bcbc032/how-to-alter-column-to-identity11