|
|
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
>>> track_changes.pl 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
binary.
Try using pack() to create a true binary value, something like
$sth1->bind_param(1, pack('H*', $row[0]), SQL_BINARY);
$sth1->execute;
and see if that helps.
Michael
--
Michael Peppler - Peppler Consulting SaRL
mpeppler@peppler.org - http://www.peppler.org
Sybase DBA/Developer - TeamSybase: http://www.teamsybase.com
Sybase on Linux FAQ - http://www.peppler.org/FAQ/linux.html
|