in reply to DBI+MS SQL, capture prints from stored procedures

Hi Jenda. Should "EXEC dbo.dbAdm_Daily" be "dbcc EXEC dbo.dbAdm_Daily"?? I don't know anything about this but seems the syntax for calling EXEC may not be consistent with how you are calling CHECKDB.
Is the problem with CHECKDB or EXEC? This is not clear.
  • Comment on Re: DBI+MS SQL, capture prints from stored procedures

Replies are listed 'Best First'.
Re^2: DBI+MS SQL, capture prints from stored procedures
by Jenda (Abbot) on Apr 24, 2006 at 21:34 UTC

    Nope. DBCC CHECKDB ... is a builtin statement of MS SQL Server used to check the status of a database, while the dbo.dbAdm_Daily is a stored procedure and stored procedures should be executed using the EXEC keyword (you do not have to use the EXEC, but only if the procedure call is the very first statement in a batch.

    I just tried to call the procedure without the EXEC ... did not make any difference.

    In either case both the commands work just fine in Query Analyzer, both execute using $dbh->do(...), but I have to use the prepare+execute to be able to capture the messages and that only works for the DBCC command. God only knows why :-(

      Just a guess.. Does that SP only print and not return data? Maybe DBI doesn't currently behave correctly under those conditions and you need to return a 1x1 result.

      mhoward - at - hattmoward.org