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;