Geeks With Blogs
Nouman Zakir while (true) { Post.NewArticle(); }

You may use DBCC CHECKIDENT to reseed (reset) the identity column of any table in SQL Server.

Example:

A table has 10 rows with 10 as last identity. The next record will automatically genrate 11, to start the new identity use the follwing T SQL query in query analyzer.

DBCC CHECKIDENT (tableName, reseed, 15)

To set the seed to zero use the following T SQL query in query analyzer.

DBCC CHECKIDENT (tableName, reseed, 0)

Avoid using a value lower than the current value, doing this will violate the uniqueness contrant in case of new entries.

Posted on Wednesday, February 11, 2009 3:59 AM SQL | Back to top


Comments on this post: Reset table identity (reseed) in SQL Server with DBCC RESEED

# re: Reset table identity (reseed) in SQL Server with DBCC RESEED
Requesting Gravatar...
Thanks. Found it just when I needed it !
Left by Dufrain on Feb 11, 2009 2:52 PM

# re: Reset table identity (reseed) in SQL Server with DBCC RESEED
Requesting Gravatar...
Thankewwwwwwwww. It worked
Left by HAM on Jun 22, 2009 6:14 AM

# re: Reset table identity (reseed) in SQL Server with DBCC RESEED
Requesting Gravatar...
Thanks a mil
Left by JWeb on Jul 08, 2009 8:23 AM

Your comment:
 (will show your gravatar)


Copyright © Nouman Zakir | Powered by: GeeksWithBlogs.net