Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

2.2.7.4 COLMETADATA

Token Stream Name:

COLMETADATA

Token Stream Function:

Describes the result set for interpretation of following ROW data streams.

Token Stream Comments:

  • The token value is 0x81.

  • This token is used to tell the client the data type and length of the column data. It describes the format of the data found in a ROW data stream.

  • All COLMETADATA data streams are grouped together.

Token Stream-Specific Rules:

TokenType        =   BYTE
Count            =   USHORT

UserType         =   USHORT/ULONG; (Changed to ULONG in TDS 7.2)

fNullable        =   BIT
fCaseSen         =   BIT
usUpdateable     =   2BIT        ; 0 = ReadOnly
                                 ; 1 = Read/Write
                                 ; 2 = Unused
fIdentity        =   BIT
fComputed        =   BIT         ; (introduced in TDS 7.2)
usReservedODBC   =   2BIT        ; (only exists in TDS 7.3.A and below)
fSparseColumnSet =   BIT         ; (introduced in TDS 7.3.B)
usReserved2      =   2BIT        ; (introduced in TDS 7.3.B)
fFixedLenCLRType =   BIT         ; (introduced in TDS 7.2)
usReserved       =   4BIT
fHidden          =   BIT         ; (introduced in TDS 7.2)
fKey             =   BIT         ; (introduced in TDS 7.2)
fNullableUnknown =   BIT         ; (introduced in TDS 7.2)

Flags            =  fNullable
                    fCaseSen
                    usUpdateable
                    fIdentity
                    (FRESERVEDBIT / fComputed)
                    usReservedODBC
                    (FRESERVEDBIT / fFixedLenCLRType)
                    (usReserved   / (FRESERVEDBIT fSparseColumnSet usReserved2)) 
                    (FRESERVEDBIT / fHidden)
                    (FRESERVEDBIT / fKey)
                    (FRESERVEDBIT / fNullableUnknown)

NumParts        =   BYTE         ; (introduced in TDS 7.2)
PartName        =   US_VARCHAR   ; (introduced in TDS 7.2)

TableName       =   NumParts
                    1*PartName

ColName         =   B_VARCHAR

ColumnData      =   UserType
                    Flags
                    TYPE_INFO
                    [TableName]
                    ColName

NoMetaData      =   %xFF %xFF    

The TableName element is specified only if text, ntext, or image columns are included in the result set.

Token Stream Definition:

COLMETADATA      =   TokenType
                     NoMetaData / (1 *ColumnData)

Token Stream Parameter Details:

Parameter

Description

TokenType

COLMETADATA_TOKEN

Count

The count of columns (number of aggregate operators) in the token stream. In the event that the client requested no metadata to be returned (see OptionFlags parameter in RPCRequest token), the value of Count will be 0xFFFF. This has the same effect on Count as a zero value (for example, no ColumnData is sent).

UserType

The user type ID of the data type of the column. The value will be 0x0000 with the exceptions of TIMESTAMP (0x0050) and alias types (greater than 0x00FF).

Flags

Bit flags in least significant bit order:

  • fCaseSen is a bit flag. Set to 1 for string columns with binary collation and always for the XML data type. Set to 0 otherwise.

  • fNullable is a bit flag. Its value is 1 if the column is nullable.

  • usUpdateable is a 2-bit field. Its value is 0 if column is read-only, 1 if column is read/write and 2 if updateable is unknown.

  • fIdentity is a bit flag. Its value is 1 if the column is an identity column.

  • fComputed is a bit flag. Its value is 1 if the column is a COMPUTED column.

  • usReservedODBC is a 2-bit field that is used by ODS gateways supporting the ODBC ODS gateway driver.

  • fFixedLenCLRType is a bit flag. Its value is 1 if the column is a fixed-length CLR UDT.

  • fSparseColumnSet is a bit flag. Set to 1 if the column is the special XML column for the sparse column set. For information about using column sets, see [MSDN-ColSets].

  • fHidden is a bit flag. Its value is 1 if the column is part of a hidden primary key created to support a T-SQL SELECT statement containing FOR BROWSE.

  • fKey is a bit flag. Its value is 1 if the column is part of a primary key for the row and the T-SQL SELECT statement contains FOR BROWSE.

  • fNullableUnknown is a bit flag. Its value is 1 if it is unknown whether the column might be nullable.

TableName

The fully qualified base table name for this column. Contains the table name length and table name. This exists only for text, ntext and image columns. Specifies how many parts will be returned and then repeats PartName once for each NumParts.

ColName

The column name. Contains the column name length and column name.

NoMetaData

This notifies client that no metadata will follow the COLMETADATA token. Client notifies the server that it has already cached the metadata from previous request, by setting fNoMetadata to 1 in RPC Request (section 2.2.6.5). The server SHOULD not send NoMetaData unless fNoMetadata is set to 1 in the request.

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.