Now I've started working on a DBCC script for MS-SQL Server and I'm
having issues similar to my backup problems.  If I use "do" without
placeholders, I don't get any of the server status messages (via a
defined odbc_err_handler) indicating
how the DBCC progressed.  But when I tried using a "prepare" and
"execute" like this:

    $db = "foo";
    $dbcc_sql = "dbcc checkdb($db)";
    my $sth = $dbh->prepare($dbcc_sql);
    if ($sth->execute($dbcc_sql)){
            print "DBCC returned success!\n";
    }

I get this error:

        DBD::ODBC::st execute failed: called with 1 bind variables 
        when 0 are needed at ./sql_dbcc line 558.

If I use "do" with a placeholder:

    $db = "foo";
    $dbcc_sql = "dbcc checkdb(?)";
    if ($dbh->do($dbcc_sql, undef, $db)){
            print "DBCC returned success!\n";
    }

Everything works right.

-- 
David Good                                                    [EMAIL PROTECTED]

                 This space intentionally left blank.

Reply via email to