Projeção com FOR XML PATH

Exemplo:

DECLARE @temp TABLE (descricao VARCHAR(50))
 
INSERT INTO @temp (descricao)
VALUES ('a'),('b'),('c'),('d')
 
SELECT * FROM @temp
 
SELECT STUFF((
    SELECT ',' + descricao
    FROM @temp
    (''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') descricao
SQL

Leave a Reply

Your email address will not be published. Required fields are marked *

search previous next tag category expand menu location phone mail time cart zoom edit close