Shiny
Shiny

Reputation: 1083

How to reset identity in Table

My scenario is... I create Table as(id identity(1,1) not null,name varchar(500),category varchar(50))... i try to insert values.. displays has (1,'sede','diabetes') and it goes has 1,2,3. But when i delete the total content.. once again insert it starts with 4,5,6...

I don want this type of inserting...When content i deleted it should start from 1,2,3..

How can i achieve this.. i need it in stored procedure.. Any idea..

Upvotes: 3

Views: 1261

Answers (1)

codingbadger
codingbadger

Reputation: 44042

You can reset the Identity seed by executing dbcc checkident

DBCC CHECKIDENT ("TableName", RESEED, 0)

Upvotes: 7

Related Questions