Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi GuysI have a table that is going to hold email addresses for a mailing listEg.MailingList:ID, Email1,billybob@ipadd.com2,janef@ipadd.com3,harryk@ipadd.com4,evonnet@ipadd.comI 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.comI 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