次の方法で共有


PreSnapshotScript Property

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

The PreSnapshotScript property specifies the complete path and file name of a Transact-SQL script that runs before an initial snapshot is applied to a Subscriber.

構文

object
.PreSnapshotScript [= value]

Parts

  • object
    An expression that evaluates to an object in the Applies To list
  • value
    A string that specifies the complete path and file name of the Transact-SQL script

Data Type

String

Modifiable

Read/write

Prototype (C/C++)

HRESULT GetPreSnapshotScript(SQLDMO_LPBSTR pRetVal);
HRESULT SetPreSnapshotScript(SQLDMO_LPCSTR NewValue);

解説

Running Transact-SQL scripts before an initial snapshot is applied can be used to:

  • Perform presnapshot cleanup.
  • Add users and permissions to databases to be replicated.
  • Create user-defined data types.
    ms133566.note(ja-jp,SQL.90).gifメモ :
    If PreSnapshotScript is set, the script automatically runs when a subscription is reinitialized. Therefore, the script must be written so that its statements are repeatable.
    If an application sets **PreSnapshotScript** after the initial snapshot has been created, a new snapshot must be generated. Snapshots are applied when the next scheduled snapshot agent runs.

You can also run Transact-SQL scripts during a replication operation using the ReplicateUserDefinedScript method.

ms133566.note(ja-jp,SQL.90).gifメモ :
If an application calls PreSnapshotScript 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
ReplicateUserDefinedScript Method

その他の技術情報

スナップショット適用前および適用後のスクリプトの実行

ヘルプおよび情報

SQL Server 2005 の参考資料の入手