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: "Sabherwal, Balvinder (MBS)" <Balvinder dot Sabherwal at mortgagefamily dot com>
Subject: RE: Retaining Data Format
Date: Apr 16 2002 1:54PM


Sabherwal, Balvinder (MBS) wrote:
>> I am trying to select few rows from the database using ct_sql function.
If
>>I
>> exec. same sql from an ISQL prompt I see the zeros after the decimal
point
>> where as if I try to print the results from the perl script, it doesn't
>>show
>> the zeros after the decimal. (i.e. 34.00 and 35.30 in isql are printed as
>>34
>> and 35.3 respectively in perl)

>> Is this the normal behavior?? is there anyway I can get the values in the
>> same format as in the ISQL Session??

>Try printf or sprintf.
>For example:
>printf "%10.2f", $x;
>or
>$formatted_x = sprintf "%10.2f", $x;

The only problem is I don't know if the value is a numeric or string as
ct_sql,undef,CS_TRUE will lose the sequence in which the columns are fetched
from the server. Any other wayouts??