ListOwnedObjects Method

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

The ListOwnedObjects method returns a SQLObjectList object that enumerates the user-defined objects owned by the user referenced by the User object.

Syntax

object.ListOwnedObjects( [ ObjectType ] , [ SortBy ] )as SQLObjectList

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 ListOwnedObjects(
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: