Skip to Content.
Sympa Menu

freetds - Re: [freetds] Image data type in perl/mssql

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <bill_d_thompson AT ml.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Image data type in perl/mssql
  • Date: Tue, 28 Jun 2005 15:19:55 +0100

This seems to work....

create table #bill (col1 int, col2 image)

insert #bill values (2, 0x10101010101010101010 )
insert #bill values (2, 0x20202020202020202020 )

select * from #bill

update a
set a.col2 = b.col2
from #bill a, #bill b
where a.col1 = 1
and b.col1 = 2

select * from #bill

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Maciej Grzywocz
Sent: 28 June 2005 15:01
To: freetds AT lists.ibiblio.org
Subject: [freetds] Image data type in perl/mssql


Hi,

I'm trying to manage some 'image' type fields using Perl and MSSQL2000
server. What I get if I use DBD::Sybase driver is a hex representation
of the data. I use
pack 'H*', $data
to convert it to binary.
However, I am unable to store every binary data, because it must be
stored as a string, so when it contains a zero character (0x00), the SQL
query gets broken.

What I actually need is to copy the binary data from one to another row,
so they don't need to be fully retrieved by my application.
But executing
UPDATE files SET preview = (SELECT preview FROM files WHERE id = 2)
WHERE id = 1;
causes an error:
"The text, ntext, and image data types are invalid in this subquery or
aggregate expression"

Can you help me with this or give another solution?

TIA,

--
Maciej Grzywocz <emgie AT netinfo.pl>
Netinfo: Dział Rozwoju Produktów
tel: 32.3460490 fax: 32.3460492
http://www.netinfo.pl/
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy, retain or
redistribute it. Click here for important additional terms relating to this
e-mail. http://www.ml.com/email_terms/
--------------------------------------------------------




Archive powered by MHonArc 2.6.24.

Top of Page