Insert an Image into a SQL Server table

Need to store an image into a SQL Server table? Easy. First make sure you have a varbinary(max) column to store it. Then do something along these lines:

UPDATE YourTable

SET ImageColumn= ( SELECT * FROM OPENROWSET (BULK ‘C:\Temp\arms4.jpg’, SINGLE_BLOB) AS a)

WHERE FilterColumn = ‘Filter Value’

One thought on “Insert an Image into a SQL Server table

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>