Click here to Skip to main content
15,900,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DBCC CHECKIDENT('databasename.dbo.tablename', RESEED, number)

I have tried this but am not deleting the rows in database only displaying it by setting flag active.when a row is deleted it is set as false flag and after inserting another row it displays ID incrementing the false flag +1.

How can we solve this?

What I have tried:

DBCC CHECKIDENT('databasename.dbo.tablename', RESEED, number)
Posted
Updated 19-Oct-16 10:08am

If you are planning to decrement SEED for identity column, you cannot do it without without deleting rows. example you have 5 rows, you can not set seed to 5 without deleting 5th row.

Here are two ways to get rid of this
1. Do not display identity column in application.
2. Delete it from this table and save it other history table

Hope this helps.
 
Share this answer
 
If you think you need to do this you've got a serious design problem with your database. You should NEVER have to do this, ever.
 
Share this answer
 
Comments
Aashish68 20-Oct-16 1:25am    
Thanks for the solution guys.I think i should not display the ID in table.

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