Freshers Aptitude technical questions
Freshers Job Alert
Bookmark and Share

  Identity & Reset Identity (After deletion of records)

Creates an identity column in a table. This property is used with the CREATE TABLE and ALTER TABLE Transact-SQL statements.

Syntax

IDENTITY [ ( seed , increment ) ]

Arguments

seed

Is the value that is used for the very first row loaded into the 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 increment or neither. If neither is specified, the default is (1,1).

Returns the last-inserted identity value.

Syntax
@@IDENTITY

Identity field for a table can be reset by using TRUNCATE statement, since TRUNCATE r emoves all rows from a table without logging the individual row deletes.