What is Identity in Sql:
An identity column of a table is a column whose value increases automatically. The value in an identity column is crated by the server. A user generally cannot insert a value into an identity column.
Example:
An identity column of a table is a column whose value increases automatically. The value in an identity column is crated by the server. A user generally cannot insert a value into an identity column.
Example:
- CREATE TABLE EMPLOYEE
- (
- IID INT IDENTITY(1,1),
- NAME [varchar](MAX) NOT NULL,
- AGE INT NOT NULL
- )
IDENTITY_INSERT ON allows a user to insert data into an Identity column and IDENTITY_INSERT OFF restricts a user from inserting data into an Identity column.
No comments:
Post a Comment