126.96.36.199 Type Info Rule Definition
The TYPE_INFO rule applies to several messages used to describe column information. For columns of fixed data length, the type is all that is required to determine the data length. For columns of a variable-length type, TYPE_VARLEN defines the length of the data contained within the column, with the following exceptions introduced in TDS 7.3:
DATE MUST NOT have a TYPE_VARLEN. The value is either 3 bytes or 0 bytes (null).
TIMENTYPE, DATETIME2NTYPE, and DATETIMEOFFSETNTYPE MUST NOT have a TYPE_VARLEN. The lengths are determined by the SCALE as indicated in section 188.8.131.52.3.
PRECISION and SCALE MUST occur if the type is NUMERICTYPE, NUMERICNTYPE, DECIMALTYPE, or DECIMALNTYPE.
SCALE (without PRECISION) MUST occur if the type is TIMENTYPE, DATETIME2NTYPE, or DATETIMEOFFSETNTYPE (introduced in TDS 7.3). PRECISION MUST be less than or equal to decimal 38 and SCALE MUST be less than or equal to the precision value.
COLLATION occurs only if the type is BIGCHARTYPE, BIGVARCHARTYPE, TEXTTYPE, NTEXTTYPE, NCHARTYPE, or NVARCHARTYPE.
UDT_INFO always occurs if the type is UDTTYPE.
XML_INFO always occurs if the type is XMLTYPE.
USHORTMAXLEN does not occur if PARTLENTYPE is XMLTYPE or UDTTYPE.
USHORTMAXLEN = %xFFFF TYPE_INFO = FIXEDLENTYPE / (VARLENTYPE TYPE_VARLEN [COLLATION]) / (VARLENTYPE TYPE_VARLEN [PRECISION SCALE]) / (VARLENTYPE SCALE) ; (introduced in TDS 7.3) / VARLENTYPE ; (introduced in TDS 7.3) / (PARTLENTYPE [USHORTMAXLEN] [COLLATION] [XML_INFO] [UDT_INFO])