SQL, SQL Server, Tutorials, Oracle, PL/SQL, Interview Questions & Answers, Joins, Multiple Choice Questions, Quiz, Stored Procedures, Select, Insert, Update, Delete and other latest topics on SQL, SQL Server and Oracle.
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment