I am trying to move a database from MS Access to SQL Server 2014 and I am using SSMA for Access. A few of the tables have attachments (pdfs, jpgs, emails, etc.).

When I move it to SQL Server, the attachments show up as File Names:
enter image description here

Is there anyway to do this from MS Access side or SQL Server side?

I downloaded all the files to my system and was thinking of matching the names with the files in the folder to upload them to the database through SQL, but then there are multiple files for one row in some instances, so basically I'm not sure how to go about it.

  • Mutiple files for one row? One to Many ralation? – Krismorte Jun 2 '17 at 15:20
  • Yes, but the question is how do I insert the files based on filenames through sql. – SQLserving Jun 2 '17 at 15:25
  • Dont store the files on the database engine, store them on a file system... reference the files on your records. – Nelz Jun 2 '17 at 16:03

If the files was in the same sql server you can you the OPENROWSET like this

Select * from Openrowset(Bulk 'C:\HaxLogs.txt', SINGLE_BLOB) as a

Or in the remote server

Select * from Openrowset(Bulk '\\server\backup\CSVcontagem_SEND_Akarollynegs.csv', SINGLE_BLOB) as a
  • Thanks @Krismorte. Used this idea with some changes for my bigger table. – SQLserving Jun 4 '17 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.