sp_replcmds (Transact-SQL)
Returns the commands for transactions marked for replication. This stored procedure is executed at the Publisher on the publication database.
Important |
|---|
The sp_replcmds procedure should be run only to troubleshoot problems with replication. |
Column name | Data type | Description |
|---|---|---|
article id | int | The ID of the article. |
partial_command | bit | Indicates whether this is a partial command or not. |
command | varbinary(1024) | The command value. |
xactid | binary(10) | Transaction ID. |
xact_seqno | varbinary(16) | The transaction sequence number. |
publication_id | int | The ID of the publication. |
command_id | int | ID of the command in MSrepl_commands. |
command_type | int | Type of command. |
originator_srvname | sysname | Server where the transaction originated. |
originator_db | sysname | Database where the transaction originated. |
pkHash | int | Internal use only. |
originator_publication_id | int | ID of the publication where the transaction originated. |
originator_db_version | int | Version of the database where the transaction originated. |
originator_lsn | varbinary(16) | Identifies the log sequence number (LSN) for the command in the originating publication. |
sp_replcmds is used by the log reader process in transactional replication.
Replication treats the first client that runs sp_replcmds within a given database as the log reader.
This procedure can generate commands for owner-qualified tables or not qualify the table name (the default). Adding qualified table names allows replication of data from tables owned by a specific user in one database to tables owned by the same user in another database.
Note |
|---|
Because the table name in the source database is qualified by the owner name, the owner of the table in the target database must be the same owner name. |
Clients who attempt to run sp_replcmds within the same database receive error 18752 until the first client disconnects. After the first client disconnects, another client can run sp_replcmds, and becomes the new log reader.
A warning message number 18759 is added to both the Microsoft SQL Server error log and the Microsoft Windows application log if sp_replcmds is unable to replicate a text command because the text pointer was not retrieved in the same transaction.

Important