Michael
Michael

Reputation: 13636

How to insert binary file into a binary SQL column?

I have a SQL Server 2008 database with a table containing an image column.

Any idea how to write query to insert bin file to the image field?

Thank you in advance!

Upvotes: 0

Views: 4222

Answers (1)

Hamlet Hakobyan
Hamlet Hakobyan

Reputation: 33391

Totally agree with marc_s.

But your query will be something like this.

INSERT yourtable(ImageColumn)
SELECT image FROM
OPENROWSET(BULK, 'filename.png', SINGLE_BLOB) AS blobtable(image)

Upvotes: 1

Related Questions