您的位置:首页 > 其它

如何修改表的ID主键 使的在删除了一些记录后把新增的记录插入到删除记录的位置

2011-09-08 17:18 399 查看
create table tab(id int identity,col varchar(20))

insert tab select '123'

union all select 'asdf'

union all select '8866'

union all select 'dfo'

union all select 'dwoie'

union all select 'fow'

go

delete tab where id=5

select * from tab

go

set identity_insert tab on

insert tab(id,col) select 5,'dfa'

set identity_insert tab off

go

select * from tab

证明一切................但是在一个数据库中只能同时只能设置一个set identity_insert 表 on
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐