Search code examples
sql-servermanagement-studio-express

Identity increment not consistent ms sql sever


As an overview.

I created a table and set under Identity Specification on the primary key column, the Identity Increment to 1 and the Identity Seed to 1 as well(in the Design of the table).

I noticed however the the increment(when inserting values) would be 1...2 and then 1001...1002...1003.

Why does this happen?

This is the CREATE script of the table

CREATE TABLE [dbo].[Opl_Question](
[Question_Id] [int] IDENTITY(1,1) NOT NULL,
[QuestionName] [nvarchar](500) NULL,
[QuestionDescription] [nvarchar](500) NULL,
[QuestionType] [nvarchar](20) NULL,
[DateCreated] [datetime] NULL,
[DateUpdated] [datetime] NULL,
[ChecboxCountCorrect] [int] NULL,
[OPL_Id] [int] NULL,
 CONSTRAINT [PK_Opl_Question] PRIMARY KEY CLUSTERED 
(
    [Question_Id] ASC
   )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

   GO

The inserting is a manual adding of some data at the moment

USE DB
GO



 INSERT INTO Opl_Question(QuestionName, QuestionDescription, QuestionType, DateCreated, DateUpdated, ChecboxCountCorrect, OPL_Id)
 VALUES('2. Question 2', '2. Question 2', 'radio', GETDATE(), GETDATE(), 0, 2)

Solution

  • You can find here the answer. if you set seed normal values (I see you set it) it is not about you. Take a look forementioned link.