PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Sybase Question
Date: Jan 24 2002 9:30PM

Jain, Mohit S writes:
 > The problem is the resultset that is generated by the stored proc has a
 > field with a binary(16) datatype.  Since this application does not have
 > support for binary datatypes it generates an error.
 > 
 > I need to run this stored proc and convert that value into a format that my
 > application will understand and store it. I would also need to reconvert it
 > back to binary format when I return some value back to the Sybase database.
 > 
 > I have tried "select convert(char(255), binary_field) from table_name"

Take a look at the intohex() function - however as it name implies
this works on 4 byte integers, so you have to use 4 byte substrings of
the binary field and then concatenate them back together (I think -
there was a post on this same subject in one of the newsgroups at
news://forums.sybase.com/ - I suspect a search on groups.google.com
for "inttohex" will turn it up).

Michael
-- 
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
mpeppler@peppler.org - mpeppler@mbay.net
International Sybase User Group - http://www.isug.com