set repmode

Description

set repmode on enables SQL statement replication for the DML operation specified, for the duration of the session. It overrides SQL statement configuration at database and table level.

Syntax

set repmode on '{UDIS}' | off | never 

Parameters

Examples

Example 1 To replicate only select into and delete as SQL statements for the duration of the session, use:

set repmode on 'DS' 

Example 2 To disable SQL statement replication for the duration of the session, regardless of the database or table-level settings, use:

set repmode never

Example 3 This example illustrates how session-level settings override object-level settings. This example replicates only update statements using SQL statement replication:

set repmode on 'U'
go
sp_setrepdefmode tabname, on, 'UDI'
go

Permissions

Only a system administrator, database owner, or user with replication_role can execute set repmode.

Usage

The default value of set repmode is off.

To override table and database settings, set session-level options either at login using a “login trigger”, or at the beginning of a batch. Session-level parameters are active only for the duration of the session. When you set options from inside a stored procedure or trigger, the option setting is reverted once the stored procedure or trigger has finished executing.

NoteThe set options have no effect when a stored procedure is marked for replication. In such cases, only the call to the stored procedure is replicated.