SQL语句报错,说缺失逗号,帮我看看哪来了,我觉得没错呀,在线等

2024-12-29 03:40:41
推荐回答(4个)
回答1:

方法1
insert into ywls (summary,xqbm,xqmc,gjdbm,ssqxbm,fwxzbm,ywlsh,slrq) values('初期','3036','5454545','01','03','01',0,to_date(2011-01-18,'yyyy-mm-dd'))
方法2
insert into ywls (summary,xqbm,xqmc,gjdbm,ssqxbm,fwxzbm,ywlsh,slrq) values(select '初期','3036','5454545','01','03','01',0,'2011-01-18')

回答2:

insert into ywls (summary,xqbm,xqmc,gjdbm,ssqxbm,fwxzbm,ywlsh,slrq) values('初期','3036','5454545','01','03','01','0','to_date(2011-01-18,'yyyy-mm-dd')')
对啊

回答3:

insert into ywls (summary,xqbm,xqmc,gjdbm,ssqxbm,fwxzbm,ywlsh,slrq) values('初期','3036','5454545','01','03','01','0','to_date(2011-01-18,'yyyy-mm-dd')')

问题出在最后面这里,单引号匹配问题.

insert into ywls (summary,xqbm,xqmc,gjdbm,ssqxbm,fwxzbm,ywlsh,slrq) values('初期','3036','5454545','01','03','01',0,'to_date(2011-01-18,“yyyy-MM-dd“)')
如果这个不行,就调换双引号单引号位置
insert into ywls (summary,xqbm,xqmc,gjdbm,ssqxbm,fwxzbm,ywlsh,slrq) values('初期','3036','5454545','01','03','01',0,"to_date(2011-01-18,'yyyy-MM-dd')")
估计你是mysql,不知道可不可以这样写
insert into ywls (summary,xqbm,xqmc,gjdbm,ssqxbm,fwxzbm,ywlsh,slrq) values('初期','3036','5454545','01','03','01',0,to_date(2011-01-18,'yyyy-MM-dd'))

ywlsh既然是数字,那就不要引号了,你是什么数据库?把小mm改为MM看看。

回答4:

不要IF判断,最后完毕后删除最后的逗号就行了,例如:
do while not loc.eof
strlocationcode=loc("LocationCode")
sql=sql & "sum(case when LocationCode='"& strlocationcode &"' then totalqty else null end ) as "& strlocationcode &"qty,"
loc.movenext
loop
sql=left(sql, len(sql)-1) '核心就是这一句

有没有分都无所谓,关键是希望对你有一点点帮助~