/**************** 准备环境********************/
--判断是否存在test表
if object_id(N'test',N'U') is not null
drop table test
--创建test表
create table test
(
id int not null,
name varchar(20) not null
)
--插入临时数据
insert into test values (1,'成龙')
insert into test values (3,'章子怡')
insert into test values (4,'刘若英')
insert into test values (8,'王菲')
select * from test
/**************** 实现更改自动增长列********************/
begin transaction
create table test_tmp
(
id int not null identity(1,1),
name varchar(20) not null
)
go
set identity_insert test_tmp on
go
if exists(select * from test)
exec(' insert into test_tmp(id, name ) select id, name from test with(holdlock tablockx)')
go
set identity_insert test_tmp off
go
drop table test
go
exec sp_rename N'test_tmp' ,N'test' , 'OBJECT'
go
commit
GO
/****************验证结果*****************/
insert into test values ('张曼')
select * from test
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有