Enables or disables, at the session level, the replication of update, delete, insert select, or select into as SQL statements.
set repmode {“on” <SQLDML_option> | “never” | “off” | ‘threshold’, ‘<value>’}
<SQLDML_option> ::= { U | D | I | S }
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.
Enables SQL replication of DML operation specified.
Removes the session-level replication settings of SQL statements and returns to the database-level or table-level settings.
Specifies not to replicate SQL statements.
set repmode on 'DS'
set repmode never
set repmode on 'U' go sp_setrepdefmode tabname, on, 'UDI' go
This example shows how to define the threshold at the session-level as 1000 rows:
set repmode ‘threshold’, ‘1000’ go
You can set the session-level options either at login by using a “login trigger”, or at the beginning of a batch. Your session settings overwrites the table or database settings.
Session-level settings are active only for the duration of the session. When you set the options inside a stored procedure or a trigger, the settings are reverted back to the table-level or database-level settings when the stored procedure or trigger execution terminates.