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
 SSIS and Import/Export (2005)
 Send email with attachment

Author  Topic 

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-10-28 : 14:38:50
Greetings

I want to be able to send an email to each field worker with an attachment. Each attachment will have different content. I could have 1 to many field workers
How do I (for each user)
1. create an Excel file from a stored procedure or a query
2. dump it to a ftp or a share folder
3. Send an email to field worker with the excel attached.

I was trying to do all of this within a For Each Loop, will that work?

Thanks much!

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion

mfemenel
Professor Frink

1421 Posts

Posted - 2009-10-28 : 16:26:03
Do you really have to do this in TSQL? It seems like this would be better suited to an SSIS package? What frequency do you need to do this? While it is feasible to do this in TSQL it's not pretty.

Mike
"oh, that monkey is going to pay"
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-10-28 : 16:32:02
Professor, I want to do it in SSIS :)

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-10-29 : 06:28:07
Yes, that will work nicely in SSIS.
1. Is your source data in a recordset?
2. Do you have the details for the SMTP server?

Also be aware of your attachment filesize limit - you may want to compress the file before sending.
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-10-29 : 09:58:58
awesome! Yes my source data is a recordset, well it is a result of a query
I just got the details of the SMTP server. Problem is how do I loop for each email address in recordset. I am trying to use a FOR Loop with a send Mail Task. I have my variable set with the right scope. How do I tie it all together. thanks !

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

gaauspawcscwcj
Starting Member

29 Posts

Posted - 2009-11-06 : 04:24:20
using a Script Task to set u email address in for loop before send mail task

gaauspawcscwcj
Go to Top of Page
   

- Advertisement -