Determines the stored procedure status number returned by a stored procedure or a remote stored procedure.
DBINT dbretstatus ( PDBPROCESS dbproc );
where
The return status number for the stored procedure or remote stored procedure.
Normally, completed stored procedures return a status number of 0. A RETURN statement in a stored procedure is used for application-specific return status numbers. If a RETURN statement is not used and an error occurs when the stored procedure is executed, SQL Server can return one of the following values:
Value | Description |
---|---|
-1 | Missing object |
-2 | Datatype error |
-3 | Process was chosen as deadlock victim |
-4 | Permission error |
-5 | Syntax error |
-6 | Miscellaneous user error |
-7 | Resource error, such as out of space |
-8 | Nonfatal internal problem |
-9 | System limit was reached |
-10 | Fatal internal inconsistency |
-11 | Fatal internal inconsistency |
-12 | Table or index is corrupt |
-13 | Database is corrupt |
-14 | Hardware error |
The values -15 through -99 are reserved for future SQL Server expansion.
The dbhasretstat function determines whether the most recently executed stored procedure actually generated a return status number.
The server returns stored procedure information (including any return status and parameter values) immediately after returning all normal results for that stored procedure. Process the normal results, and then call dbretstatus after dbresults returns NO_MORE_RPC_RESULTS (for all stored procedures in a batch except the last one) or NO_MORE_RESULTS (for a single stored procedure, or for the last stored procedure in a batch).
The order in which the application processes the status number and any returned parameter values is unimportant.
dbhasretstat, dbnextrow, dbresults, dbretdata, dbrpcinit, dbrpcparam, dbrpcsend