Reading images from the filesystem

  • Greetings

    I currently have scanned images stored on the file system that user's access via a mapped drive (they are on the same server as the SQL Server instance). We've recently added another office and the remote office can't use mapped drives to access the data. I wanted a way to run a query via SQL Server 2008 to retreive the binary data and return it to the user. I have not had any experience with the CLR and having a look I thought that would be be the best option. I've also seen some limited examples using the sp_OA methods.

    I started developeing a user function with filestream to open the binary data and then an exec<function name> to return the data.

    Would appreciate any advice on the best way to tackle the issue. The images are around 500KB-1MB in size.

    Regards

    Peter

  • Try the OPENROWSET

    SELECT * FROM OPENROWSET(BULK N'C:\image.gif', SINGLE_BLOB) AS MyImage;

  • Hi There

    Strangely I just found this solution about 10 minutes before you posted and tried it out. Works like a charm. Thank you for your reply.

    Cheers

    Peter

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply