The ListObjects method returns a SQLObjectList object enumerating the system and user-defined objects defining the database referenced.
object.ListObjects( [ ObjectType ] , [ SortBy ] ) as SQLObjectList
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list. |
ObjectType | Optional. A long integer constraining list membership to objects of the type(s) specified as described in Settings |
SortBy | Optional. A long integer specifying list membership ordering as described in Settings. |
The ObjectType argument is a bit-packed long integer. Specify more than a single database object type by using an Or to combine the values below.
Constant | Value | Description |
---|---|---|
SQLDMOObj_AllDatabaseObjects | 511 | Default. Returned SQLObjectList object enumerates Microsoft® SQL Server™ system and user database objects. |
SQLDMOObj_ AllDatabaseUserObjects |
509 | 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 |
1 | Returned SQLObjectList object enumerates SQL Server user-defined data types. |
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. |
A SQLObjectList object containing 0 or more DBObject objects.
HRESULT ListObjects(
LPSQLDMODBOBJECTLIST* ppList,
SQLDMO_OBJECT_TYPE lObjectTypes = SQLDMOObj_AllDatabaseObjects,
SQLDMO_OBJSORT_TYPE SortBy = SQLDMOObjSort_Name);