Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 2.77 KB

File metadata and controls

43 lines (31 loc) · 2.77 KB
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
updatefrequency5
helpviewer_keywords
publishing [SQL Server replication], stored procedure execution
stored procedures [SQL Server replication], publishing
monikerRange =azuresqldb-mi-current||>=sql-server-2016

Publish Execution of Stored Procedure in Transactional Publication

[!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.

To publish the execution of a stored procedure

  1. On the Articles page of the New Publication Wizard or the Publication Properties - <Publication> dialog box, select a stored procedure.

  2. Click Article Properties, and then click Set Properties of Highlighted Stored Procedure.

  3. 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.

  4. Select OK.

  5. If you are in the Publication Properties - <Publication> dialog box, click OK to save and close the dialog box.

Related content