EnumTables Method (SQL-DMO)

The EnumTables method returns a QueryResults object enumerating the tables of a linked server.

Applies To

LinkedServer Object

Syntax

object.EnumTables( [ TableName ] , [ SchemaName ] , [ CatalogName ]
, [ TableType ] ) as QueryResults

Part Description
object Expression that evaluates to an object in the Applies To list.
TableName Optional. String identifying 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 identifying 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 identifying 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 specifying a type of table as described in Settings.

Settings
Constant Value Description
SQLDMOLinkedTable_Alias 1 Restrict result set membership to alias tables
SQLDMOLinkedTable_Default 0 No restriction
SQLDMOLinkedTable_
GlobalTemporary
2 Restrict result set membership to global temporary tables
SQLDMOLinkedTable_
LocalTemporary
3 Restrict result set membership to local temporary tables
SQLDMOLinkedTable_SystemTable 4 Restrict result set membership to system tables
SQLDMOLinkedTable_Table 5 Restrict result set membership to user tables
SQLDMOLinkedTable_View 6 Restrict result set membership to views

Returns

A QueryResults object containing 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.

Remarks

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 your OLE DB provider documentation.

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);

  


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