declare emp_name cursor for
select emp_name from employee_master order by emp_name;
declare @emp_names varchar(max);
declare @emp_name varchar(max);
open emp_name
fetch next from emp_name into @emp_name
while @@fetch_status = 0
begin
set @emp_names = isnull(@emp_names + ',', '') + @emp_name
fetch next from emp_name into @emp_name
end
close emp_name
deallocate emp_name
select @emp_names as employee_names