TypeInfo object

The TypeInfo object describes a specific data types, for instance for columns or stored procedure parameters. It is used in metadata for result sets, table-valued parameters, and stored procedure parameters.


Properties

byte type: the number of the data type, as defined in the sys.types view. The base types are (with slight variations across versions):

image 34

text 35
uniqueidentifier 36
date 40
time 41
datetime2 42
datetimeoffset 43
tinyint 48
smallint 52
int 56
smalldatetime 58
real 59
money 60
datetime 61
float 62
sql_variant 98
ntext 99

bit 104

decimal 106

numeric 108

smallmoney 122

bigint 127

hierarchyid 240

geometry 240

geography 240

varbinary 165

varchar 167

binary 173

char 175

timestamp 189

nvarchar 231

nchar 239

xml 241

string typeName: the name of the data type

int varLen: the variable length of the type, if applicable.

int collationLCID: the collation. See the Microsoft documentation for details. For details on the structure of the LCID, see here.

boolean collationIgnoreCase: whether the collation ignores case.

boolean collationIgnoreAccent: whether the collation ignores accents.

boolean collationIgnoreWidth: whether the collation ignores the width of the characters.

boolean collationIgnoreKana: whether the collation should distinguish between Hiragana and Katakana.

boolean collationBinary:: if true, sort based on the bit patterns defined for each character.

boolean collationBinary2: if true, sort based on Unicode code points for Unicode data (has no effect on non-Unicode data).

boolean collationUTF8: if true, sort based on UTF-8 code points.

byte collationVersion:: the version of the collation to use.

byte collationSortId: the ID of the sorting algorithm.

Note: if collationBinary and/or collationBinary2 are true, then collationIgnoreCase, collationIgnoreAccent, collationIgnoreWidth and collationIgnoreKana have no effect. For more details, see the Microsoft documentation.


int precision: the precision of the data type (numeric/dates only)

int scale: the scale of the data type, e.g. how many decimals are supported (numeric only).


For user-defined types (UDT) - for all other types, these properties are meaningless.

String udtDbName: the name of the database containing the UDT

String udtSchemaName: the name of the schema containing the UDT

String udtTypeName: the name of the UDT

int udtMaxByteSize: the maximum size of the UDT

String udtAssemblyQualifiedName: the assembly qualified name of the UDT.


For XML data - for all other types, these properties are meaningless.

boolean xmlSchemaPresent: true if there is a schema associated with this XML data

String xmlDbName: the name of the database containing the XML schema.

String xmlOwningSchema: the name of the schema containing the XML schema.

String xmlSchemaCollection: the name of the schema collection.