![](https://csdnimg.cn/release/download_crawler_static/4360380/bg14.jpg)
20 / 159
[MS-TDS] — v20120328
Tabular Data Stream Protocol Specification
Copyright © 2012 Microsoft Corporation.
Release: Wednesday, March 28, 2012
A done packet MUST be present as the final part of the login response, and a DONE token data
stream is the last thing sent in response to a server login request. For more information about the
DONE token data stream, see section 2.2.7.5.
2.2.2.3 Row Data
If the server request results in data being returned, the data will precede any other data streams
returned from the server except warnings. Row data MUST be preceded by a description of the
column names and data types. For more information about how the column names and data types
are described, see section 2.2.7.4.
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 a SQL Batch message. For more information, see section 2.2.7.15.
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.
If the procedure explicitly sends any data, then the message starts with a single token stream of
rows, 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 will have values returned from the server. For each output parameter, there is a
corresponding return value, 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. See section 2.2.7.16 for additional details on the RETURNVALUE token.
2.2.2.6 Response Completion ("DONE")
The client reads results in logical units and can tell 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 tell after reading a DONE whether or not
there are more results. See section 2.2.7.5 for additional details on the DONE token.
For stored procedures, completion of SQL statements in the stored procedure is indicated by a
DONEINPROC token data stream for each SQL statement and a DONEPROC token data stream for
each completed stored procedure. See section 2.2.7.6 and 2.2.7.7 respectively for additional details
on DONEINPROC and DONEPROC tokens.
2.2.2.7 ERROR and INFO Messages
Besides returning description of Row data and the data itself, TDS 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 and the ERROR token data stream.