日期:2014-05-18 浏览次数:20584 次
if OBJECT_ID('tb_test','u') is not null drop table tb_test
go
create table tb_test 
(
    id int identity(10000,1),
    name varchar(50)
)
go
insert into tb_test(name)
select 'ab' union all
select 'cd' union all
select 'ef'
go
select * from tb_test
/*
id          name
----------- --------------------------------------------------
10000       ab
10001       cd
10002       ef
(3 row(s) affected)
*/
go
--通过 DBCC CheckIdent(TB_Name,RESEED,StartNum) 方法改变
dbcc CHECKIDENT(tb_test,reseed,2600000)
go
insert into tb_test(name)
select 'gh' union all
select 'ii' union all
select 'gg'
go
select * from tb_test
go
/*
id          name
----------- --------------------------------------------------
10000       ab
10001       cd
10002       ef
2600001     gh
2600002     ii
2600003     gg
(6 row(s) affected)
*/
------解决方案--------------------
DBCC CHECKIDENT ("DBNAME.TABLENAME", RESEED, 2600000);
------解决方案--------------------