Exporting Access attachments

Top  Previous  Next

When you want to extract files from Access attachment-type columns, you need to also select at least the FileData subcolumn in your query.


Say we have the table001 structured like this:




containing the following data:



The first row contains a single attachment, and the second row contains 2 attachments.


If we just select the 3 columns, no blob data is returned.  Instead, the files attachment column displays only the names of the attached files.





All attachment-type columns contain 4 sub-columns (FileName, FileType, FileData, and FileURL).  To retrieve the uploaded files, we need to select the FileData sub-column:




Notice that Access has now returned one row for each attachment that is stored in the table.  We can now extract the attached data in SQL Image Viewer.  To use the filename value stored in the attachment column to name our exported files, ensure that you include the FileName subcolumn in your query, and use that column value in your naming convention e.g.





SQL Image Viewer will then export the attachments and name them using their original file names.