Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column type 0x20 and 0x21 unspecified, but returned by AWS-based SQL Server instances #27

Open
monty241 opened this issue Jan 10, 2025 · 2 comments

Comments

@monty241
Copy link

monty241 commented Jan 10, 2025

Specifically on SQL Server running on AWS as service, there is a column type 0x20 and 0x21 being returned. On other SQL Server editions (on-premises, Azure) this has not yet been found in identical scenarios.

Wireshark TDS seems also unable to handle it, leading to nonsense column metadata being reported.

The documented types are listed in 2.2.5 Data Type Definitions.

Is it possible to add documentation and logic in C# how to interprete these column types 0x20 and 0x21 as part of the TDS specification to allow building a custom SQL Server client?

TDS column type 0x20

Reproduction: start SQL Server Management Studio and connect to SQL Server on AWS. First statement is:

Image

With result for the first column (a non-casted 1 as value) a column data type 0x20:

Image

TDS column type 0x21

Reproduction: run a query returning 1 cased as tinyint/shortint/int (always 0x21):

Image

Resulting data type for column according to SQL Server instance is column data type 0x21:

Image

@monty241 monty241 changed the title Column type 0x20 and 0x21 unspecified, but used by AWS-based SQL Server instances Column type 0x20 and 0x21 unspecified, but returned by AWS-based SQL Server instances Jan 10, 2025
@valterc
Copy link
Contributor

valterc commented Jan 10, 2025

Like you say, those data types don't seem to be described in the MS-TDS protocol. Perhaps they are from a different TDS spec or could also be Wireshark that is not parsing the tokens correctly and shows wrong values?

This is likely not the ideal location to diagnose that further. You should try to reach out to AWS support or community forums.

@monty241
Copy link
Author

Thanks for feedback!

0x20 and 0x21 were not to be found in any reference documentation version.

We built our own parser starting from TdsLib and ran into the same issue as Wireshark, so it seems to be generic issue when the spec is followed.

To be sure: this statement is the Microsoft Corp. official point of view that the current TDS documentation is correct?

Reaching out to AWS what type of SQL Server they have acquired and whether they made any specific deviations from the TDS-standard in source code or configuration is going to be a major pain, especially with the current deviations in policy between the EU and US.

When this is formal point of view, we can just map occurrence 0x20 and 0x21 to justify an error like "This is a SQL Server implementation deviant from the formal TDS specification." with hint "Please reach out to your supplier to acquire a TDS-standard compliant SQL Server instance."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants