How can we Update Image in SqlServer Ce???

  • 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

  • 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"

  • 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;

  • ...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