共用方式為


AddObjectByName Method

未來的 Microsoft SQL Server 版本將移除這項功能。請避免在新的開發工作中使用這項功能,並規劃修改目前使用這項功能的應用程式。

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.

語法

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.

備註

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: