sql-serversql-server-2008sp-send-dbmail

Trying to figure out how to send multiple file attachments with sp_send_dbmail


Here's the scenario:

We have files stored in a varbinary(max) column.
I'd like to select these as individual files, along with the names of the files stored nearby, as individual file attachments.

Can this be done?

It's easy enough to send the results of a query as an attachment, but it just sends 1 file.


Solution

  • Based on the docs, this can't be done. You can only attach multiple files when they attached from the file system (using @file_attachments=).

    Query results are always attached as a single file.