hi,
i wish to know how to set the initial value for the autoincrement in sql server.can anyone suggest me pls.
Thank u
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
ShambhuPosted Mar 14, 2011, 7:19 AM
U can also do the same thing at design level. If the table is already created right click on table and go to design. then select the column u want to set identity and seed by increment value. set IsIdentity to Yes, increment to 1, and seeding 1.
U can ref. images also.
It will generate column value automatically with increment by 1.
Please, don't forget to mark as answered if you think my post was helpful, thank's!
Micke BlomqvistPosted Feb 22, 2011, 6:37 AM
You set the initial value and the increment seed when you create the table:
CREATE TABLE [dbo].[test_table](
[id_col] [int] IDENTITY(1,1) NOT NULL,
[test_col] [varchar](50) NOT NULL
) ON [PRIMARY]
The first value after the IDENTITY is the initital value and the second one is the increment seed.