I am trying to get email addresses in column and concatenate them into a long string, separated by semi-column ";". So, the results would be like:
I have this T-SQL below and I am using a while loop that does not work, but I am wondering if I a cursor would work better. I am not sure, as what is below is not working. Can you help me with this query to get the results?
declare @emails as varchar(5000)
while exists (select People.cEmail from dbo.People)
set @emails = cEmail + ';' + @emails