分享

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

 WindySky 2008-08-20

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

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多