I just tried to prepare/execute/fetch results for the following a dbcc call in MS SQL Server. I get an error stating that there is no select statement running--which is true.
Is there a mechanism for getting the results of DBCC calls through DBI? The do method doesn't seem to return anything more than pass/fail, and what I need is all of the output from the DBCC calls. Any help is appreciated, and happy 4th! glen accardo BMC Software, Inc. ------------------------------------------------------------------------- use strict; use DBI; my ($instance, $user, $password, $db) = ('gaccardo', 'sa', 'xxxxxxx', 'master'); my $dbh = DBI->connect("dbi:ODBC:DRIVER={SQL Server};". "SERVER=$instance;". "DATABASE=$db", {RaiseError => 0, PrintError => 0}) or die "\n\nCannot connect.\n\n$DBI::errstr\n"; DBI->trace(9, 'C:\temp\dbi_trace.txt'); my $sth = $dbh->prepare("DBCC CHECKALLOC"); $sth->execute(); do { my @query_results; while (@query_results = $sth->fetchrow_array) { print join (', ', @query_results) . "\n" } } while ( $sth->{odbc_more_results} ); ------------------------------------------------------------------------- DBD::ODBC::st fetchrow_array failed: (DBD: no select statement currently executing err=-1) at D:\Qa\mbt\automation\perl\test.pl line 20.