Concatenate strings from column into a single row

-- table STATES has at least one row called states  
-- including the following information
--> USA
--> Germany
--> France
--> Great Britain
 
DECLARE @states VARCHAR(1024) 
 
SELECT 
    @states = COALESCE(@states + ',', '') + states   
FROM 
    states  
 
SELECT @states

-->output: USA,Germany,France,Great Britain

Comments

There were no comments found for this weblog.

Du mußt Dich einloggen um diesen Weblog kommentieren zu können!