|
zhuzhichao
炎龙骑士 的方法果然好用-
/*
create table t_t1
(id int identity(1,1),
name varchar(10)
)
insert into t_t1 select 'xx1'
union all select 'xx1'
union all select 'xx1'
union all select 'xx1'
union all select 'xx1'
union all select 'xx1'
union all select 'xx1'
*/
select * from t_t1
--truncate table t_t1 --truncate table 你的表名 --這樣不但將數據刪除,而且可以重新置位identity屬性的字段。
delete from t_t1
dbcc checkident(t_t1,reseed,0) --dbcc checkident(你的表名,reseed,0) --重新置位identity屬性的字段,讓其下個值從1開始
insert into t_t1 select 'xx1'
union all select 'xx1'
union all select 'xx1'
select * from t_t1
---运行结果---
id name
----------- ----------
1 xx1
2 xx1
3 xx1
(3 row(s) affected)
id name
----------- ----------
1 xx1
2 xx1
3 xx1
(3 row(s) affected) |
|