set repmode

Description

Enables or disables, at the session level, the replication of update, delete, insert select, or select into as SQL statements.

Syntax

set repmode {“on” SQLDML_option | “never” | “off”}
SQLDML_option ::= { U | D | I | S }

Parameters

SQLDML_option

Any combination of these DML operations:

  • U – update

  • D – delete

  • I – insert select

  • S – select into

SQL replication settings defined using set repmode overrides those defined using sp_setrepdbmode or sp_setrepdefmode.

on

Enables SQL replication of DML operation specified.

off

Removes the session-level replication settings of SQL statements and returns to the database-level or table-level settings.

never

Specifies not to replicate SQL statements.

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

Usage

See also

sp_setrepdbmode, sp_setrepdefmode