Can we reset the identity column?

 Posted by Ddd on 2/2/2011 | Category: Sql Server Interview questions | Views: 3543 | Points: 40

Yes, we can reset the identity column

use the dbcc checkident statement

create table sales
(sno int identity(100,1),
sname varchar(10))

insert sales values('usb')
insert sales values('kbd')

select * from sales

sno sname
100 usb will be the output.
101 kbd

Now run this command.

dbcc checkident('sales',reseed,50)

the seed value will be reset to 50

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response