Answer the question
In order to leave comments, you need to log in
add image to sql table
There is a database with the name ProductPicture
, you need to fill in the Picture field with a request, which contains a binary array of the picture. I'm trying with this query
UPDATE ProductPicture SET ProductPicture.Picture = CONVERT(varbinary(MAX), 'C:\1.jpg')
Answer the question
In order to leave comments, you need to log in
OPENROWSET .
Question author's solution:
UPDATE PictureProduct
SET Picture =
(SELECT * FROM OPENROWSET(BULK N'C:\1.jpg', SINGLE_BLOB) AS image)
WHERE Id = 6
INSERT INTO PictureProduct (Id, IdProduct, Picture)
SELECT 8, 4, BulkColumn
FROM Openrowset( Bulk 'C:\2.jpeg', Single_Blob) as image
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question