use tempdb gocreate table test(id int identity(1,1),name char(1)) goinsert test select 'a' goselect * from test gotruncate table test goselect * from test goinsert test select 'a' goselect * from test godrop table test go看示例
TRUNCATE TABLE tb (identity恢复为从1开始) delete from tb (保留标识计数值)
use tempdb
gocreate table test(id int identity(1,1),name char(1))
goinsert test select 'a'
goselect * from test
gotruncate table test
goselect * from test
goinsert test select 'a'
goselect * from test
godrop table test
go看示例
delete from tb (保留标识计数值)