Collapse the table of content
Expand the table of content


SQL Server 2000

Treats the first client that runs sp_replcmds within a given database as the log reader. Returns the commands for transactions marked for replication. This stored procedure is executed at the Publisher on the publication database.


sp_replcmds [ @maxtrans = ] maxtrans


[@maxtrans =] maxtrans

Is the number of transactions to return information about. maxtrans is int, with a default of 1, which specifies the next transaction waiting for distribution.

Result Sets

sp_replcmds is used by the log reader process. It returns information about the publication database from which it is executed. It allows you to view transactions that currently are not distributed (those transactions remaining in the transaction log that have not been sent to the Distributor) with their commands, and it returns article ID, partial_command (true or false), the command, page, row, and timestamp.


sp_replcmds is used in transactional replication.

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.

Note  The sp_replcmds procedure should be run only to troubleshoot problems with replication.

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.


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

See Also

Error Messages




System Stored Procedures

© 2015 Microsoft