Skip to Content.
Sympa Menu

freetds - RE: [freetds] UTF-8 conversion

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] UTF-8 conversion
  • Date: Fri, 22 Apr 2005 14:33:55 -0400

> From: Eddie Gieze
> Sent: Friday, April 22, 2005 1:45 PM
>
> On Apr 22, 2005, at 7:16 PM, Lowden, James K wrote:
> >
> > To confirm, this might be an interesting test:
> >
> > $ printf '%s\ngo\n' \
> > 'SELECT name,
> > content,
> > cast(content as varbinary(40)) as HexContent
> > FROM tblite m WHERE id = 1317' \
> > | tsql -S$S -U$U -P$P | hexdump -C
>
> Hello James,
>
> 1> select content, cast(content as varbinary(40)) as HexContent from
> tblitem where id = 1317
> 2> go
> Msg 529, Level 16, State 2, Server EDDIEXP\MSDE2000, Line 1
> Explicit conversion from data type ntext to varbinary is not allowed.

Oh, well, oops. Just convert it twice.

$ printf '%s\ngo\n' \
'SELECT name,
content,
cast(cast(content as nvarchar(40)) as varbinary(40)) as
HexContent
FROM tblite m WHERE id = 1317' \
| tsql -S$S -U$U -P$P | hexdump -C

The idea is to let the server show you its own hexdump, if you will.
Example:

$ tsql -S$S -U$U -P$P
locale is "C"
locale charset is "646"
1> select N'hello', cast(N'hello' as varbinary(40))
2> go

hello 680065006c006c006f00

--jkl





-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.




Archive powered by MHonArc 2.6.24.

Top of Page