SQL Server Performance

Auto Increment Field or Identity Field In MS SQL Server

Discussion in 'Getting Started' started by visiontechno, Mar 4, 2011.

  1. visiontechno New Member

    Auto Increment Field or Identity Field In MS SQL Server Creating a Auto Increment field in SQL Server allows a unique number to be generated when a new record is inserted into a table. Syntax for creating an Auto Increment field in SQL Server. CREATE TABLE [dbo].[Company]( [CompanyId] [bigint] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](200) NOT NULL, [Address] [nvarchar](max) NOT NULL, [Phone] [nvarchar](max) NULL, [autoBackup] [bit] NOT NULL, [applycreditlimit] [bit] NULL, [EmailId] [nvarchar](max) NULL, [salesTaxPercentage] [numeric](18, 2) NULL) Here, CompanyId has been set as an Auto Increment Id. A column which has datatype int, big int, tiny int or small int can only be set as an Auto Increment field. Suppose, you would like to set the AutoIncrement field (CompanyId) at the remote databases to only use the next number free AFTER the 100. Here, CompanyId has been set as an Auto Increment Id. A column which has datatype int, big int, tiny int or small int can only be set as an Auto Increment field. Suppose, you would like to set the AutoIncrement field (CompanyId) at the remote databases to only use the next number free AFTER the 100. There’s an “Identity Seed” parameter that you can specify (either through SQL or through the table designer in Enterprise Manager) that will let you set the base value for an Identity/AutoNumber field to the value you want. Any new Identity values will be incremented from this base (using the “Identity Increment” value which you can specify in the same place to determine how much to grow the value by).
    *** REMOVED the SPAM
  2. FrankKalis Moderator

    So, what exactly is your question?
  3. satya Moderator

    This is nothing but spam, not a question... as you can see an external link at the end of line. (will edit the post).

Share This Page