亚洲欧美男人天堂,日韩资源在线,日韩影视在线观看,日韩精品在线看,国产精品亚洲精品日韩已满,午夜理伦三级理论6080,国产精品爱久久久久久久

首頁 服務(wù) 產(chǎn)品 文檔 關(guān)于

SQL Identity自增列清零重置方法

1.使用DBCC控制臺命令:
dbcc checkident(表名,RESEED,0)
2.truncate table 也可將當前標識值清零
但當有外鍵等約束時,無法truncate表
可以先禁用外鍵約束來truncate表:
--禁用外鍵約束
exec sp_msforeachtable 'alter table ? nocheck constraint all'
--清空數(shù)據(jù)
truncate table 表名
--啟用外鍵約束
exec sp_msforeachtable 'alter table ? check constraint all'
常用 truncate table 進行數(shù)據(jù)表內(nèi)數(shù)據(jù)的清空,同時將ID列重新開始計數(shù)!
truncate table 課程表
truncate table 學生表
truncate table 選課表