Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 After delete table how to reset identity column 1

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2008-07-08 : 13:32:42
After i use the delete statement, how to set the identity column id to start from 1

delete from TAB_ccsNetorders


Thank you very much for the information.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-08 : 13:34:15
Use DBCC CHECKIDENT

http://msdn.microsoft.com/en-us/library/ms176057.aspx
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-07-08 : 14:21:28
If you are deleting the all rows from the table you may consider using TRUNCATE TABLE instead. Check it out in Books Online for the advantages and restrictions.

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-08 : 14:23:48
Unless you've foreign constraints refering the table.
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-07-08 : 14:33:50
yep, that's just one of the "restrictions" I mentioned that is documented in BOL

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-08 : 23:28:30
quote:
Originally posted by TG

yep, that's just one of the "restrictions" I mentioned that is documented in BOL

Be One with the Optimizer
TG


Yeah.. just specified it
Go to Top of Page
   

- Advertisement -