Monday, October 8, 2007

Reset autonumber (IDENTITY) column in SQL Server

Sometimes we need to reset the autonumber column in a table.

Using the DELETE statement is not enough. The statement only delete the data but not reset the identity column.

So how can we do it?

   1:  DELETE FROM tblName 
   2:   
   3:  DBCC CHECKIDENT (tblName,RESEED, 0)
 
 

 

Technorati Tags:

 



No comments: