EnumTables Method
后续版本的 Microsoft SQL Server 将删除该功能。 请避免在新的开发工作中使用该功能,并着手修改当前还在使用该功能的应用程序。
The EnumTables method returns a QueryResults object that enumerates the tables of a linked server.
语法
object.EnumTables( [ TableName ] , [ SchemaName ] , [ CatalogName ]
, [ TableType ] )as QueryResults
Parts
object
Expression that evaluates to an object in the Applies To list.TableName
Optional. String that identifies a table on the linked server by name. Maps to the OLE DB schema rowset restriction TABLE_NAME. When specified, restricts result set membership to the table(s) matching the criteria.SchemaName
Optional. String that identifies a schema on the linked server by name. Maps to the OLE DB schema rowset restriction SCHEMA_NAME. When specified, restricts result set membership to tables defined on the schema.CatalogName
Optional. String that identifies a catalog on the linked server by name. Maps to the OLE DB schema rowset restriction CATALOG_NAME. When specified, restricts result set membership to tables defined on the catalog.TableType
Optional. Maps to the OLE DB schema rowset restriction TABLE_TYPE. A long integer that specifies a type of table as described in Settings.
Prototype (C/C++)
HRESULT EnumTables(LPSQLDMOQUERYRESULTS* ppResults,
SQLDMO_LPCSTR TableName = NULL,
SQLDMO_LPCSTR SchemaName = NULL,
SQLDMO_LPCSTR CatalogName = NULL,
SQLDMO_LINKEDTABLE_TYPE TableType = SQLDMOLinkedTable_Default);
Settings
Constant |
Value |
Description |
---|---|---|
SQLDMOLinkedTable_/GlobalTemporary |
2 |
Restrict result set membership to global temporary tables. |
SQLDMOLinkedTable_LocalTemporary |
3 |
Restrict result set membership to local temporary tables. |
SQLDMOLinkedTable_Alias |
1 |
Restrict result set membership to alias tables. |
SQLDMOLinkedTable_Default |
0 |
No restriction. |
SQLDMOLinkedTable_SystemTable |
4 |
Restrict result set membership to system tables. |
SQLDMOLinkedTable_SystemView |
7 |
Restrict result set membership to System views. |
SQLDMOLinkedTable_Table |
5 |
Restrict result set membership to user tables. |
SQLDMOLinkedTable_View |
6 |
Restrict result set membership to views. |
Returns
A QueryResults object that contains one result set defined by these columns.
Column |
Data type |
Description |
---|---|---|
TABLE_CAT |
nvarchar(129) |
Catalog name. May be NULL. |
TABLE_SCHEM |
nvarchar(129) |
Schema name. May be NULL. |
TABLE_NAME |
nvarchar(129) |
Table name. |
TABLE_TYPE |
nvarchar(129) |
Type of table. |
REMARKS |
nvarchar(256) |
Descriptive text. May be NULL. |
注释
The EnumTables method is implemented using the IDBSchemaRowset interface of the OLE DB provider specified by the linked server. The method returns part of the DBSCHEMA_TABLES rowset.
Some OLE DB providers support wildcard matches in restrictions specified by the TableName, SchemaName, and CatalogName arguments of the EnumTables method. Some OLE DB providers return values in the result set columns TABLE_CAT, TABLE_SCHEM, and REMARKS. For more information about argument specification and result set membership interpretation, see the OLE DB provider documentation.