Friday, December 24, 2010

Reset autonumber in sql server (TSQL)

Here is the script to reset autonumbers in sql server. Usually, i have to delete the table contents and then reseed the tables.

TSQL Script:
1:  use Transmittal  
2:  go  
3:  delete from dbo.TransDetails;  
4:  delete from dbo.TransMaster;  
5:  DBCC CHECKIDENT (TransMaster, reseed, 0)  
6:  DBCC CHECKIDENT (TransDetails, reseed, 0)  

0 comments:

Post a Comment