How to detect runtime error in stored procedure invoked via SQLExecute or SQLExecDirect?
- From: "Alek" <alekDOTdavisATintelDOTcom>
- Date: Thu, 8 Jun 2006 14:16:18 -0700
What is the most reliable way of determining whether a stored procedure
invoked via SQLExecute or SQLExecDirect encountered an error? I was assuming
that if the stored procedure fails (e.g. executes RAISERROR with severity 16
or higher, attempts to invoke bad dynamic SQL via EXEC, like EXEC("INSERT
INTO NADA BLAH-BLAH", etc), the SQLExecute and SQLExecDirect should return
SQL_ERROR or some other failure code. I think this is what SQL Server BOL
and MSDN documentation say, but apparently it returns SQL_SUCCESS_WITH_INFO.
Now, how can a program distinguish between a real error and other conditions
resulting in SQL_SUCCESS_WITH_INFO, such as encountering a PRINT statement
in the stored procedure? I guess for SQL Server, I can check the severity
attribute of the error (SQL_DIAG_SS_SEVERITY), but this attribute is SQL
Server-specific, and I need to make it generic, so that it works with other
drivers, like Oracle, Teradata, etc. Any ideas? Thanks.
.
- Prev by Date: Re: "Invalid number of parameter markers" when executing SQL command
- Next by Date: ODBC-driver
- Previous by thread: Re: ODBC 3.0 issue - HY003 Program type out of range
- Next by thread: ODBC-driver
- Index(es):
Relevant Pages
|