Reputation: 1334
I have a table with ID
as a primary key. ID
is int
datatype which is auto increment identity start from -2147483648
.
I just delete all the records, then I am trying to make it start from the beginning. I want to start the first record with -2147483648
.
DBCC CHECKIDENT('TableName', RESEED, -2147483648)
If I run the script above, it will start from -2147483647
. Then I tried the following script:
DBCC CHECKIDENT('TableName', RESEED, -2147483649)
The error said:
Parameter 3 is incorrect for this DBCC statement
How can I start the identity from -2147483648
?
Thank you.
Upvotes: 1
Views: 695
Reputation: 1540
Try,
Truncate will Reset your Identity values. Delete will not Reset your Identity values..
I think Try to Change Your Data type Integer into Bigint
drop table ck
create table ck(id bigint identity(-2147483649,-1)not null,name varchar(20))
insert into ck values('AA');
insert into ck values('bb');
insert into ck values('cc');
select * from ck;
delete from ck
truncate table ck
DBCC CHECKIDENT('ck', RESEED, -2147483649)
Upvotes: 1