I have a SQL Server 2008 R2 database in which emails are stored in a table and any attachments (pdf, xls, etc) to those emails are stored in an image datatype field in a separate table.
My task is to reassemble the emails with their attachments and then save the emails as .msg files in a folder. The .msg files will be imported into a different application and the old application will be decommissioned.
I am looking for a way to do this using a stored procedure or sql script. Does anyone have an example of something along these lines?