Skip to content

MSSQL: TDS protocol issue with user-defined data type #1655

@akaahn

Description

@akaahn

Issue reading rows containing nvarchar(max) wrapped UDT.
Handles it properly if the column value is NULL, but if it contains a value it messes up the protocol parsing.

The type is defined like this:

CREATE TYPE [dbo].[UDT_ObjDescription] FROM [nvarchar](max) NULL

The type is detected as nvarchar.
I've tried dumping some data for debug, marked in green is the correct size for the string.
But the following marked bytes I can't figure out what is, as I understand it 5 bytes might be collation info, but that still leaves another 5 bytes.
odd bytes

Table definition:

CREATE TABLE [dbo].[TestTable] (
	[Id] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [dbo].[UDT_ObjDescription] NULL
)

Sorry if this is a bad description of the issue, but don't hesitate to ask if there is more info I can help with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions