[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Re: Getting @@ROWCOUNT




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