create table stud(StudId int,StudName NVARCHAR(50))
Insert into stud(StudId,StudName)
Select 1,'A'
Insert into stud(StudId,StudName)
Select 3,'B'
Insert into stud(StudId,StudName)
Select 5,'C'
Insert into stud(StudId,StudName)
Select 7,'D'
Declare @MaxSeed Int
Select @MaxSeed = max(StudId)+1 from Stud
Select @MaxSeed
Alter table stud add NewStudId int identity(1,1)
--Write a logic to insert all the values of old column to new column and drop the old column
--Rename the new column to cold column
DBCC CHECKIDENT (stud,RESEED,7)
Insert into stud(StudName)
Select 'E'
Select * from stud
Regards
Mydeen
Muhsinathk, if this helps please login to Mark As Answer. | Alert Moderator