Choosing a TDS protocol version

The TDS protocol version is probably something you'd rather not know even existed, much less something you'd have to choose. But there's not that much to it, really. Unless you run into an incompatibility, you're best off running with the highest protocol version supported by your server. That's what the vendors' own products do, which is why when you read the Sybase or Microsoft documentation you find no mention of TDS versions.

Table 3.1. Versions of the TDS Protocol, by Product

ProductTDS VersionComment
Sybase before System 10, Microsoft SQL Server 6.x4.2Still works with all products, subject to its limitations.
Sybase System 10 and above5.0Still the most current protocol used by Sybase.
Sybase System SQL Anywhere5.0 only Originally Watcom SQL Server, a completely separate codebase. Our best information is that SQL Anywhere first supported TDS in version 5.5.03 using the OpenServer Gateway (OSG), and native TDS 5.0 support arrived with version 6.0.
Microsoft SQL Server 7.07.0Includes support for the extended datatypes in SQL Server 7.0 (such as char/varchar fields of more than 255 characters), and support for Unicode.
Microsoft SQL Server 20007.1Include support for bigint (64 bit integers), variant and collation on all fields. Collation is not widely used.
Microsoft SQL Server 20057.2Includes support for varchar(max), varbinary(max), xml datatypes and MARS[a].
Microsoft SQL Server 20087.3Includes support for time, date, datetime2, datetimeoffset.
Microsoft SQL Server 2012 or 20147.4Includes support for session recovery.

[a] Multiple Active Result Sets.

Choosing protocol version since FreeTDS 1.1

Version 1.1 improved the discovery of the protocol version. If you are using Microsoft SQL Server is recommended to leave the version to auto (the default). If you are using any Sybase product you could set version to 5.0 to get faster connections (although auto will work too).

Choosing protocol version before FreeTDS 1.1

Choosing the correct TDS protocol version for use with SQL Server can be confusing. Hopefully, these steps will lead you to the correct version. If you have a Sybase server, you should be able to use version 5.0, otherwise, if you have Microsoft SQL Server refer to the following section.

  • Step 1: Find out which FreeTDS version you are running. You can use the command: `tsql -C`

  • Step 2: Find out what version of Microsoft SQL Server you are running.

  • Step 3: Pick the lower TDS Version number out of what matches steps 1 and 2 from the table below.

Table 3.2. What Version of the TDS Protocol Should I use with Microsoft SQL Server?

FreeTDS VersionMicrosoft SQL Server Version SupportedHighest TDS Version SupportedMicrosoft Extended Support End Date
1.0020167.4July 9th, 2024
1.0020147.4July 9th, 2024
1.0020127.4July 12th, 2022
0.9520087.3July 9th, 2019
0.9120057.2April 12th, 2016
0.8220007.1April 9th, 2013
0.6420007.1April 9th, 2013

NOTE FOR USERS WHO NEED SQL SERVER 2000 SUPPORT (VERY RARE; SQL SERVER HAS BEEN OUT OF EXTENDED SUPPORT SINCE 2013 AND SHOULD *NEVER* BE USED IN PRODUCTION): Years ago, Microsoft didn't officially create a TDS version number until after FreeTDS was released, and it was assumed 8.0 would be the next version; it turned out to be 7.1. Because of this:

  • If you are running FreeTDS Version 0.64 or 0.82 with Microsoft SQL Server 2000, use TDS Version 8.0 instead of 7.1.

  • If you are running FreeTDS Version 0.91 or greater with Microsoft SQL Server 2000, use TDS Version 7.1.

  • Please note, this is ONLY if you need Microsoft SQL Server 2000 support.

For best results, use the highest version of the protocol supported by your server. If you encounter problems, try a lower version. If that works, though, please report it to the mailing list!

Regarding obsolete versions

In the earlier days of FreeTDS, Microsoft did not release official specs for the TDS protocol. When MSSQL 2000 (product 8.0) was released, there was semi-official indications from the Microsoft community that the TDS protocol would be version 8.0. So the FreeTDS developers adopted that version for FreeTDS. Years later, when Microsoft started releasing official specs of the protocol, it became obvious that the TDS versions that FreeTDS had labeled 8.0 and 9.0 were actually versions 7.1 and 7.2 respectively.

Version 8.0 cannot be used from FreeTDS version 1.3.

TDS 4.2 has limitations

  • ASCII only, of course.

  • RPC is not supported.

  • BCP is not supported.

  • varchar fields are limited to 255 characters. If your table defines longer fields, they'll be truncated.

  • dynamic queries (also called prepared statements) are not supported.

The protocol version may also affect how database servers interpret commands. For example, Microsoft SQL Server 2000 is known to behave differently with versions 4.2 and 7.0. Version 7.0 is recommended for compatibility with Microsoft SQL Server tools.