SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How can we Update Image in SqlServer Ce???


How can we Update Image in SqlServer Ce???

Author
Message
sivak42
sivak42
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 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
SwePeso
SwePeso
Hall of Fame
Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)

Group: General Forum Members
Points: 3985 Visits: 3433
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"
max 23838
max 23838
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 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;
max 23838
max 23838
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search