Admin User Feb,08 2017
Today i came across one interesting inbulit function of sql that is 'COALESCE'. Using which i can get comma separated values of a column in sql table. I have explained how its been possible to me. Please have a look below.
SELECT * FROM university;DECLARE @universityList varchar(100);SELECT @universityList = COALESCE(@universityList + ',', '') +CAST((universityName) AS varchar(5))FROM universitySELECT @universityList as CSV;