April 4, 2008 at 3:56 am
Hi guys,
I would lilke know.I have a column called Image in the database. The type of of the column is Image. I want to upade it. I have an jpg file. How can do that????
Lets say I can retrieve an image file from url,
then save it into the sql server ce.....
not insert ...i want to update...
Thank you
April 12, 2008 at 3:06 pm
Try this
UPDATEt
SETt.Img = s.Img
FROMMyTable AS t
INNER JOINOPENROWSET(BULK N'C:\Image1.jpg', SINGLE_BLOB) AS s(Img)
N 56°04'39.16"
E 12°55'05.25"
June 16, 2011 at 10:41 am
Another syntax worked better for me. I had added a Picture column to a table ([font="Courier New"]Model[/font]), and wanted to update existing rows in the table with images from files - in this case [font="Courier New"]Picture.jpg[/font]. The kicker was realising that you needed 2 aliases (PictureTable and blob).
WITH PictureTable AS (SELECT blob.* FROM OPENROWSET(BULK N'C:\Picture.jpg', SINGLE_BLOB) AS blob)
UPDATE Model
SET Model.Picture = PictureTable.BulkColumn
FROM Model, PictureTable
WHERE Model.Id = 2;
June 17, 2011 at 12:10 am
...or even more succinctly:
UPDATE Model
SET [Picture] = (SELECT MyImage.* from Openrowset(Bulk 'C:\cartridge1.jpg', Single_Blob) MyImage)
WHERE Id = 9
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy