次の方法で共有


ReplicateUserDefinedScript Method

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

The ReplicateUserDefinedScript method replicates the execution of a user-defined script to the subscribers of the specified publication.

構文

object
.ReplicateUserDefinedScript( 
szScriptFilePath
)

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • szScriptFilePath
    As String.

Prototype (C/C++)

HRESULT ReplicateUserDefinedScript(SQLDMO_LPCSTR szScriptFilePath);

解説

An application can run Transact-SQL scripts during a replication operation using the ReplicateUserDefinedScript method. Transact-SQL scripts that run during a replication operation might be used to:

  • Create new stored procedures.
  • Assign permissions.
  • Create new logins.

The Log Reader Agent must to be running for the script to be replicated properly if transactional replication is used. Snapshot replication does not support the ReplicateUserDefinedScript method because the Log Reader Agent does not run in snapshot replication.

In both transactional and merge replication, the user-defined script is copied to the Distributor when ReplicateUserDefinedScript is first invoked. The Distribution or Merge Agent then applies the copy at the Distributor to the Subscriber. Therefore any modifications made to the specified script after the ReplicateUserDefinedScript method is invoked will have no bearing on the outcome of the subsequent script replication.

You can also run Transact-SQL scripts when the initial snapshot is created using the PostSnapshotScript and PreSnapshotScript properties.

ms135647.note(ja-jp,SQL.90).gifメモ :
If an application calls ReplicateUserDefinedScript on an instance of SQL Server version 7.0, the constant, SQLDMO_E_SQL80ONLY, and the message "This property or method requires Microsoft SQL Server 2000 or later" are returned.

Applies To:

MergePublication2 Object

TransPublication2 Object

参照

関連項目

PostSnapshotScript Property
PreSnapshotScript Property

ヘルプおよび情報

SQL Server 2005 の参考資料の入手