方法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')
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“)')
如果这个不行,就调换双引号单引号位置
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看看。
不要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) '核心就是这一句
有没有分都无所谓,关键是希望对你有一点点帮助~