Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello
Hiiii i dont have idea about reset identity values in taables pls help me ...

thankq in advance ...its urgent
Posted

use truncate table command to reset identity values in taables. example:-
SQL
truncate table UrTableName
use this query
 
Share this answer
 
Comments
Mamtha7 18-Jun-12 0:55am    
thankq so much
SoMad 18-Jun-12 1:26am    
If this solutions solved your problem, you should mark it.

Soren Madsen
Sandeep Mewara 18-Jun-12 2:43am    
If I have to truncate to reseed (I agree it would do what you say, yet!) then why not to create a new table and still stick with an old one?
Delete old one, create a new one. ??
To reseed the identity value in table use the below statement:

DBCC CHECKIDENT (yourtablename, reseed, value to start from)

For eg:

DBCC CHECKIDENT ('EmployeeDetails', reseed, 1000) - to start inserting values from 1001 in EmployeeDetails table
 
Share this answer
 
You need to use:
DBCC CHECKIDENT

Reference: MSDN: DBCC CHECKIDENT (Transact-SQL)[^]

Have a look at these similar question asked earlier:
i am applying a identity column on accno in accdetails table[^]
How to reset identity specification in sql server[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900