Partilhar via


AddObjectByName 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 AddObjectByName method appends the database object named to the list of those objects copied when the Transfer method of the Database object is used to copy database schema or data.

Syntax

object
.AddObjectByName(
Object 
, 
ObjectType
, [ Owner ] )

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • Object
    String that specifies an existing Microsoft SQL Server database object by name.
  • ObjectType
    Long integer that specifies the object type named as described in Settings.
  • Owner
    Optional. String that specifies an existing database user by name. When specified, restricts the method to add only an object owned by the user.

Prototype (C/C++)

HRESULT AddObjectByName(
SQLDMO_LPCSTR szObject,
SQLDMO_OBJECT_TYPE ObjectType
SQLDMO_LPCSTR szOwner = NULL);

Settings

Specify the value of the ObjectType argument by using these SQLDMO_OBJECT_TYPE values.

Constant Value Description

SQLDMOObj_AllButSystemObjects

5119

List or query result set membership includes all but SQL Server system objects.

SQLDMOObj_AllDatabaseObjects

4607

Database objects added include Microsoft SQL Server system and user database objects.

SQLDMOObj_/AllDatabaseUserObjects

4605

Database objects added include only user database objects.

SQLDMOObj_Default

64

Database object added is a SQL Server default.

SQLDMOObj_Rule

128

Database object added is a SQL Server rule.

SQLDMOObj_StoredProcedure

16

Database object added is a stored procedure.

SQLDMOObj_Trigger

256

Database object added is a trigger.

SQLDMOObj_/UserDefinedDatatype

4096

Database object added is a SQL Server user-defined data type.

SQLDMOObj_UserDefinedFunction

1

Database object added is a user-defined function.

SQLDMOObj_UserTable

8

Database object added is a user-defined table.

SQLDMOObj_View

4

Database object added is a view.

Remarks

SQL Distributed Management Objects (SQL-DMO) implements copying of database schema and data by using the Transfer object and methods implemented on the Database object. The Transfer object is used to define what database objects are affected by the copy and how the copy is performed. Use the AddObject and AddObjectByName methods to add database objects to those affected by the copy.

Applies to:

Transfer Object