SQLTeam.com | Weblogs | Forums

Sending Email Attachment from SSIS TSQL Task

hi experts,
I'm using the following sql statement in a TSQL task. I get an email but there's no attachment. The file does exist. Any ideas? Thanks

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'My profile',
@recipients = 'My email addy',
@subject = 'Test emailing excel file from SSIS',
@query_attachment_filename = 'F:\ExcelSample.xlsx';

does that ExcelSample file exist in a the F drive? and does the service account have permission and access to it

yosiasz,

Yes to both questions. I didn't get any errors when I ran the SSIS task in Design mode. The task was green. Thanks

you specified @query_attachment_filename but you dont have a query. You need to use @file_attachments. Read up more on this here

Best to fully read the documentation first always = exponential growth in your skills

1 Like

Yep that worked. Thanks yosiasz. SSIS flagged the task as a success which is misleading.