I am having a problem using the UPDATE statement in a Perl program, this
program does not update the field as expected:

#!/usr/bin/perl
use DBI;
require "DBconnect.cgi";
$dbh = DBI->connect($data_source, $username, $password, 'Sybase') || die
&DBerror;
$dbh->do("use Partners") || die &DBerror;
$sql="UPDATE deals SET accountno = 'somethingelse' WHERE hotdealnum=15";
$rows=$dbh->do($sql) || die &DBerror;
print "$rows affected\n";
exit;

result: "-1 rows affected"


However if I use a different query it works. For example, the following
script works fine, so I know that the SQL commands are being passed and
executed by the script:

#!/usr/bin/perl
use DBI;
require "DBconnect.cgi";
$dbh = DBI->connect($data_source, $username, $password, 'Sybase') || die
&DBerror;
$dbh->do("use Partners") || die &DBerror;
$sql="SELECT accountno FROM deals WHERE hotdealnum = 15";
$sth=$dbh->prepare($sql) || die &DBerror;
$sth->execute() || die &DBerror;
$hashref=$sth->fetchrow_hashref();
print "Value is ".$hashref->{'accountno'}."\n";
$sth->finish();
exit;

result: works as expected, can verify looking at actual value using
enterprise manager.


I tried the same query (UPDATE CVB_hotdeals SET accountno = 'somethingelse'
WHERE hotdealnum=15) and it worked fine.

I also tried the query using isql to make sure my Freetds driver seemed to
be working, and the query worked.

I am using unixodbc , freeTDS, DBD:Sybase

Any feedback would be appreciated! Thanks!

-Rusty


Reply via email to