首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

用了一个SQL报错。苦闷了

2012-12-29 
用了一个SQL报错。。。郁闷了sqlSELECT convert(char(20),isnull(a.item_no,))+convert(char(20),isnull(

用了一个SQL报错。。。郁闷了
用了一个SQL报错。苦闷了用了一个SQL报错。苦闷了sql="
SELECT convert(char(20),isnull(a.item_no,''))+convert(char(20),isnull(a.item_subname,''))
+convert(char(20),isnull(a.item_size,''))
+case when convert(int,round(a.price,2)*100)%100=0 then convert(char(9),convert(dec(9,0),a.price)) when convert(int,round(a.price,2)*100)%10=0 then convert(char(9),convert(dec(8,1),a.price)) else convert(char(9),convert(dec(7,2),a.price)) end
+case when convert(int,round(a.sale_price,2)*100)%100=0 then convert(char(9),convert(dec(9,0),a.sale_price)) when convert(int,round(a.sale_price,2)*100)%10=0 then convert(char(9),convert(dec(8,1),a.sale_price)) else convert(char(9),convert(dec(7,2),a.sale_price)) end
+convert(char(8),item_clsno)
+convert(char(9),0)
FROM t_bd_item_info a
"


[解决办法]
换行要要续行符 "&"

sql=" &
SELECT convert(char(20),isnull(a.item_no,''))+convert(char(20),isnull(a.item_subname,'')) &
+convert(char(20),isnull(a.item_size,'')) & &
+case when convert(int,round(a.price,2)*100)%100=0 then convert(char(9),convert(dec(9,0),a.price)) when convert(int,round(a.price,2)*100)%10=0 then convert(char(9),convert(dec(8,1),a.price)) else convert(char(9),convert(dec(7,2),a.price)) end
+case when convert(int,round(a.sale_price,2)*100)%100=0 then convert(char(9),convert(dec(9,0),a.sale_price)) when convert(int,round(a.sale_price,2)*100)%10=0 then convert(char(9),convert(dec(8,1),a.sale_price)) else convert(char(9),convert(dec(7,2),a.sale_price)) end &
+convert(char(8),item_clsno) &
+convert(char(9),0) &
FROM t_bd_item_info a &
"

热点排行