<html>
<head>
<title>jTDS JDBC Driver</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Keywords" content="jTDS, open source, free JDBC driver, free driver, free, JDBC, JDBC 2.0, JDBC 3.0, driver, type 4, pure Java, SQL Server, Sybase, SQL Server 6.5, SQL Server 7.0, SQL Server 2000, SQL Server 2005, SourceForge">
<link rel="stylesheet" href="style.css" type="text/css">
<style>
 p { padding: 0px; margin: 5px 0px; }
 p.title { font-size: 11px; font-weight: bold; padding: 0px; margin: 15px 0px 2px; text-decoration: none; }
 p.subtitle { font-weight: bold; padding: 0px; margin: 10px 0px 2px; }
 td { vertical-align: top; color: #CCC }
 td.offset, td.length { text-align: right; width: 12px; }
 td.value { padding-left: 5px; width: 80px; }
 td.length { color: #AAA; }
 td.repeat { border-left: 1px solid #DDD; }
 hr { color: #DDD; width: 300px; height: 1px; margin-left: 0px; display: inline; text-align: left; border-top: none; }
 div.conditional { padding: 0px 0px 0px 20px; }
</style>
</head>

<body>
<table class="mainTable" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="3" class="logoWrapper">
      <table cellpadding="0" cellspacing="0" class="logo">
        <tr>
          <td class="logo"><img src="images/logo.gif" alt="The jTDS Project" class="logo"></td>
          <td class="logo"><img src="images/logoBg.gif" class="logoBg"></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr>
    <td width="9" height="9"><img src="images/maintl.gif" width="9" height="9"></td>
    <td height="9" background="images/maint.gif"><img src="images/spacer.gif"></td>
    <td width="9" height="9"><img src="images/maintr.gif" width="9" height="9"></td>
  </tr>
  <tr>
    <td width="9" background="images/mainl.gif"><img src="images/spacer.gif"></td>
    <td class="content">
      <p class="links">
        <a href="index.html">Home</a>
        | <a href="faq.html">FAQ</a>
        | <a href="doc.html">Documentation</a>
        | <a href="links.html">Links</a>
        | <a href="license.html">License</a>
        | <a href="http://sourceforge.net/projects/jtds">Project Info</a>
        | <a href="http://sourceforge.net/projects/jtds/files">Download</a>
        | <a href="http://sourceforge.net/p/jtds/news">News</a>
        | <a href="http://sourceforge.net/p/jtds/bugs">Bugs</a>
        | <a href="http://sourceforge.net/p/jtds/discussion">Forums</a>
      </p>


<!--
==================================
  Content starts here
==================================
-->


<p class="title">TDS 7.0 protocol documentation</p>
<p>This is a try to document the TDS protocol version 7.0. It has a lot of holes, but it
contains a lot of new information over <a href="http://www.freetds.org/tds.html">the
documentation furnished by the FreeTDS project</a>.</p>
<p>All this is obtained through reverse engineering and it would be pretty interesting to
match it against the TDS 5.0 documentation, for example. I'm convinced a lot of new
information could be discovered. If anyone is interested in doing this, please contact the
project. We'll be more than happy to provide you with any documentation we have gathered
so far and that cannot be posted here from various reasons.</p>
<br><hr><br>

<p class="title">0x79 (121) TDS_RETURNSTATUS</p>
<p>Return status of a stored procedure. Precedes TDS_DONEPROC packets (or TDS_PARAM packets, if
the stored procedure has output parameters).</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">79</td>
  <td class="description">Packet type (TDS_RETURNSTATUS)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">4</td>
  <td class="value">XX XX XX XX</td>
  <td class="description">Return status</td>
 </tr>
</table>

<p class="title">0x81 (129) TDS_COLMETADATA</p>
<p>Column meta data information for results (column names, types etc.).</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">81</td>
  <td class="description">Packet type (TDS_COLMETADATA)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Number of columns</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Column usertype id (0 for base types)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Column flags (0x01=is nullable, 0x02=case sensitive, 0x04|0x08=is
   writable, 0x10=auto increment, 0x20=computed)
  </td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column data type</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX...</td>
  <td class="description">Column size (variable size data only): 4 bytes for TEXT, NTEXT and IMAGE
   data, 2 bytes for large data (type &amp; 0x80 != 0), 1 byte for other data
  </td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Column table length (TEXT, NTEXT and IMAGE data only)
  </td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX...</td>
  <td class="description">Column table name -- fully qualified if database or user different than
   current (TEXT, NTEXT and IMAGE data only)
  </td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column precision (NUMERIC and DECIMAL types only)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column scale (NUMERIC and DECIMAL types only)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column name length</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX...</td>
  <td class="description">Column name</td>
 </tr>
</table>
<p>Marked fields are repeated for each column.</p>

<p class="title">0x88 (136) TDS_ALTCOLMETADATA (?)</p>
<p>Column meta data information for compute clause.</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">88</td>
  <td class="description">Packet type (TDS_ALTCOLMETADATA (?))</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Number of columns</td>
 </tr>
 <tr>
  <td class="offset">03</td>
  <td class="length">2</td>
  <td class="value">01 00</td>
  <td class="description">Unknown</td>
 </tr>
 <tr>
  <td class="offset">05</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Number of columns specified in BY clause (e.g. for COMPUTE ... BY a, b
   this is 2)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Index of column specified in BY clause (number of columns specified by
   above value)</td>
 </tr>
 <tr>
  <td colspan="4"><hr></td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Type of aggregation (0x30=STDEV, 0x31=STDEVP, 0x32=VAR, 0x33=VARP,
   0x4B=COUNT, 0x4D=SUM, 0x4F=AVG, 0x51=MIN, 0x52=MAX)
  </td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Column index (in TDS_COLMETADATA packet)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Column usertype id (0 for base types)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Column flags (?)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column data type</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column size (variable size data types only)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column precision (NUMERIC and DECIMAL types only)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column scale (NUMERIC and DECIMAL types only)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column name length (this is probably always 0, so the next field's
   existence is questionable)
  </td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX...</td>
  <td class="description">Column name</td>
 </tr>
</table>
<p>Marked fields are repeated for each column.</p>

<p class="title">0xA4 (164) TDS_TABNAME</p>
<p>Table name information for result columns. Follows immediately after a TDS_COLMETADATA packet.
Returned by SELECT .. FOR BROWSE queries.</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">A4</td>
  <td class="description">Packet type (TDS_TABNAME)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Packet size</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Table name length</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Table name (can be fully qualified with no quoting, e.g. 'myDb..my Table')</td>
 </tr>
</table>
<p>Marked fields are repeated for each table from whose columns appear in the result (watch packet
size for end).</p>

<p class="title">0xA5 (165) TDS_COLINFO</p>
<p>Supplementary meta data information for result columns. Follows immediately after a TDS_TABNAME
packet. Returned by SELECT .. FOR BROWSE queries.</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">A5</td>
  <td class="description">Packet type (TDS_COLINFO)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Packet size</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column index (in TDS_COLMETADATA packet, 1-based)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column table index (in TDS_TABNAME packet, 1-based)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column flags (0x04=expression, 0x08=key, 0x10=hidden, 0x20=name present)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Column name length (only present if flags &amp; 0x20 != 0)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Column name (only present if flags &amp; 0x20 != 0, the TDS_COLMETADATA contains the label/alias)</td>
 </tr>
</table>
<p>Marked fields are repeated for each column coming from some table (watch packet size for end).</p>

<p class="title">0xA9 (169) TDS_ORDER</p>
<p>Column ordering information. Follows after a TDS_COLMETADATA packet (or its associated
TDS_COLINFO packet).</p>
<p>The list of columns indexes after which the result is ordered (1-based).</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">A9</td>
  <td class="description">Packet type (TDS_ORDER)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Packet size</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Column index</td>
 </tr>
</table>
<p>Marked fields are repeated for each column the result is ordered by.</p>

<p class="title">0xAA (170) TDS_ERROR<br>0xAB (171) TDS_INFO</p>
<p>Error (TDS_ERROR) or message/warning (TDS_INFO).</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">AA/AB</td>
  <td class="description">Packet type (TDS_ERROR/TDS_INFO)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Packet size</td>
 </tr>
 <tr>
  <td class="offset">03</td>
  <td class="length">4</td>
  <td class="value">XX XX XX XX</td>
  <td class="description">Error message number</td>
 </tr>
 <tr>
  <td class="offset">07</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">State (error dependent)</td>
 </tr>
 <tr>
  <td class="offset">08</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Severity (0,1=information, 2-18=warnings-regular errors, 19-25=fatal errors, connection is usually closed</td>
 </tr>
 <tr>
  <td class="offset">09</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Message length</td>
 </tr>
 <tr>
  <td class="offset">0B</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Message</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Server name length</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Server name</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Procedure name length</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Procedure name</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Line number</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Unknown (usually 0x00)</td>
 </tr>
</table>

<p class="title">0xAC (172) TDS_PARAM</p>
<p>Stored procedure output parameter (one such package is returned for each output parameter).
Precedes TDS_ENDPROC. WRITETEXT seems to also generate a TDS_PARAM with a formal type of 0x00.</p>
<p>Parameter type seems to be exactly the type submitted (e.g. if the formal parameter is of type
NVARCHAR and the actual parameter sent is of type VARCHAR the output parameter will have type
VARCHAR).</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">AC</td>
  <td class="description">Packet type (TDS_PARAM)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Packet size</td>
 </tr>
 <tr>
  <td class="offset">03</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Parameter name length</td>
 </tr>
 <tr>
  <td class="offset">04</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Parameter name</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">01</td>
  <td class="description">Unknown (seems to always be 0x01)</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Formal type (the type that is declared in the stored procedure header);
   for TDS_PARAM packets returned by WRITETEXT seems to be 0x00
  </td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">3</td>
  <td class="value">00 00 00</td>
  <td class="description">Unknown (seem to always be set to 0x00)</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Actual column type</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">X</td>
  <td class="value">XX ...</td>
  <td class="description">Maximum size (only variable size types): 2 bytes for large types (type
   &amp; 0x80 != 0), 1 byte for all other types (TEXT, NTEXT and IMAGE cannot be parameters)
  </td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Precision (only DECIMAL and NUMERIC data)</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Scale (only DECIMAL and NUMERIC data)</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">X</td>
  <td class="value">XX ...</td>
  <td class="description">Actual size (only variable size types): 2 bytes for large types (type &amp;
   0x80 != 0), 1 byte for all other types (TEXT, NTEXT and IMAGE cannot be parameters)
  </td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Parameter value</td>
 </tr>
</table>

<p class="title">0xAD (173) TDS_LOGINACK</p>
<p>Login acknowledge.</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">AD</td>
  <td class="description">Packet type (TDS_LOGINACK)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Packet size</td>
 </tr>
 <tr>
  <td class="offset">03</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Unknown (usually 0x01)</td>
 </tr>
 <tr>
  <td class="offset">04</td>
  <td class="length">4</td>
  <td class="value">XX XX 00 00</td>
  <td class="description">TDS version (e.g. 07 00 00 00 for 7.0)</td>
 </tr>
 <tr>
  <td class="offset">08</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Database product name length</td>
 </tr>
 <tr>
  <td class="offset">09</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Database product name</td>
 </tr>
 <tr>
  <td class="offset">XX</td>
  <td class="length">4</td>
  <td class="value">XX XX XX XX</td>
  <td class="description">Database product version (e.g. 07 00 02 6F stands for 07.00.0879 -- 879 = (0x02+1)&lt;&lt;8 | 0x6F -- quite weird)</td>
 </tr>
</table>

<p class="title">0xD1 (209) TDS_ROW</p>
<p>One result row.</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">D1</td>
  <td class="description">Packet type (TDS_ROW)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Column data (size and format depend on the column's data type)</td>
 </tr>
</table>
<p>Marked fields are repeated for each column.</p>

<p class="title">0xD3 (211) TDS_ALTROW</p>
<p>One aggregate row.</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">D3</td>
  <td class="description">Packet type (TDS_ALTROW)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">01 00</td>
  <td class="description">Unknown (probably some count)</td>
 </tr>
 <tr>
  <td class="offset repeat">XX</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Column data (size and format depend on the column's data type)</td>
 </tr>
</table>
<p>Marked fields are repeated for each column.</p>

<p class="title">0xE3 (226) TDS_ENVCHANGE</p>
<p>Environment change information.</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">E3</td>
  <td class="description">Packet type (TDS_ENVCHANGE)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Packet size</td>
 </tr>
 <tr>
  <td class="offset">03</td>
  <td class="length">1</td>
  <td class="value">XX</td>
  <td class="description">Envchange type (01=Database, 02=Language 03=Charset, 04=Blocksize, 05=Unicode locale id, 06=Unicode comparison style)</td>
 </tr>
 <tr>
  <td class="offset">04</td>
  <td class="length">X</td>
  <td class="value">XX XX XX ...</td>
  <td class="description">Envchange info</td>
 </tr>
</table>
<div class="conditional">
 <p class="subtitle">Envchange type 01=Database change</p>
 <table class="packet">
  <tr>
   <td class="offset">03</td>
   <td class="length">1</td>
   <td class="value">01</td>
   <td class="description">Database change</td>
  </tr>
  <tr>
   <td class="offset">04</td>
   <td class="length">1</td>
   <td class="value">XX</td>
   <td class="description">New database name length</td>
  </tr>
  <tr>
   <td class="offset">05</td>
   <td class="length">X</td>
   <td class="value">XX XX XX ...</td>
   <td class="description">New database name</td>
  </tr>
  <tr>
   <td class="offset">XX</td>
   <td class="length">1</td>
   <td class="value">XX</td>
   <td class="description">Old database name length</td>
  </tr>
  <tr>
   <td class="offset">XX</td>
   <td class="length">X</td>
   <td class="value">XX XX XX ...</td>
   <td class="description">Old database name</td>
  </tr>
 </table>
</div>
<div class="conditional">
 <p class="subtitle">Envchange type 03=Charset change</p>
 <table class="packet">
  <tr>
   <td class="offset">03</td>
   <td class="length">1</td>
   <td class="value">03</td>
   <td class="description">Charset change</td>
  </tr>
  <tr>
   <td class="offset">04</td>
   <td class="length">1</td>
   <td class="value">XX</td>
   <td class="description">Charset length</td>
  </tr>
  <tr>
   <td class="offset">05</td>
   <td class="length">X</td>
   <td class="value">XX XX XX ...</td>
   <td class="description">Charset</td>
  </tr>
  <tr>
   <td class="offset">XX</td>
   <td class="length">2</td>
   <td class="value">XX XX</td>
   <td class="description">Unknown (maybe charset code)</td>
  </tr>
  <tr>
   <td class="offset">XX</td>
   <td class="length">X</td>
   <td class="value">XX XX XX ...</td>
   <td class="description">Probably old charset (length, then value)</td>
  </tr>
 </table>
</div>
<div class="conditional">
 <p class="subtitle">Envchange type 04=Blocksize change</p>
 <table class="packet">
  <tr>
   <td class="offset">03</td>
   <td class="length">1</td>
   <td class="value">03</td>
   <td class="description">Blocksize change</td>
  </tr>
  <tr>
   <td class="offset">04</td>
   <td class="length">1</td>
   <td class="value">XX</td>
   <td class="description">Blocksize length</td>
  </tr>
  <tr>
   <td class="offset">05</td>
   <td class="length">X</td>
   <td class="value">XX XX XX ...</td>
   <td class="description">Blocksize (as string)</td>
  </tr>
  <tr>
   <td class="offset">XX</td>
   <td class="length">X</td>
   <td class="value">XX XX XX ...</td>
   <td class="description">Probably old blocksize (length, then value)</td>
  </tr>
 </table>
</div>

<p class="title">0xFD (253) TDS_DONE<br>0xFE (254) TDS_DONEPROC<br>0xFF (255) TDS_DONEINPROC</p>
<p>End of query execution outside stored procedure (TDS_DONE), end of stored procedure
(TDS_DONEPROC) or end of query inside a stored procedure (TDS_DONEINPROC).</p>
<table class="packet">
 <tr>
  <td class="offset">00</td>
  <td class="length">1</td>
  <td class="value">FD/FE/FF</td>
  <td class="description">Packet type (TDS_DONE/TDS_DONEPROC/TDS_DONEINPROC)</td>
 </tr>
 <tr>
  <td class="offset">01</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Status flags (0x01=more results, 0x02=error, 0x10=valid update count,
   0x20=cancel ack)
  </td>
 </tr>
 <tr>
  <td class="offset">03</td>
  <td class="length">2</td>
  <td class="value">XX XX</td>
  <td class="description">Operation (see below)</td>
 </tr>
 <tr>
  <td class="offset">05</td>
  <td class="length">4</td>
  <td class="value">XX XX XX XX</td>
  <td class="description">Row count (number of rows affected by query)</td>
 </tr>
</table>
<div class="conditional">
 <p class="subtitle">Values for Operation field (incomplete, uncertain)</p>
 <table class="packet">
  <tr>
   <td class="offset">B9</td>
   <td class="description">IMPLICIT TRANSACTIONS ON</td>
  </tr>
  <tr>
   <td class="offset">BA</td>
   <td class="description">IMPLICIT TRANSACTIONS OFF</td>
  </tr>
  <tr>
   <td class="offset">C0</td>
   <td class="description">IF (block start) (?)</td>
  </tr>
  <tr>
   <td class="offset">C1</td>
   <td class="description">SELECT</td>
  </tr>
  <tr>
   <td class="offset">C3</td>
   <td class="description">INSERT</td>
  </tr>
  <tr>
   <td class="offset">C4</td>
   <td class="description">DELETE</td>
  </tr>
  <tr>
   <td class="offset">C5</td>
   <td class="description">UPDATE</td>
  </tr>
  <tr>
   <td class="offset">C6</td>
   <td class="description">CREATE TABLE</td>
  </tr>
  <tr>
   <td class="offset">C7</td>
   <td class="description">DROP TABLE failed</td>
  </tr>
  <tr>
   <td class="offset">CA</td>
   <td class="description">ENDIF (block end) (?)</td>
  </tr>
  <tr>
   <td class="offset">D2</td>
   <td class="description">ROLLBACK</td>
  </tr>
  <tr>
   <td class="offset">D5</td>
   <td class="description">COMMIT</td>
  </tr>
  <tr>
   <td class="offset">D8</td>
   <td class="description">ALTER TABLE</td>
  </tr>
  <tr>
   <td class="offset">DE</td>
   <td class="description">CREATE PROCEDURE</td>
  </tr>
  <tr>
   <td class="offset">DF</td>
   <td class="description">DROP PROCEDURE</td>
  </tr>
  <tr>
   <td class="offset">E0</td>
   <td class="description">END PROCEDURE (the only value for TDS_DONEPROC, but can also be a value
     for TDS_DONEINPROC if the procedure was called inside another procedure)
   </td>
  </tr>
  <tr>
   <td class="offset">E2</td>
   <td class="description">USE (database change)</td>
  </tr>
  <tr>
   <td class="offset">F9</td>
   <td class="description">SET (transaction isolation level, language, ...)</td>
  </tr>
  <tr>
   <td class="offset">FD</td>
   <td class="description">Syntax error or batch execution interrupted (really not sure)</td>
  </tr>
 </table>
</div>


<!--
==================================
  Content ends here
==================================
-->

    </td>
    <td width="9" background="images/mainr.gif"><img src="images/spacer.gif"></td>
  </tr>
  <tr>
    <td width="9" height="9"><img src="images/mainbl.gif" width="9" height="9"></td>
    <td height="9" background="images/mainb.gif"><img src="images/spacer.gif"></td>
    <td width="9" height="9"><img src="images/mainbr.gif" width="9" height="9"></td>
  </tr>
  <tr>
    <td colspan="3">
      <table border="0" cellspacing="0" width="100%" class="outer">
        <tr>
          <td class="copyright" width="150">
            Project hosted by<br><br>
            <A href="http://sourceforge.net/projects/jtds" target="_top"><IMG src="http://sourceforge.net/sflogo.php?group_id=33291&amp;type=2" border="0" alt="SourceForge Logo" class="otherLogo"></A><br>
          </td>
          <td width="500"/>
          <td class="copyright" width="150">
            Web Design<br><br>
            <a href="http://anca13.go.ro" class="outer">Anca Sinpalean</a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
