至高吴上(Alfa.wu)

一个人,一生,能坚持做好一件事情是多么的牛XX啊!!!

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

摘自: http://www.cnblogs.com/badboy2008/articles/1145465.html

MSSQL Server修改标识列方法

 

----允许对系统表进行更新
exec sp_configure 'allow updates',1
reconfigure with override
GO

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

--插入id=8001-8003的行
...

----恢复标识列标记
update syscolumns set colstat = 1 where id = object_id('tablename') and name = '标识列名称'

----重新设置标识的起始值
DBCC CHECKIDENT (表名称, RESEED, 10003)

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

posted on 2013-07-12 10:53  Alfa  阅读(639)  评论(0编辑  收藏  举报