Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
I have 1000 records in my sql table the sequence is start from 1 to 1000, I delete all records now I insert new records I want to get sequence from1001 is it possible.
Posted
Comments
Michael_Davies 11-Jun-15 17:02pm    
Depends how you delete, if you TRUNCATE the table it will reset the autoincrement.

If you Google you will find:

ALTER TABLE tablename AUTO_INCREMENT = value;
[no name] 11-Jun-15 17:02pm    
Yes it's possible

Either do nothing and your auto increment field will start at 1001 if it's true that you have 1000 records already. Or set your auto increment field to start at 1001.
Torakami 12-Jun-15 2:56am    
perhaps you can use DBCC command to correct the actual seeding , and then stat from next value

DBCC CHECKIDENT (yourtable, reseed, 34)

Refer this link

http://blog.sqlauthority.com/2007/03/15/sql-server-dbcc-reseed-table-identity-value-reset-table-identity/
virusstorm 12-Jun-15 13:43pm    
An IDENTITY column would also do the trick.

http://www.sqlteam.com/article/understanding-identity-columns
Member 11039257 17-Jun-15 1:56am    
Whether Sequence column is create with identity?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900