Identity Column in Sql Server  

Identity columns are columns with values automatically generated when a new record is inserted into a database table. By default the seed and the increment value, both are 1.

0 377 Technology | Sql Server
Tue Dec 25 , 2018

In Sql Server you have the options for both seed and increment. By default the seed and the increment both are 1.
An identity column is much like an AutoNumber field in Microsoft Access or a sequence in Oracle.
An identity column differs from a primary key in that its values are managed by the server and usually cannot be modified.


IDENTITY(seed , increment)   

where seed is the value that is used for the very first row loaded into the database table.
increment is the incremental value that is added to the identity value of the previous row that was loaded.


You must specify both the seed and the increment or neither. If neither is specified, the default is (1,1).

Example using identity column

Create Table Student 
   FirstName varChar(30),
   LastName  varChar(30),
   StudentID int identity(1, 1)

Subscribe & Get Regular Updates On Your E-mail