RSS Feed

IDENTITY

IDENTITY (Property)

SQL IDENTITY (Property) creates an identity column in a table.

Syntax:

IDENTITY [ ( seed , increment ) ]

Example 1 of IDENTITY (Property)

CREATE TABLE EMP
(
id_number int IDENTITY(1,1),
nick_name varchar (20)
)

INSERT EMP VALUES ('Sachin')
select * from EMP


INSERT EMP VALUES ('Amit')
select * from EMP


Example 2 of IDENTITY (Property)

CREATE TABLE EMP
(
id_number int IDENTITY(1,2),
nick_name varchar (20)
)

INSERT EMP VALUES ('Sachin')
select * from EMP


INSERT EMP VALUES ('Amit')
select * from EMP


See more examples of SQL Identity here.