MS SQL resetting the auto increment

Have you ever wondered how to reset the auto increment in SQL table? Well I did, and here is how to achive this:

DBCC CHECKIDENT('test', RESEED, 0) ;

where 'test' is the tables name we want to reset.

There is a trick if you already have some date into your table your next inserting will start from 0.

Hope it helps

Cheers

Published Monday, March 03, 2008 6:11 AM by stoian bucovich

Comments

# re: MS SQL resetting the auto increment

Monday, September 28, 2009 4:28 AM by Emna

thanks a lot for this trick

# re: MS SQL resetting the auto increment

Tuesday, December 22, 2009 8:21 PM by Phillip Quinlan

Great, worked perfectly.

Thanks a lot!

# re: MS SQL resetting the auto increment

Friday, March 26, 2010 4:21 PM by Anlon

Hello everyone. Famous remarks are very seldom quoted correctly. Help me! Please help find sites for: 24 alavert allerg hour loratadine. I found only this - <a href="genericalavert.info/.../">alavert forum</a>. Alavert, not have also taken needs downhill to make seaworld orlando? This engine is just then naturally of the extra company, alavert. Waiting for a reply :confused:, Anlon from Guatemala.

# re: MS SQL resetting the auto increment

Monday, January 31, 2011 5:22 AM by Kevin Sharp

Thanks for the information was very usefull. I did, however, need to increse the security permissions for the user running this command. I needed to give my user the role of sysadmin. Just incase anyone else trys to do this and gets a permission denied.

# Reset autonumber su tabelle di database MS SQL &laquo; Nextre Knowledge Base

Pingback from  Reset autonumber su tabelle di database MS SQL &laquo;  Nextre Knowledge Base

Leave a Comment

(required) 
(required) 
(optional)
(required)