Set Auto Increment Value of Column in Table in MS SQL

main Image
Individually set auto increment value of column in table in MS SQL.

For this we have set IDENTITY() property of any column.In that property the first argument refer to the starting position of column which auto increment and second argument refer to the difference between two values being inserted in the column.


Syntax for creating table as below:

For example:-
CREATE TABLE [dbo].[usertype] (
[recid] BIGINT NOT NULL IDENTITY(5, 10),
[usertype] VARCHAR (50) NOT NULL,
PRIMARY KEY CLUSTERED ([recid] ASC)
);


Then when we insert record in it as

Syntax for inserting data in table as below:

INSERT INTO usertype (usertype) VALUES ('client'),('programmer');

then the table data will be as follow

data of table as follow

Hence we can set the starting position and difference between the two values of any autoincrement column in table in MSSQL.

I hope this article will help you.