Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to "simply" upload a signature jpeg?

Author  Topic 

scholin
Yak Posting Veteran

56 Posts

Posted - 2010-02-01 : 18:02:40
I am relatively new to sql and in the past I could simply copy and paste a small jpeg picture into a field (old database -not sql).

I am using SQL 2008 with management studio. I need to upload just few signatures that are jpeg into an image field - varbinary(MAX).

Some how I did it once a couple of months ago but can't recall how I did it!

So how would I copy a small jpeg signature into "dbo.reader" column "signature"?

I have searched the net and found a few sophisticate solutions (that I don't understand) but I just need to do a couple of signatures for right now.

Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-02 : 04:05:23
http://weblogs.sqlteam.com/peterl/archive/2007/09/26/Insert-binary-data-like-images-into-SQL-Server-without-front-end.aspx
Go to Top of Page

scholin
Yak Posting Veteran

56 Posts

Posted - 2010-02-02 : 08:11:59
Visakh,

This works . . . kind of. I can create a new row (insert) with just that field if I use the following:(had to add the rs for some reason??)

insert reader(Signature)
SELECT * FROM
OPENROWSET(BULK N'C:\Signatures\WC VanNess MD.jpg', SINGLE_BLOB) rs

But when I try to change it to an UPDATE:

update reader(Signature)
SELECT * FROM
OPENROWSET(BULK N'C:\Signatures\WC VanNess MD.jpg', SINGLE_BLOB) rs
Where reader_ID=110

I get a syntax error "near '(' "

I have played around with differnt configurations but no luck updating a specific field.

What am I missing . . . I am sure it is something dumb on my part.

Thanks!

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-02-02 : 08:31:39
update-syntax!
update table
set column=...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

scholin
Yak Posting Veteran

56 Posts

Posted - 2010-02-02 : 08:56:37
LOL - it must be frustrating dealing with newbies every day! This was stupid on my part.

Although the OPENROWSET really did throw me and I was unable to find a whole lot of meaningful help online - but I did get it figured out. Here is the solution that is working for me now:


update  reader
set Signature= (
SELECT *
FROM OPENROWSET(BULK N'C:\Signatures\WC VanNess MD.jpg', SINGLE_BLOB) AS x )
Where reader_ID=110


Thanks again Webfred and visakh - your help is greatly appreciated by many!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-02 : 09:24:16
welcome
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-02-02 : 09:24:35
Not frustrating

You're always welcome!


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -