|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at mbay dot net>
Subject: sp_spaceused in sybperl
Date: Sep 9 1998 11:34PM
Kimber Robbins writes:
> I am writing a sybperl script to run sp_spaceused and print the output
> to a file. I am using Sybase::DBlib. I keep getting the following error:
>
> DB-Library error:
> Attempt to initiate a new SQL Server operation with results
> pending.
>
> Does anyone know why this is happening? Also dbsucceed fails.
The stored proc returns multiple result sets.
Call it with $dbh->sql(), or make sure that you execute dbresults() in
a loop until it returns NO_MORE_RESULTS, like this:
$dbh->dbcmd("sp_spaceused the_table");
$dbh->dbsqlexec;
while($dbh->dbresults != NO_MORE_RESULTS) {
while(@dat = $dbh->dbnextrow) {
print "@dat\n"; # or whatever you want to do...
}
}
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@mbay.net -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
|