mysql插入语句出错 用sqlyog可视化工具里面直接执行的
插入语句:insertintoroy_userexp(userID,beginTime,endTime,position,companyName,leave)values...
插入语句:
insert into roy_userexp(userID,beginTime,endTime,position,companyName,leave)values("25","2012-04-23","2012-04-26","dd","dd","dd");
出错信息:Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'leave)values("25","2012-04-23","2012-04-26","dd","dd","dd")' at line 1
(0 ms taken) 展开
insert into roy_userexp(userID,beginTime,endTime,position,companyName,leave)values("25","2012-04-23","2012-04-26","dd","dd","dd");
出错信息:Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'leave)values("25","2012-04-23","2012-04-26","dd","dd","dd")' at line 1
(0 ms taken) 展开
3个回答
展开全部
大哥,你的日期列的格式还有报错信息上显示leave列出错,最好重点看看你那两列,实在不行的话,就删掉,在语句可以执行的基础上再一列一列的往上添加,很快就可以查出原因了,我的个人经验,是与否你自己查一下吧
追问
因为leave是mysql 的关键字, 所以必须加上`leave` 多谢回答
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
leave 是关键字哦,`leave`这样就可以了,试试!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
单引号 不是双引号("25","2012-04-23","2012-04-26","dd","dd","dd");
追问
是单引号,我贴错了. insert into roy_userexp (userID,beginTime,endTime,position,companyName,leave) values (78,'2012-04-23','2012-08-26','48','45','74');
追答
1064错误 一般是语法错误。原因有可能 你输入了中文逗号之类的 你仔细检查一下。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询