Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How can we Update Image in SqlServer Ce??? Expand / Collapse
Author
Message
Posted Friday, April 4, 2008 3:56 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, April 4, 2008 3:45 AM
Points: 1, Visits: 0
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
Post #479795
Posted Saturday, April 12, 2008 3:06 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 3:35 PM
Points: 2,393, Visits: 3,399
Try this
UPDATE		t
SET t.Img = s.Img
FROM MyTable AS t
INNER JOIN OPENROWSET(BULK N'C:\Image1.jpg', SINGLE_BLOB) AS s(Img)




N 56°04'39.16"
E 12°55'05.25"
Post #484106
Posted Thursday, June 16, 2011 10:41 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, June 17, 2011 12:07 AM
Points: 2, Visits: 1
Another syntax worked better for me. I had added a Picture column to a table (Model), and wanted to update existing rows in the table with images from files - in this case Picture.jpg. 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;
Post #1126766
Posted Friday, June 17, 2011 12:09 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, June 17, 2011 12:07 AM
Points: 2, Visits: 1
...or even more succinctly:

[color=#0000FF]UPDATE[/color] Model
SET [Picture] = ([color=#0000FF]SELECT[/color] MyImage.* from Openrowset(Bulk 'C:\cartridge1.jpg', Single_Blob) MyImage)
[color=#0000FF]WHERE[/color] Id = 9
Post #1127094
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse