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

2 Comments

Comments have been disabled for this content.