SQL Not Auto-incrementing

I have the following SQL I trigger in a C # application.

Everything works well, but the identifier table does not grow automatically. It creates a value of 1 for the first record, and then does not allow other inserts due to the impossibility of creating an unquie identifier.

Here is the SQL:

CREATE TABLE of_mapplist_raw (
    id          integer PRIMARY KEY NOT NULL,
    form_name   varchar(200) NOT NULL,
    form_revi   varchar(200) NOT NULL,
    source_map  varchar(200),
    page_num    varchar(200) NOT NULL,
    fid         varchar(200) NOT NULL,
    fdesc       varchar(200) NOT NULL
)";

I am sure there is a school mistake here.

+3
source share
2 answers

you need to specify its seed and increment. (plus, I don’t think there is a keyword integer....)

id  [int] IDENTITY(1,1) NOT NULL,

the first value is the seed

the second is the delta between the increases

A Question you might ask :

delta between increase? why do I need it? its always 1 .... ??

- . - ... , ... ... , .

p.s. .

+8

Identity.

id  int IDENTITY(1,1) NOT NULL
+2

All Articles