Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Sending Email

Author  Topic 

Potso6767
Starting Member

18 Posts

Posted - 2008-04-25 : 10:24:05
Ok I am going to try and explain this best as possible.
I have a report that gets everyones name who has not filled in attendance for a class. what they want is when the report is ran an email gets sent out. so I have written the sql to create a temp table that will get the distinct email.... so lets say the table consists of

jacob.ostop@synergit.com
xxxx@yyyy.com
gagsag@shsna.com


what i need to do now is get those three address and add them to a string that would be in the format of

jacob.ostop@synergit.com ; xxxx@yyyy.com ; gagsag@shsna.com

so that i can put that in the TO field of my email.
my problem is that i dont know how to get them each 1 at a time and put in semi colons..

can someone please help me!

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2008-04-25 : 10:33:43
[code]declare @emails varchar(8000)
select @emails = isnull(@emails + '; ', '') + email from myTable
select @emails[/code]

Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page
   

- Advertisement -