Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Dear All,i've table test with columns ID int, name varchar(40).i'd like to give the autoincrement values from 7000. i'm getting error with the below query. please correct me. data is there in the tablealter table test1 alter column id int identity(7000,1)ArnavEven you learn 1%, Learn it with 100% confidence.
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2008-09-05 : 09:34:47
It is not possible using ALTER command. Do this via SSMS for easinessMadhivananFailing to plan is Planning to fail
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-09-07 : 00:05:16
or do this work around1. create a new colun id2
alter table test1 add id2 int identity(7000,1)
2.copy current values to new column
set identity_insert test1 on Update test1set id2=idset identity_insert test1 off
3. drop the old column and rename new column
alter table test1 drop column idgoEXEC sp_rename 'test1.[id2]', 'id', 'COLUMN'