SQL导出EXCEL列错乱
在数据库导出记录,用户在字符串有回车键,造成SQL查询出来另存时列值错乱。初步试了如下语句可以。
SELECT PRD_NO,ITM,
REPLACE(REPLACE(ISNULL(JYGJ,''),char(10),''),char(13),'') AS JYGJ,
REPLACE(REPLACE(ISNULL(JYXM,''),char(10),''),char(13),'') AS JYXM,
REPLACE(REPLACE(ISNULL(JYBZ,''),char(10),''),char(13),'') AS JYBZ,
REPLACE(REPLACE(ISNULL(GYYQ,''),char(10),''),char(13),'') AS GYYQ FROM PRDT_Y ORDER BY PRD_NO,ITM