[Omaha.pm] Re: Getting @@ROWCOUNT

Jay Hannah jay at jays.net
Wed Nov 17 20:42:43 CST 2004


On Nov 17, 2004, at 5:03 PM, Michael D. Maynard wrote:
>  Do you know how to get @@ROWCOUNT from MSSQL for a query with PERL? 
> DBI rows() is not supported. :-(

Hmmm... here's an example of @@identity. I assume @@rowcount would work 
the same way?

       my $strsql = "insert into blah....";
       $strsql .= ' select @@identity';
       # print "\n\n$strsql\n\n";
       my $sth = $dbh->prepare($strsql);
       $sth->execute;
       my @row = $sth->fetchrow_array;
       $sth->finish;
       print "Just inserted new ID '$row[0]'\n";

HTH,

j



More information about the Omaha-pm mailing list