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
  • 704,970
  • 168
  • 1,303
  • 1,425
mitsu
  • 383
  • 1
  • 7
  • 21
  • 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 – jp2code 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
  • 170,430
  • 35
  • 234
  • 261
  • 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