Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Why ID numbering skip 5? I set the identity specification to (1, 1) already

$
0
0

Hello,

I have a question. I created a table with the identity specification (1,1). However, after I entered a couple of rows, I found the ID skipped number 5; it jumped from 4 to 6. How did this happen? and how to fix this?

Thanks,

Feifei

query for creating the table

CREATE TABLE [dbo].[Gene](
    [gene_id] [numeric](38, 0) IDENTITY(1,1) NOT NULL,
    [gene_name] [varchar](50) NOT NULL,
    [complex_no] [varchar](38) NOT NULL,
 CONSTRAINT [Gene_pk] PRIMARY KEY CLUSTERED
(
    [gene_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

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[Gene]  WITH CHECK ADD  CONSTRAINT [Gene_fk] FOREIGN KEY([complex_no])
REFERENCES [dbo].[OXPHOS] ([complex_no])
GO

ALTER TABLE [dbo].[Gene] CHECK CONSTRAINT [Gene_fk]
GO

results

gene_id    gene_name    complex_no
1    COX 4i-1    IV
2    COX 4i-2    IV
3    cox 5    IV
4    ndufs1    I
6    ndufs2    I
7    ndufs3    I
8    ndufs8    I
9    ndufv2    I


Viewing all articles
Browse latest Browse all 8428

Trending Articles