EnumColumns Method
未來的 Microsoft SQL Server 發行版本將不再提供此功能。請避免在新的開發工作中使用此功能,並計劃修改目前使用此功能的應用程式。
The EnumColumns method returns a QueryResults object that enumerates the columns of tables defined on a linked server.
語法
object
.EnumColumns( [ TableName ] , [ SchemaName ] , [ CatalogName ]
, [ ColumnName ] )as QueryResults
Parts
- object
Expression that evaluates to an object in the Applies To list.
- TableName
Optional. String that names 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 that names 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 that names 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 that names a column on a table named by the TableName argument. When specified, it restricts result set membership, returning a single row that enumerates the column named.
Prototype (C/C++)
HRESULT EnumColumns(LPSQLDMOQUERYRESULTS *ppResults,
SQLDMO_LPCSTR TableName = NULL,
SQLDMO_LPCSTR SchemaName = NULL,
SQLDMO_LPCSTR CatalogName = NULL,
SQLDMO_LPCSTR ColumnName = NULL);
Returns
A QueryResults object that contains one result set defined by these columns.
Column | Data type | Description |
---|---|---|
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. |
CHAR_OCTET_/LENGTH |
integer |
Maximum length, in bytes, of a character data type. |
COLUMN_DEF |
nvarchar(128) |
Default value. |
COLUMN_NAME |
nvarchar(128) |
Name of the column. |
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. |
DATA_TYPE |
smallint |
Data type of the column. Interpret the value using SQLDMO_QUERY_DATATYPE. |
DECIMAL_DIGITS |
smallint |
When the data type is a fixed-precision numeric type, the scale of the data type. |
IS_NULLABLE |
char(10) |
YES when the column may contain NULL. NO when the column cannot contain NULL. |
NULLABLE |
smallint |
1 when the column accepts NULL. 0 when the column does not accept NULL. |
NUM_PREC_RADIX |
smallint |
Radix of a numeric data type. |
ORDINAL_/POSITION |
smallint |
Ordinal position of the column in the table. |
REMARKS |
nvarchar(256) |
Descriptive text. |
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. |
SS_DATA_TYPE |
tinyint |
Microsoft SQL Server data type interpreted using data type constants defined by Open Data Services. |
TABLE_CAT |
nvarchar(128) |
Name of the SQL Server database in which the column is defined. |
TABLE_NAME |
nvarchar(128) |
Name of the table in which the column is defined. |
TABLE_SCHEM |
nvarchar(128) |
Name of the owner of the table in which the column is defined. |
TYPE_NAME |
nvarchar(128) |
Name of the column data type. |