Simple way of getting Comma separated Row values

vishalneeraj-24503
Posted by vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 841
Below Sql server code is a a better and simpler way of getting Comma separated row values without using cursors.

declare @emp_name varchar(max);

select @emp_name = isnull(@emp_name + ',', '') + [employee_name]
from employee_master
order by employee_name;

select @emp_name as employee_name;

Comments or Responses

Login to post response