日期:2014-05-18 浏览次数:20800 次
select ''''''+列名1+'''''', ''''''+列名2+'''''' from table1 --要显示双引号,你要用6个单引号在SQL里
------解决方案--------------------
CREATE TABLE t1 ( arrid VARCHAR(10), array VARCHAR(2000) ) INSERT INTO t1 SELECT 'A', '20,223,2544,25567,14' UNION ALL SELECT 'B', '30,-23433,28' UNION ALL SELECT 'C', '12,10,8099,12,1200,13,12,14,10,9' UNION ALL SELECT 'D', '-4,-6,-45678,-2' UNION ALL SELECT 'E', '5,18,258,6,-52' UNION ALL SELECT 'F', '1,2,3,45,-678' UNION ALL SELECT 'G', '1,58,6' SELECT ''''''+arrid+'''''', ''''''+array+'''''' FROM t1 ----------------------- ''A'' ''20,223,2544,25567,14'' ''B'' ''30,-23433,28'' ''C'' ''12,10,8099,12,1200,13,12,14,10,9'' ''D'' ''-4,-6,-45678,-2'' ''E'' ''5,18,258,6,-52'' ''F'' ''1,2,3,45,-678'' ''G'' ''1,58,6''