【发布时间】:2008-11-13 20:47:11
【问题描述】:
在 SQL Server(在我的例子中,2005)中,如何使用 T-SQL 将标识属性添加到现有表列?
类似:
alter table tblFoo
alter column bar identity(1,1)
【问题讨论】:
-
Funny... SQL Server 2005 Compact edition 有这种语法,但 server edition 没有...
-
Azure SQL 也没有这种语法。
-
赏金将转到可以执行此操作的 TSQL 脚本。 ( sig: spSetIdentity('TableName', 'Id') )
-
@Martin,确保 2008 年是有效要求(即使问题最初是 2005 年)
-
如果您使用的 SKU 支持分区 this is possible as a meta data only change.
标签: sql-server tsql identity