Report Portal

Q: How in DMV can I convert data_type field from integer to string representation?

Q: How in DMV can I convert data_type field from integer to string representation?

A: Certain DMVs (for example $system.MDSCHEMA_MEASURES) used data_type field to describe measure type. This field is integer type. To get a textual data type presentation you will need to use DMV $SYSTEM.DBSCHEMA_PROVIDER_TYPES. Here is query to get a list of available data types:

SELECT DATA_TYPE, TYPE_NAME, COLUMN_SIZE, IS_FIXEDLENGTH
 FROM $SYSTEM.DBSCHEMA_PROVIDER_TYPES

Here is a sample result:

 
DATA_TYPETYPE_NAMECOLUMN_SIZEIS_FIXEDLENGTH
2SHORT2TRUE
3LONG4TRUE
4FLOAT4TRUE
5DOUBLE8TRUE
6CURRENCY8TRUE
7DATE4TRUE
8BSTR256FALSE
18USHORT2TRUE
19ULONG4TRUE
129CHAR256FALSE
130WCHAR256FALSE
12VARIANT16TRUE

Done 

Tags: faq, dmv

 

2007-2015 VidasSoft Systems Inc.