Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: DBD::Sybase datatype issue
Date: Apr 6 2008 8:34PM

Sharif Islam wrote:
> Michael Peppler wrote:
>> Sharif Islam wrote:
>>>   # run the stored proc
>>>   my $sp_qry = "EXEC Find_Changed_rows ?" ;
>>>   my $sth1 = $dbh->prepare($sp_qry) ;
>>>   $sth1->bind_param(1, $row[0],SQL_TIMESTAMP);
>>>   $sth1->execute($sp_qry);
>>> When I run this:
>>> DBD::Sybase::st execute failed: Server message number=257 severity=16 
>>> state=3 line=0 server=MYSERVER procedure=Find_Changed_rows 
>>> text=Implicit conversion from data type char to timestamp is not 
>>> allowed. Use the CONVERT function to run this query. at 
>>> line 35
>> SQL_TIMESTAMP is not the same as a T-SQL "timestamp" datatype.
>> Try using SQL_BINARY as the type to see if this works any better.
> Thanks. I tried this, now I don't get the error but it is returning 
> empty result set. I turned on all the error checking I am aware of but 
> it seems, the stored procedure still not interpreting the datatype 
> correctly.

I guess that the binary string is kept in hex form, rather than in real 

Try using pack() to create a true binary value, something like

$sth1->bind_param(1, pack('H*', $row[0]), SQL_BINARY);

and see if that helps.

Michael Peppler           -                 Peppler Consulting SaRL      -        
Sybase DBA/Developer      -   TeamSybase:
Sybase on Linux FAQ       -