COLUMNS Rowset

The COLUMNS rowset identifies the columns of tables defined in the catalog that are accessible to a given user.

The COLUMNS rowset contains the following columns:

Column name Type indicator Description
TABLE_CATALOG DBTYPE_WSTR Catalog name. NULL if the provider does not support catalogs.
TABLE_SCHEMA DBTYPE_WSTR Unqualified schema name. NULL if the provider does not support schemas.
COLUMN_NAME DBTYPE_WSTR The name of the column. This might not be unique. If this cannot be determined, a NULL is returned.

This column, together with the COLUMN_GUID and COLUMN_PROPID columns, forms the columns ID. One or more of these columns will be NULL depending on which elements of the DBID structure the provider uses.

If possible, the resulting column ID should be persistent. However, some providers do not support persistent identifiers for columns.

The column ID of a base table should be invariant under views.

COLUMN_GUID DBTYPE_GUID Column GUID
COLUMN_PROPID DBTYPE_UI4 Column property ID.
ORDINAL_POSITION DBTYPE_UI4 The ordinal of the column. Columns are numbered starting from one. NULL if there is no stable ordinal value for the column.
COLUMN_HASDEFAULT DBTYPE_BOOL Specifies value as either of:
  • VARIANT_TRUE, which indicates that the column has a default value.

  • VARIANT_FALSE, which indicates that the column does not have a default value or it is unknown whether the column has a default value.
COLUMN_DEFAULT DBTYPE_WSTR Default value of the column. A provider may expose DBCOLUMN_DEFAULTVALUE but not DBCOLUMN_HASDEFAULT in the rowset returned by IColumnsRowset::GetColumns Rowset.

If the default value is NULL, COLUMN_HASDEFAULT is VARIANT_TRUE, and the COLUMN_DEFAULT column is NULL.

COLUMN_FLAGS DBTYPE_UI4 A bitmask that describes column characteristics. The DBCOLUMNFLAGS enumerated type specifies the bits in the bitmask. For information about DBCOLUMNSFLAGS, see IColumnsInfo::GetColumnInfo. This column cannot contain a NULL value.
IS_NULLABLE DBTYPE_BOOL Specifies values as either of:
  • VARIANT_TRUE, which indicates that the column might be nullable.

  • VARIANT_FALSE, which indicates that the column is known not to be nullable.
DATA_TYPE DBTYPE_UI2 The indicator of the column’s data type. If the data type of the column varies from row to row, this must be DBTYPE_VARIANT. For a list of valid type indicators, see “Type Indicators” in Appendix A of the OLE DB Programmer’s Reference.
TYPE_GUID DBTYPE_GUID The GUID of the column’s data type.
CHARACTER_MAXIMUM_ LENGTH DBTYPE_UI4 The maximum possible length of a value in the column. For character, binary, or bit columns, this is one of:
  • The maximum length of the column in characters, bytes, or bits, respectively, if one is defined.

  • The maximum length of the data type in characters, bytes, or bits, respectively, if the column does not have a defined length.

  • Zero (0) if neither the column nor the data type has a defined maximum length.

  • NULL for all other types of columns.
CHARACTER_OCTET_LENGTH DBTYPE_UI4 Maximum length in octets (bytes) of the column, if the type of the column is character or binary. A value of zero means the column has no maximum length.

NULL for all other types of columns.

NUMERIC_PRECISION DBTYPE_UI2 If the column’s data type is numeric, this is the maximum precision of the column. The precision of columns with a data type of DBTYPE_DECIMAL or DBTYPE_NUMERIC depends on the definition of the column.

If the column’s data type is not numeric, this is NULL

NUMERIC_SCALE DBTYPE_I2 If column’s type indicator is DBTYPE_NUMERIC, this is the number of digits to the right of the decimal point. Otherwise, this is NULL
DATETIME_PRECISION DBTYPE_UI4 Datetime precision (number of digits in the fractional seconds portion) of the column if the column is a datetime or interval type.
CHARACTER_SET_ CATALOG DBTYPE_WSTR Catalog name in which the character set is defined NUL if the provider does not support catalogs or different character sets.
CHARACTER_SET_ SCHEMA DBTYPE_WSTR Unqualified schema name in which the character set is defined. NULL if the provider does not support schemas or different character sets.
CHARACTER_SET_NAME DBTYPE_WSTR Character set name. NULL if the provider does not support different character sets.
COLLATION_CATALOG DBTYPE_WSTR Catalog name in which the collation is defined. NULL if the provider does not support catalogs or different collations.
COLLATION_SCHEMA DBTYPE_WSTR Unqualified schema name in which the collation is defined. NULL if the provider does not support schemas or different collations.
COLLATION_NAME DBTYPE_WSTR Collation name. NULL if the provider does not support different collations.
DOMAIN_CATALOG DBTYPE_WSTR Catalog name in which the domain is defined. NULL if the provider does not support catalogs or domains.
DOMAIN_SCHEMA DBTYPE_WSTR Unqualified schema name in which the domain is defined. NULL if the provider does not support schemas or domains.
DOMAIN_NAME DBTYPE_WSTR Domain name. NULL if the provider does not support domains.
DESCRIPTION DBTYPE_WSTR Human-readable description of the column. For example, the description for a column named Name in the Employee table might be “Employee name.”

Default Sort Order: TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME.