posts - 0,  comments - 6,  trackbacks - 0

首先看建表语句 ,其中红色语句为自动增长列的实现,更详细内容请参考apache的derby用户手册:

create table cutCustomers (

     id int not null PRIMARY KEYGENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),

     name varchar(10),

     tell varchar(20),

     createDate varchar(20)

)

接着,执行插入语句:

insert into cutCustomers values('阿亮','138264852','2010年10月2日')

报错:ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

费老大劲在百度google上搜索,无解。数据类型应该也没问题。结果尝试单列插入,以排除其他列带来的问题。

insert into cutCustomers (name) values('阿亮')

结果:插入成功

思考:其他列没有数据类型问题,难道是需要指定列名?

指定列名,尝试执行:

insert into cutCustomers (name,tell,createDate) values('阿亮','138264852','2010年10月2日')

成功!!!!!!!!!!!!

我那个汗啊!

学软件开发,到蜂鸟科技!
超强的师资力量 、完善的课程体系 、超低的培训价格 、真实的企业项目。

网址:www.ntcsoft.com 
电话:0371-63839606 
郑州软件开发兴趣小组群:38236716

posted on 2010-11-26 00:35 whistler 阅读(1969) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

留言簿(2)

我参与的团队

文章档案(22)

搜索

  •  

最新评论