EnumColumns Method (SQL-DMO)

The EnumColumns method returns a QueryResults object enumerating the columns of tables defined on a linked server.

Applies To

LinkedServer Object

Syntax

object.EnumColumns( [ TableName ] , [ SchemaName ] , [ CatalogName ]
, [ ColumnName ] ) as QueryResults

Part Description
object Expression that evaluates to an object in the Applies To list.
TableName Optional. String naming a table defined on the linked server. When specified, it restricts result set membership to the columns defined in the specified table.
SchemaName Optional. String naming a schema on which the linked server table is defined. When specified, it restricts result set membership to the columns of tables defined on the schema
CatalogName Optional. String naming a catalog on which the linked server table is defined. When specified, it restricts result set membership to the columns of tables defined on the catalog
ColumnName Optional. String naming a column on a table named by the TableName argument. When specified, it restricts result set membership, returning a single row enumerating the column named.

Returns

A QueryResults object containing one result set defined by these columns.

Column Data type Description
TABLE_CAT nvarchar(128) Name of the Microsoft® SQL Server™ database in which the column is defined.
TABLE_SCHEM nvarchar(128) Name of the owner of the table in which the column is defined.
TABLE_NAME nvarchar(128) Name of the table in which the column is defined.
COLUMN_NAME nvarchar(128) Name of the column.
DATA_TYPE smallint Data type of the column. Interpret the value using SQLDMO_QUERY_
DATATYPE.
TYPE_NAME nvarchar(128) Name of the column data type.
COLUMN_SIZE integer When the data type is a fixed or variable-length character or binary type, the number of characters or bytes. When the data type is a fixed-precision numeric type, the precision of the data type.
BUFFER_LENGTH integer When the data type is a fixed or variable-length character or binary type, the number of bytes required to retrieve any value from the column.
DECIMAL_DIGITS smallint When the data type is a fixed-precision numeric type, the scale of the data type.
NUM_PREC_RADIX smallint Radix of a numeric data type.
NULLABLE smallint 1 when the column accepts NULL. 0 when the column does not accept NULL.
REMARKS nvarchar(256) Descriptive text.
COLUMN_DEF nvarchar(128) Default value.
SQL_DATA_TYPE smallint Data type of the column. Interpret the value using SQLDMO_QUERY_
DATATYPE.
SQL_DATETIME_
SUB
smallint Subtype code for SQL-92 date, time, and interval data types.
CHAR_OCTET_
LENGTH
integer Maximum length in bytes of a character data type.
ORDINAL_
POSITION
smallint Ordinal position of the column in the table.
IS_NULLABLE char(10) YES when the column may contain NULL. NO when the column cannot contain NULL.
SS_DATA_TYPE tinyint SQL Server data type interpreted by using data type constants defined by Open Data Services.

Prototype (C/C++)

HRESULT EnumColumns(LPSQLDMOQUERYRESULTS *ppResults,
SQLDMO_LPCSTR TableName = NULL,
SQLDMO_LPCSTR SchemaName = NULL,
SQLDMO_LPCSTR CatalogName = NULL,
SQLDMO_LPCSTR ColumnName = NULL);

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.