The IDENTITY property enables you to use system generated values in your tables column. It is similar to the auto number datatype in MS ACCESS. You are allowed a single column in each table with the IDENTITY property. Typically, IDENTITY column generates system assigned keys. To enforce entity integrity, you must uniquely identify each row in a table. If no natural column or set of column does this, you might went to create an IDENTITY column.
You can use the IDENTITY property if the column to which it is being assigned is an integer or compatible with an integer. Therefore you can use the following datatypes - tinyint, bigint, smallint, numeric, integer, decimal.
You can use numeric and decimal only if they have scale of 0 (zero). It must also not allowed to NULL.
What is the IDENTITY property in SQL Server?
Posted by
Rajesh Rolen
at
Friday, October 23, 2009
Labels: SQL , SQL Interview Questions , sqlserver
0 comments:
Post a Comment