1,判断数据表列是否存在
使用COL_LENGTH(表名,列名)
IF COL_LENGTH('dbo.WEB_ResourceKind',N'IsAppMsgPush') IS NULL
2,新增标识列
Alter Table 表名 Add 列名 列类型 IDENTITY(1,1)【起始值,递增值】constraint 约束名primary key (主键)【constraint 约束名primary key (主键)可选】
已有标识列 或 已有主键 均不能再添加,需要删除约束,删除约束见4.4
alter table WEB_ResourceKind Add NewID IDENTITY(1