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: 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
min_active_rowversion 
(http://msdn2.microsoft.com/en-us/library/bb839514.aspx).

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:

#!/usr/bin/perl
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",
                        $SQL_username,
                        $SQL_password,
                        {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);
   $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


I would appreciate some help. Thanks.

--s