sql server建表以后如何设置主键自增,详细的方法

如题所述

1、表中设置自增加字段
2、建立主键
例如:
Create Table 表名
(
RecID int Identity(1,1) Not Null, --自增长
)
Alter Table 表名 Add Constraint 主键名称 Primary Key Clustered (RecID Asc)
温馨提示:答案为网友推荐,仅供参考
相似回答