On Sat, 2004-04-10 at 11:51, [EMAIL PROTECTED] wrote:
> I'm using DBD::Sybase 1.02 and DBI 1.42.
>
> The stored procedure writer here is telling me that she's sending
> a VARCHAR that's padded with spaces, but the spaces aren't there
> when I retrieve them with fetchrow_arrayref.
When a varchar() string is stored to the database it will be truncated
to remove any trailing spaces.
However, a string literal converted to a varchar() in the select itself
will not get truncated:
my $sth = $dbh->prepare("select convert(varchar(50), '1234 ')");
$sth->execute;
while($d = $sth->fetch) {
print "@$d|\n";
}
prompt> perl /tmp/var.pl
1234 |
So the issue here is how is the data generated in the stored procedure?
If it's possible the proc should convert the data to CHAR datatype if
you need the trailing spaces.
Alternatively, you can probably pad the variables/strings yourself if
you know the max size of the columns.
Michael
--
Michael Peppler Data Migrations, Inc.
[EMAIL PROTECTED] http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.peppler.org/resume.html