![](https://csdnimg.cn/release/download_crawler_static/9738990/bg10.jpg)
16 / 103
[MS-SSTDS] - v20160510
Tabular Data Stream Protocol Version 4.2
Copyright © 2016 Microsoft Corporation
Release: May 10, 2016
2.2.2.4 Return Status
When a stored procedure is executed by the server, the server must return a status value. This is a 4-
byte integer and is sent via the RETURNSTATUS token. A stored procedure execution is requested
through either an RPC Batch or SQL Batch message. For additional information, see section 2.2.7.16.
2.2.2.5 Return Parameters
The response format for execution of a stored procedure is identical regardless of whether the request
was sent as SQL Batch or RPC Batch. It is always a tabular result-type message.
The procedure can explicitly send any data, including row data, informational messages, and error
messages. This data is sent in the usual way.
When the RPC is invoked, some or all of its parameters are designated as output parameters. All
output parameters have values returned from the server. For each output parameter, there is a
corresponding return value that is sent via the RETURNVALUE token. The RETURNVALUE token data
stream is also used for sending back the value returned by a user-defined function (UDF), if it is called
as an RPC. For additional details about the RETURNVALUE token, see section 2.2.7.17.
2.2.2.6 Response Completion (DONE)
The client reads results in logical units and can determine when all results have been received by
examining the DONE token data stream.
When executing a batch of SQL statements, the server MUST return a DONE token data stream for
each set of results. All but the last DONE will have the DONE_MORE bit set in the Status field of the
DONE token data stream. Therefore, the client can always determine after reading a DONE whether
there are more results. For additional details about the DONE token, see section 2.2.7.7.
For stored procedures, completion of SQL statements in a stored procedure is indicated by a
DONEINPROC token data stream<2> for each SQL statement and a DONEPROC token data stream for
each completed stored procedure. For additional details about DONEINPROC and DONEPROC tokens,
see sections 2.2.7.8 and 2.2.7.9, respectively.
2.2.2.7 Error and Info Messages
Besides returning a description of row data and the data itself, TDS 4.2 provides a token data stream
type for the server to send error or informational messages to the client. These are the INFO token
data stream, described in section 2.2.7.12 and the ERROR token data stream, described in section
2.2.7.11.
2.2.2.8 Attention Acknowledgment
After a client has sent an interrupt signal to the server, the client MUST read returning data until the
interrupt has been acknowledged. Attentions are acknowledged in the DONE token data stream,
described in section 2.2.7.7.
2.2.3 Packets
A packet is the unit written or read at one point in time. A message may consist of one or more
packets. A packet always includes a packet header and is usually followed by packet data that
contains the message. Each new message starts in a new packet.
In practice, both the client and server will try to read a packet full of data. They will pick out the
header to see how much more (or less) data there is in the communication.