共用方式為


COLUMNS Rowset

GUID: DBSCHEMA_COLUMNS

Number of restriction columns: 4

Restriction columns: TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME

Default sort order: TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME

Description: The COLUMNS rowset identifies the columns of tables (including views) defined in the catalog that are accessible to a given user.

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.

TABLE_NAME

DBTYPE_WSTR

Table name. This column cannot contain a NULL.

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 column 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. Providers that do not use GUIDs to identify columns should return NULL in this column.

COLUMN_PROPID

DBTYPE_UI4

Column property ID. Providers that do not associate PROPIDs with columns should return NULL in this column.

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

VARIANT_TRUE ? The column has a default value.

VARIANT_FALSE ? 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 (for SQL-92 tables) in the rowset returned by IColumnsRowset::GetColumnsRowset.

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

COLUMN_FLAGS

DBTYPE_UI4

A bitmask that describes column characteristics. The DBCOLUMNFLAGS enumerated type specifies the bits in the bitmask. For information about DBCOLUMNFLAGS, see IColumnsInfo::GetColumnInfo in the reference section. This column cannot contain a NULL value.

If COLUMN_NAME refers to a column in a table or view that is updatable, one of either DBCOLUMNFLAGS_WRITE or DBCOLUMNFLAGS_WRITEUNKNOWN should be set. For more information about these flags, see DBCOLUMNFLAGS Enumerated Type.

IS_NULLABLE

DBTYPE_BOOL

VARIANT_TRUE ? The column might be nullable.

VARIANT_FALSE ? 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. This column cannot contain NULL. For a list of valid type indicators, see Type Indicators in Appendix A: Data Types.

TYPE_GUID

DBTYPE_GUID

The GUID of the column's data type. Providers that do not use GUIDs to identify data types should return NULL in this column.

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 following:

  • The maximum length of the column in characters, bytes, or bits, respectively, if one is defined. For example, a CHAR(5) column in an SQL table has a maximum length of 5.

  • 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 of a numeric data type other than VARNUMERIC, 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. For the precision of all other numeric data types, see Precision of Numeric Data Types in Appendix A: Data Types.

If the column's data type is not numeric or is VARNUMERIC, this is NULL.

NUMERIC_SCALE

DBTYPE_I2

If the column's type indicator is DBTYPE_DECIMAL, DBTYPE_NUMERIC, or DBTYPE_VARNUMERIC, 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. If the column's data type is not datetime, this is NULL.

CHARACTER_SET_CATALOG

DBTYPE_WSTR

Catalog name in which the character set is defined. NULL 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." Null if this column is not supported by the provider, or if there is no description associated with the column.