有的下面一个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开始增长呢?
怎样设置它的自动增长的起始值呢?
(
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开始增长呢?
怎样设置它的自动增长的起始值呢?
解决方案 »
- 求教Hibernate错误Could not execute JDBC batch update 请耐心看完
- tomcat含有中文的文件不能下载
- Caused by: java.sql.SQLException: 数据大小超出此类型的最大值的问题?
- spring+hibernate配置问题(急)
- 急,关于STRUTS与UML对象模型
- struts中的error问题
- 做 EJB的 好 找 工作吗?
- j2ee典型例子的那些文件怎知编译啊?
- 请问怎样手工的解析XML文件啊.( 不借助任何的xml解析器)急!!!
- 两个List去重合并的问题
- strust1.2动态上传多个文件只能得到一个的问题
- 近期想参加一个JavaEE 架构师或者Oracle数据方面的培训(北京)
这里不是么?
(
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
)
设置大于0没问题
alter table article auto_increment=20;