有的下面一个sql语句create table article 
(
id int primary key auto_increment,
pid int,
rootid int,
title varchar(255),
cont text,
pdate datetime,
isleaf int #1-not leaf 0-leaf
)
auto_increment=0;insert into article values (null, 0, 1, '蚂蚁大战大象', '蚂蚁大战大象', now(), 1);
insert into article values (null, 1, 1, '大象被打趴下了', '大象被打趴下了',now(), 1);
insert into article values (null, 2, 1, '蚂蚁也不好过','蚂蚁也不好过', now(), 0);
insert into article values (null, 2, 1, '瞎说', '瞎说', now(), 1);
insert into article values (null, 4, 1, '没有瞎说', '没有瞎说', now(), 0);
insert into article values (null, 1, 1, '怎么可能', '怎么可能', now(), 1);
insert into article values (null, 6, 1, '怎么没有可能', '怎么没有可能', now(), 0);
insert into article values (null, 6, 1, '可能性是很大的', '可能性是很大的', now(), 0);
insert into article values (null, 2, 1, '大象进医院了', '大象进医院了', now(), 1);
insert into article values (null, 9, 1, '护士是蚂蚁', '护士是蚂蚁', now(), 0);为什么它的id还是从1开始增长呢?
怎样设置它的自动增长的起始值呢?

解决方案 »

  1.   

    auto_increment=0;
    这里不是么?
      

  2.   

    mysql让修改不噢???不让修改就自认倒霉吧
      

  3.   

    create table article 
    (
    id int primary key auto_increment,
    pid int,
    rootid int,
    title varchar(255),
    cont text,
    pdate datetime,
    isleaf int #1-not leaf 0-leaf
    )
    auto_increment=0;
    你创建表的语句有错误吧,试试下面的
    create table article 
    (
    id int primary key identity(1,2),
    pid int,
    rootid int,
    title varchar(255),
    cont text,
    pdate datetime,
    isleaf int --#1-not leaf 0-leaf
    )
      

  4.   

    mysql自增字段只能从大于等于1开始增长。
    设置大于0没问题
    alter table article auto_increment=20;
      

  5.   

    id int primary key identity(1,2),   1:开始的值;2:指的是每次增加多少