[dba-SQLServer] Insert a picture into a SQL column

Lavsa, Rich Rich_Lavsa at pghcorning.com
Tue May 17 15:04:06 CDT 2005


Curiousity got me on this one so I did a little research.  

I found this page
http://www.codecomments.com/archive352-2005-1-378799.html

Of which contained this link http://support.microsoft.com/?kbid=258038
which is where I believe you are trying to go with the ADO Stream
Object... 

As I don't currently have a use for this, I can see where it might fit
in the near future so please let us know how you get it to work in the
end..

Rich 

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur
Fuller
Sent: Tuesday, May 17, 2005 1:50 PM
To: dba-sqlserver at databaseadvisors.com
Subject: Re: [dba-SQLServer] Insert a picture into a SQL column


That was interesting but not exactly where I want to go. If at all 
possible, I want to do it all in the SQL database, using a sproc that 
might resemble this:

CREATE PROCEDURE ImageImport_ap
(
    @pk int,
    @imageFileName varchar(100)
)
AS
    /* maybe I need a stream object or something here, I don't know
       but I want ideally to handle everything in the sproc, with no FE 
code but passing the parms
    */
    UPDATE myTable
    SET Picture = [data read from image file]
    WHERE PK = @pk

Anyone know how to achieve this?
Arthur

Francisco Tapia wrote:

>Look in BOL under blob,
>here is a MS example on how to do what you want
>
>http://support.microsoft.com/kb/q173308/
>
>I'm looking at a similar situation only because I'm going to need to 
>display
>the same picture out on the web as in an internal app. Not sure if I'll
use 
>this approach due to the typical cautions.
>
>On 5/16/05, Arthur Fuller <artful at rogers.com> wrote:
>  
>
>>Let's leave aside the wisdom of doing this and focus on the fact of 
>>doing it. I have a sproc that doesn't work. I pass a filename and the 
>>PK of the row into which I want to insert said image file. It doesn't 
>>work as written. I think that maybe I need to create a stream object 
>>and read chunks and then update the row using said accumulated chunk, 
>>but I cannot yet figure out how to do this in pure T-SQL.
>>
>>Suggestions?
>>
>>TIA,
>>Arthur
>>
>>    
>>
>>>      
>>>
>>--
>>No virus found in this outgoing message.
>>Checked by AVG Anti-Virus.
>>Version: 7.0.308 / Virus Database: 266.11.10 - Release Date: 5/13/2005
>>
>>_______________________________________________
>>dba-SQLServer mailing list
>>dba-SQLServer at databaseadvisors.com
>>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>>http://www.databaseadvisors.com
>>
>>
>>    
>>
>
>
>  
>


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.10 - Release Date: 5/13/2005

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list