Sending multiple file attachments using sp_send_dbmail


— I found something interesting if you ever want to send multiple reports using sp_send_dbmail

— You have to first set the rowcount to 0 (zero).

— There can’t be a space after the semi-colon that separates the full pathnames for the reports.

———- Check it out——–

SET ROWCOUNT 0

EXEC msdb.dbo.sp_send_dbmail

@profile_name = ‘<profile name>’,

@recipients = ‘recipient.1@xyz.com; recipient.2@xyz.com’,

@body = ‘Reports 1 and 2 are attached’,

@file_attachments = ‘C:\Report Folder\Report1.TXT;C:\Report Folder\Report2.TXT’,

@subject = ‘Reports 1 and 2 are attached’ ;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: