> ## Documentation Index
> Fetch the complete documentation index at: https://rajanand.org/llms.txt
> Use this file to discover all available pages before exploring further.

# How to find which command has failed in SQL Server Replication?

To find out the list of replicated transaction, query the `MSrepl_transactions` table in `distribution` database. Copy the sequence number of the transaction (i.e., `xact_seqno` ) which entered the distribution database last.

```sql theme={"system"}
SELECT top 1 
entry_time AS trans_entry_time_in_dist_db,
publisher_database_id,
xact_id,
xact_seqno
FROM distribution.dbo.MSrepl_transactions
ORDER BY entry_time DESC
```

Copy the xact\_seqno from previous query and replace it in `@xact_seqno_start` below.

```sql theme={"system"}
EXEC distribution.dbo.sp_browsereplcmds 
@xact_seqno_start = '0x0005B68700176AEC000C' 
--replace the xact_seqno from the previous query
```

Sample output:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1652508368085/cbRAhjNWm.png)

You will be able to see the command that failed and debug further.

If you just want to see the error message or other queries that are useful to monitor and debug the replication issues, you can refer [this](https://blog.rajanand.org/sql-server-replication-queries#heading-replication-alerts) blog post.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.