Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
sp_replshowcmds (Transact-SQL)
Collapse the table of content
Expand the table of content

sp_replshowcmds (Transact-SQL)

Applies To: SQL Server 2014, SQL Server 2016 Preview

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Returns the commands for transactions marked for replication in readable format. sp_replshowcmds can be run only when client connections (including the current connection) are not reading replicated transactions from the log. This stored procedure is executed at the Publisher on the publication database.

Topic link icon Transact-SQL Syntax Conventions

sp_replshowcmds [ @maxtrans = ] maxtrans

[ @maxtrans = ] maxtrans

Is the number of transactions about which to return information. maxtrans is int, with a default of 1, which specifies the maximum number of transactions pending replication for which sp_replshowcmds returns information.

sp_replshowcmds is a diagnostic procedure that returns information about the publication database from which it is executed.

Column name

Data type




Sequence number of the command.



ID of the command originator, always 0.



ID of the Publisher database, always 0.



ID of the article.



Type of command.



Transact-SQL command.

sp_replshowcmds is used in transactional replication.

Using sp_replshowcmds, you can view transactions that currently are not distributed (those transactions remaining in the transaction log that have not been sent to the Distributor).

Clients that run sp_replshowcmds and sp_replcmds within the same database receive error 18752.

To avoid this error, the first client must disconnect or the role of the client as log reader must be released by executing sp_replflush. After all clients have disconnected from the log reader, sp_replshowcmds can be run successfully.

Note Note

sp_replshowcmds should be run only to troubleshoot problems with replication.

Only members of the sysadmin fixed server role or the db_owner fixed database role can execute sp_replshowcmds.

Community Additions

© 2015 Microsoft