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: Sharif Islam <mislam at uiuc dot edu>
Subject: DBD::Sybase datatype issue
Date: Apr 3 2008 6:01PM

I am using DBD:Sybase on a linux machine querying against MSSQL 2005.
My goal is to get the changed rows in a particular table. I created a 
stored procedure which works fine in SQL using the

I am not sure if DBD::Sybase is interpreting this datatype correctly
or rather if I am using the incorrect datatype.

Here's my code:

use strict ;
use DBI qw/:sql_types/;
use Data::Dumper;

my ($dbh, $sth, @data, $line) ;
my ($url, $id, $link);
my @url;

my $SQL_server   = "myserver" ;
my $SQL_username = "username" ;
my $SQL_password = "password" ;

$dbh = DBI->connect("dbi:Sybase:server=$SQL_server",
                        {PrintError => 1});

die "Unable for connect to server $DBI::errstr" unless $dbh;

$dbh->do("use myTable"); # Set the database to use.

   my $qry="SELECT min_active_rowversion()";
   my $sth = $dbh->prepare($qry);
   $sth->execute ;
   my @row = $sth->fetchrow_array ;
   $sth->finish() ;

   # 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);

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

I would appreciate some help. Thanks.