Compartir a través de


EnumTables Method

Esta característica se quitará en una versión futura de Microsoft SQL Server. Evite utilizar esta característica en nuevos trabajos de desarrollo y tenga previsto modificar las aplicaciones que actualmente la utilizan.

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

Sintaxis

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.

Notas

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.

Applies To:

LinkedServer Object