[freetds] problem with UPDATE query

Michael Peppler mpeppler at peppler.org
Thu Feb 27 19:36:12 EST 2003

On Thu, 2003-02-27 at 15:35, Russell Kroboth wrote:
> I am having a problem using the UPDATE statement in a Perl script with my
> new Freetds setup, I was wondering if you could tell me if you can see what
> I'm missing or if it's even FreeTDS related at all. I am using unixodbc ,
> freeTDS and DBD:Sybase. This script does not update the field as expected:
> #!/usr/bin/perl
> use DBI;
> require "DBconnect.cgi";
> $dbh = DBI->connect($data_source, $username, $password, 'Sybase')

That connect() call is deprecated. Use

$dbh = DBI->connect("dbi:Sybase:server=<servername>", $username,


> &DBerror;
> $dbh->do("use Partners") || die &DBerror;
> $sql="UPDATE deals SET accountno = 'somethingelse' WHERE hotdealnum=15";
> $rows=$dbh->do($sql) || die &DBerror;

Turn on tracing and see what really happens:


> print "$rows affected\n";
> exit;
> result: "-1 rows affected"

Note that -1 here means that the number of rows affected is not known,
not that an error occurred. Are you positive that no rows are affected?

Michael Peppler                              Data Migrations, Inc.
mpeppler at peppler.org                 http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.mbay.net/~mpeppler/resume.html

More information about the FreeTDS mailing list