当我在SQL server编辑器中使用“sp_spaceused”时,它返回两个结果集。
即
database_name, database_size, unallocated space
'Test', '25000.00 MB', '4510.67 MB'
和
reserved, data, index_size, unused
'10741072 KB', '10007904 KB', '661728 KB', '71440 KB'
但是在perl脚本中它只返回一个。
EX:
my $query = "sp_spaceused";
my $sth = $dbh->prepare($query) ;
$sth->execute();
while ( my @row = $sth->fetchrow_array() )
{
print " @row \n ";
}
输出:
database_name, database_size, unallocated space
'Test', '25000.00 MB', '4510.67 MB'
有没有办法获取和存储结果集!
答案 0 :(得分:2)
试试这个(取自here)
do {
while ( my @row = $sth->fetchrow_array() )
{
print " @row \n ";
}
} while ($sth->{odbc_more_results});