0

I'm trying to storage in my database an image, so I have created a column named images in a table of my database with "blob" type.

Then I have found on the internet that if I want to add an image to my database i have to write this little code :

INSERT INTO tableName (ImageColumn) 
    SELECT BulkColumn 
    FROM OPENROWSET(BULK 'image..Path..here', Single_Blob) AS img

But when I execute this code, I get some errors and I'm trying to fix that before asking a question here but after 3 hours of research I'm here to asking you guys for some help.

Here are the error I get:

Unexpected token. (near "(" at position 73)
Unexpected token. (near "Bulk" at position 75)
Unexpected token. (near "'image..Path..here'" at position 80)
Unexpected token. (near "," at position 99)
Unexpected token. (near "Single_Blob" at position 101)
Unexpected token. (near ")" at position 112)
Unrecognized keyword. (near "as" at position 114)
Unexpected token. (near "img" at position 117)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
jestkoks
  • 17
  • 2
  • 9

1 Answers1

0

The syntax is correct for Microsoft T-SQL. The error message looks more like MySql. The message says that the syntax is incorrect, not that there is a problem with the execution.

fbcomps
  • 169
  • 4
  • aah okay i didn't now this, i thinked this syntax is for Mysql and if you now how to do this in Mysql can you help me ? and sorry for my english if it's not good – jestkoks Nov 19 '16 at 09:47
  • My MySQL time is already a few years back, but maybe this helps you: [link](http://stackoverflow.com/questions/14704559/how-to-insert-image-in-mysql-databasetable). – fbcomps Nov 19 '16 at 10:01