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.

1
  • I posted my question with an answer here, if anyone needs to know how to do this in a Windows Form: stackoverflow.com/q/33962272/153923 Commented Nov 27, 2015 at 17:46

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

2 Comments

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?
what if is stored procedure ? how can I do that?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.