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 &
"