srv_message_handler

Calls the installed Open Data Services message handler. This function is usually used to call SQL Server from an extended stored procedure to log an error (defined by the extended stored procedure) in the SQL Server error log file and/or the Windows NT event log.

Syntax

int srv_message_handler (
SRV_PROC *
srvproc,
int
errornum,
BYTE
severity,
BYTE
state,
int
oserrnum,
char *
errtext,
int
errtextlen,
char *
oserrtext,
int
oserrtextlen );

where

srvproc
Is a pointer to the SRV_PROC structure that is the handle for a particular client connection. The srvproc parameter contains the information that the Open Data Services Library uses to manage communication and data between the application and the client.
errornum
Is an error number defined by the extended stored procedure. This number must be from 50,001 through 2,147,483,647. You can OR this error number with the following values to adjust the event type recorded in the Windows NT event log:
Value Windows NT event type
0x40000000 Informational
0x80000000 Warning
0xC0000000 Error

severity
Is a standard SQL Server severity value for the error. This number must be from 0 through 24.
state
Is a SQL Server state value for the error.
oserrnum
Is the operating-system error number.
errtext
Is the description of the extended stored procedure error errornum.
errtextlen
Is the length of the extended stored procedure error string errtext.
oserrtext
Is the description of the operating-system error oserrnum.
oserrtextlen
Is the length of the operating-system error string oserrtext.

Returns

SUCCEED or FAIL.

Remarks

The srv_message_handler function enables an extended stored procedure to integrate with the centralized error logging and reporting features of SQL Server. SQL Server alerts can be established for events from extended stored procedures, and SQLExecutive will monitor for these alert conditions.

See Also

This entry For information about
srv_errhandle Installing a developer-supplied error handler