Quick Search

An Identity Column

July 13th, 2010 by admin
Leave a reply »

 

An identity column is one whose value is automatically created by the database engine when a new record is added. This makes sure that each record has a unique value for that field.

To create an identity column in Transact-SQL, after the name and data type of the column, type identity followed by parentheses. Between the parentheses, enter the seed value, followed by a comma, followed by the increment value. Here is an example:

CREATE TABLE Store(
    ItemID int IDENTITY(1, 1) NOT NULL,
    Category nvarchar(50),
    ItemName nvarchar(100) NOT NULL,
    Size nvarchar(20),
    UnitPrice money);
GO

Posted in Database

You can follow any responses to this entry through the RSS 2.0 Feed. You can leave a response , or trackback from your own site.

Leave a Reply

SEO Company India

search engine marketing company India that offers affordable seo services