次の方法で共有


ListObjects Method

この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。

The ListObjects method returns a SQLObjectList object that enumerates the system and user-defined objects defining the database referenced.

構文

object
.ListObjects( [ ObjectType ] , [ SortBy ] )asSQLObjectList

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • ObjectType
    Optional. A long integer that constrains list membership to objects of the type(s) specified as described in Settings.
  • SortBy
    Optional. A long integer that specifies list membership ordering as described in Settings.

Prototype (C/C++)

HRESULT ListObjects(
LPSQLDMODBOBJECTLIST* ppList,
SQLDMO_OBJECT_TYPE lObjectTypes = SQLDMOObj_AllDatabaseObjects,
SQLDMO_OBJSORT_TYPE SortBy = SQLDMOObjSort_Name);

Settings

The ObjectType argument is a bit-packed long integer. Specify more than a single database object type by using an OR logical operator to combine the following SQLDMO_OBJECT_TYPE values.

Constant Value Description

SQLDMOObj_/AllButSystemObjects

5119

Returned SQLObjectList object enumerates all but Microsoft SQL Server system objects.

SQLDMOObj_/AllDatabaseObjects

4607

Returned SQLObjectList object enumerates SQL Server system and user database objects.

SQLDMOObj_/AllDatabaseUserObjects

4605

Returned SQLObjectList object enumerates only user database objects.

SQLDMOObj_Default

64

Returned SQLObjectList object enumerates SQL Server defaults.

SQLDMOObj_Rule

128

Returned SQLObjectList object enumerates SQL Server rules.

SQLDMOObj_StoredProcedure

16

Returned SQLObjectList object enumerates SQL Server stored procedures.

SQLDMOObj_SystemTable

2

Returned SQLObjectList object enumerates SQL Server system tables.

SQLDMOObj_Trigger

256

Returned SQLObjectList object enumerates SQL Server triggers.

SQLDMOObj_/UserDefinedDatatype

4096

Returned SQLObjectList object enumerates SQL Server user-defined data type.

SQLDMOObj_/UserDefinedFunction

1

Returned SQLObjectList object enumerates user-defined function.

SQLDMOObj_UserTable

8

Returned SQLObjectList object enumerates SQL Server user-defined tables.

SQLDMOObj_View

4

Returned SQLObjectList object enumerates SQL Server views.

When setting SortBy, specify SQLObjectList member order by using these values.

Constant Value Description

SQLDMOObjSort_Date

3

Objects in the list are ordered by creation date.

SQLDMOObjSort_Name

0

Default. Objects in the list are ordered by name.

SQLDMOObjSort_Owner

2

Objects in the list are ordered by owner name.

SQLDMOObjSort_Type

1

Objects in the list are ordered by type.

Returns

A SQLObjectList object that contains 0 or more DBObject objects.

Applies To:

Database Object