8

I want to insert in a table an (image , id, Code) but I don't know how to do this .

What I am looking for is how to insert an image not url.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
mitsu
  • 429
  • 2
  • 10
  • 23
  • I posted my question with an answer here, if anyone needs to know how to do this in a Windows Form: http://stackoverflow.com/q/33962272/153923 –  Nov 27 '15 at 17:46

1 Answers1

23

you can try like this

CREATE TABLE ImageTable
(
    Id int,
    Name varchar(50) ,
    Photo varbinary(max) 
)

INSERT INTO ImageTable (Id, Name, Photo) 
SELECT 1, 'test', BulkColumn 
FROM Openrowset( Bulk 'C:\test.jpg', Single_Blob) as image
Pranay Rana
  • 175,020
  • 35
  • 237
  • 263
  • but if i put url of the image for exemple in my DD 'D' in a folder ' myimages' , and when the user take this application in the futur he will have a problem whith the path of the image no? – mitsu Feb 06 '14 at 10:52
  • what if is stored procedure ? how can I do that? – abdou_dev Nov 05 '20 at 10:20