How to get column values with comma seperated in sql server
DECLARE @ResultVar VARCHAR(1000)
SELECT @ResultVar = COALESCE(@ResultVar + ', ', '') + CAST(TickerSymbol AS varchar(50))
FROM company
print @ResultVar
SELECT @ResultVar = COALESCE(@ResultVar + ', ', '') + CAST(TickerSymbol AS varchar(50))
FROM company
print @ResultVar
Comments
Post a Comment