Inserting image in Table using SQL Server 2005
I have a table named Nomogram.
I wich to insert an image named td4.png into the column "img1" in the table Nomogram. Why does it not work?
img1 is defined as varbinary(MAX).
When I fire this event in the SQL Manager I get an error:
Code:
UPDATE Nomogram
SET img1 =
(SELECT *
FROM OPENROWSET(BULK 'C:\td4.png', SINGLE_BLOB) AS ResumeContent)
WHERE (bId = 133)
Does any have a clue?
Re: Inserting image in Table using SQL Server 2005
The syntax of Update statement is valid and works fine for me.
What error are you getting? Possible causes
Using 'C:\td4.png'. That file must exist on the computer running SQL Server, not the computer where the statement is executed.
Permissions.
Re: Inserting image in Table using SQL Server 2005
That could be it!
It says: You do have have permission to use the bulk load statement.
My files are located at the SQL Server where I fire the event in a folder named Images (path is Images\td4.png)
How do I write the command then?
Like this?
Code:
UPDATE Nomogram
SET img1 =
(SELECT *
FROM OPENROWSET(BULK N'td4.png', SINGLE_BLOB) AS ORS)
WHERE (bId = 133)