IDENTITY (Function)
Is used only in a SELECT statement with an INTO table clause to insert an identity column into a new table. Although similar, the IDENTITY function is not the IDENTITY property that is used with CREATE TABLE and ALTER TABLE.
Note
To create an automatically incrementing number that can be used in multiple tables or that can be called from applications without referencing any table, see Sequence Numbers.
Syntax
IDENTITY (data_type [ , seed , increment ] ) AS column_name
Arguments
data_typeIs the data type of the identity column. Valid data types for an identity column are any data types of the integer data type category, except for the bit data type, or decimal data type.
seed
Is the integer value to be assigned to the first row in the table. Each subsequent row is assigned the next identity value, which is equal to the last IDENTITY value plus the increment value. If neither seed nor increment is specified, both default to 1.
increment
Is the integer value to add to the seed value for successive rows in the table.
column_name
Is the name of the column that is to be inserted into the new table.
Conversion Conversion Emoticon Emoticon