Sybase LIST函数在256个字符后截断结果

时间:2018-10-24 19:03:23

标签: sql aggregate-functions sybase

我试图通过将字符串连接在一起并使用syabase的LIST功能将它们用逗号分隔来将一列字符串聚合到一个单元格中。但是结果在256个字符后会被截断。有谁知道解决这个问题的方法,或者是否有其他选择可以满足我的需求。

例如,如果我有一个像这样的表myTable

myVal
-------------
'0000000001'
'0000000002'
'0000000003'
'0000000004'
'0000000005'
'0000000006'
'0000000007'
'0000000008'
'0000000009'
'0000000010'
'0000000011'
'0000000012'
'0000000013'
'0000000014'
'0000000015'
'0000000016'
'0000000017'
'0000000018'
'0000000019'
'0000000020'
'0000000021'
'0000000022'
'0000000023'
'0000000024'
'0000000025'
'0000000026'
'0000000027'
'0000000028'
'0000000029'
'0000000030'

然后运行以下查询:

select list(myVal,',') as myResult from myTable

我得到以下结果

myResult
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0000000001,0000000002,0000000003,0000000004,0000000005,0000000006,0000000007,0000000008,0000000009,0000000010,0000000011,0000000012,0000000013,0000000014,0000000015,0000000016,0000000017,0000000018,0000000019,0000000020,0000000021,0000000022,0000000023,000

请注意,结果字符串在0000000023之后被截断

1 个答案:

答案 0 :(得分:2)

尝试一下:

SELECT
    LIST( CAST( myVal AS nvarchar(max) ), ',' )
FROM
    myTable