Saturday, 31 July 2010

COALESCE- Convert Row values to Comma Separated value

DECLARE @EmployeeList varchar(100)
SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') +
CAST(c AS varchar(5)) FROM Employee
Select @EmployeeList