SQL Server convert select a column and convert it to a string

前端 未结 10 543
礼貌的吻别
礼貌的吻别 2020-12-05 05:28

Is it possible to write a statement that selects a column from a table and converts the results to a string?

Ideally I would want to have comma separated values.

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 05:52

    SELECT  CAST( AS VARCHAR(3)) + ','
    FROM    
    FOR     XML PATH('')
    

    提交回复
    热议问题