use warnings; use strict; use DBI; my $dbh = DBI->connect( "dbi:ODBC:driver={SQL Server};server=localhost;database=master", "", "", {ChopBlanks => 1, RaiseError => 1, PrintError => 0}); { my $sth = $dbh->prepare(qq( select * from sysdatabases where 9=0 )); $sth->execute(); my $counter = 0; while( $sth->fetch()) { $counter++; } print "$counter\n"; } { my $sth = $dbh->prepare(qq( select min(dbid) from sysdatabases where 9=0 )); $sth->execute(); my $counter = 0; while( $sth->fetch()) { $counter++; } print "$counter\n"; } __END__ 0 1