0

I currently have a SQL Server 2005 database that sends HTML emails to various users, and I take advantage of the @file_attachments parameter to embed images in the email. I have the image files on the SQL Server itself, so the parameter refer to the absolute path of the images on the server.

We're now moving to SQL Server 2008 R2, which is nice, but the new server structure is locked down so I can't just drop image files on the server and point the @file_attachments parameter at them.

I'm looking at two possible solutions:

  • Store the images in a database column of type VARBINARY(MAX) or IMAGE, and somehow point the @file_attachments parameter at that. I don't see any way to do this, though.

  • Use VARBINARY(MAX) with FILESTREAM and figure out the physical path to the file on the database server. Not sure if this is possible, but I suspect it is.

Has anybody tried this? Any other suggestions?

Thanks, Jim

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Jim
  • 55
  • 2
  • 10
  • Put the e-mail on your file/web server, and just use like you would in a web page? – Aaron Bertrand Feb 11 '14 at 20:03
  • That's missing the point: the images need to be embedded in the email, not external links. See this for something similar: http://stackoverflow.com/questions/663048/how-to-embed-image-in-html-and-send-html-as-email-by-msdb-dbo-sp-send-dbmail. – Jim Feb 11 '14 at 20:36
  • You know those won't always render, right? Making it about as reliable and predictable as external links. – Aaron Bertrand Feb 11 '14 at 20:37
  • I know, but it's still what I'm looking for. Thanks – Jim Feb 11 '14 at 20:51
  • For option #1: `IMAGE` is a deprecated type, don't use it anymore. **Always** use `VARBINARY(MAX)` instead – marc_s Feb 11 '14 at 21:45

0 Answers0