Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

srv_sendmsg (Extended Stored Procedure API)


Applies To: SQL Server 2016 Preview


This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. Use CLR integration instead.

Sends a message to the client.

int srv_sendmsg (SRV_PROC *srvproc,intmsgtype,DBINTmsgnum,DBTINYINTclass, DBTINYINTstate,DBCHAR *rpcname,int rpcnamelen,DBUSMALLINTlinenum,DBCHAR *message,intmsglen );


Is a pointer to the SRV_PROC structure that is the handle for a particular client connection (in this case, the handle that received the language request). The structure contains information that the Extended Stored Procedure API library uses to manage communication and data between the application and the client.


Is either SRV_MSG_INFO or SRV_MSG_ERROR, depending on whether the server is sending an informational or error message.


Is a 4-byte message number.


Specifies the error severity. A severity less than or equal to 10 is considered an informational message.


Provides the error state number for the current message. The error state number provides information about the context of the error. Valid state numbers are from 0 through 255.


Is currently not supported.


Is currently not supported.


Is the line number in the language command batch where the message applies. Line numbers start at 1. If linenum does not apply to the message, set to 0.


Is a pointer to the character string to be sent to the client.


Specifies the length, in bytes, of message. If message is null-terminated, set msglen to SRV_NULLTERM.


This function sends error or informational messages to the client. It is called once for each message to be sent.

Messages can be sent to the client with srv_sendmsg in any order before or after all rows (if any) have been sent with srv_sendrow. All messages, if any, must be sent to the client before the completion status is sent with srv_senddone.

To send messages in Unicode, use srv_wsendmsg rather than srv_sendmsg.

For more information see Unicode Data and Server Code Pages.

System_CAPS_security Security Note

You should thoroughly review the source code of extended stored procedures, and you should test the compiled DLLs before you install them on a production server. For information about security review and testing, see this Microsoft Web site.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft