SQL 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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM