读书人

怎么使用T-SQL语句将标识列设为否

发布时间: 2012-02-01 16:58:19 作者: rapoo

如何使用T-SQL语句将标识列设为否?
表名;mytable
列名;ID, 标识;是, 标识种子;1, 标识增量;1

如何使用T-SQL语句将标识列ID的标识设为否?


[解决办法]
----允许对系统表进行更新
exec sp_configure 'allow updates ',1
reconfigure with override
GO

----查看标识列
select * from syscolumns where id = object_id( 'tablename ') and colstat = 1
----取消标识列标记
update syscolumns set colstat = 0 where id = object_id( 'tablename ') and colstat = 1
GO

----禁止对系统表进行更新
exec sp_configure 'allow updates ',0
reconfigure with override
GO

读书人网 >SQL Server

热点推荐