共用方式為


PostSnapshotScript Property

未來的 Microsoft SQL Server 發行版本將不再提供此功能。請避免在新的開發工作中使用此功能,並計劃修改目前使用此功能的應用程式。

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

語法

object
.PostSnapshotScript [= 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 GetPostSnapshotScript(SQLDMO_LPBSTR pRetVal);
HRESULT SetPostSnapshotScript(SQLDMO_LPCSTR NewValue);

備註

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

  • Set up reporting environments that depend on stored procedures.
  • Create custom views.
  • Create user-defined functions.
    ms143940.note(zh-tw,SQL.90).gif附註:
    If PostSnapshotScript 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 **PostSnapshotScript** 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.

ms143940.note(zh-tw,SQL.90).gif附註:
If an application calls PostSnapshotScript 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

請參閱

參考

PreSnapshotScript Property
ReplicateUserDefinedScript Method

其他資源

在套用快照集的前後執行指令碼

說明及資訊

取得 SQL Server 2005 協助