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)
 Mailing List

Author  Topic 

rcr69er
Constraint Violating Yak Guru

327 Posts

Posted - 2009-03-12 : 12:53:04
Hi Guys

I have a table that is going to hold email addresses for a mailing list

Eg.

MailingList:
ID, Email
1,billybob@ipadd.com
2,janef@ipadd.com
3,harryk@ipadd.com
4,evonnet@ipadd.com

I am creating a SSIS package that is going to use the email addresses in MailingList table within a ‘Send Mail Task’. I was basically going to use an ‘Execute SQL Task’ to generate the list into a variable which I would then use in the ‘ToLine’ expression for the ‘Send Mail Task’

The thing I am trying to achieve is have the following output:
billybob@ipadd.com; janef@ipadd.com; harryk@ipadd.com; evonnet@ipadd.com

I hope this all makes sense and is this possible to do.

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-12 : 13:06:44
yup. its possible just use like

SELECT STUFF((SELECT ',' + Email FROM MailingList FOR XML PATH('')),1,1,'') AS EMailString
Go to Top of Page

rcr69er
Constraint Violating Yak Guru

327 Posts

Posted - 2009-03-13 : 11:41:27
Hey

Thanking you yet again!!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-13 : 13:57:43
welcome
Go to Top of Page
   

- Advertisement -