| title | Publish execution of stored procedure (Transactional) | ||
|---|---|---|---|
| description | Learn how to publish the execution of stored procedures using SQL Server Management Studio. | ||
| author | MashaMSFT | ||
| ms.author | mathoma | ||
| ms.date | 09/25/2024 | ||
| ms.service | sql | ||
| ms.subservice | replication | ||
| ms.topic | how-to | ||
| ms.custom |
|
||
| helpviewer_keywords |
|
||
| monikerRange | =azuresqldb-mi-current||>=sql-server-2016 |
[!INCLUDEsql-asdbmi] Specify that the execution of a stored procedure (rather than just its definition) should be published in the Article Properties - <Article> dialog box. This dialog box is available in the New Publication Wizard and the Publication Properties - <Publication> dialog box. For more information about using the wizard and accessing the dialog box, see Create a Publication and View and Modify Publication Properties.
The definition of the procedure (the CREATE PROCEDURE statement) is replicated to the Subscriber when the subscription is initialized; when the procedure is executed at the Publisher, replication executes the corresponding procedure at the Subscriber.
-
On the Articles page of the New Publication Wizard or the Publication Properties - <Publication> dialog box, select a stored procedure.
-
Click Article Properties, and then click Set Properties of Highlighted Stored Procedure.
-
In the Article Properties - <Article> dialog box, specify one of the following values for the Replicate option:
-
Execution of the stored procedure
-
Execution in a serialized transaction of the SP
This is the recommended option, because it replicates the procedure execution only if the procedure is executed within the context of a serializable transaction. If the stored procedure is executed outside of a serializable transaction, changes to data in published tables are replicated as a series of data manipulation language (DML) statements.
-
-
Select OK.
-
If you are in the Publication Properties - <Publication> dialog box, click OK to save and close the dialog box.