List of articles in the replication
Satheesh Kumar
Satheesh Kumar
MS SQL Server Database Administration | Azure SQL Managed Instance & Databases | Microsoft Azure
Sometimes we need to retrieve the list of articles added into a replication through a T-SQL Query. When run on the publication database, the script below will provide the list of articles and subscriber details.
SELECT SERVERPROPERTY('ServerName') AS 'Publisher Server Name
? ? ,DB_NAME() AS 'Publisher Database Name'
? ? ,pub.name AS 'Publication Name'
? ? ,OBJECT_SCHEMA_NAME(art.objid, db_id()) AS 'Schema Name'
? ? ,OBJECT_NAME(art.objid, db_id()) AS 'Table Name'
? ? ,sub.srvname 'Subscriber Server Name'
? ? ,sub.dest_db 'Subscriber DB Name'
FROM dbo.syspublications Pub
INNER JOIN dbo.sysarticles art ON pub.pubid = art.pubid
INNER JOIN dbo.syssubscriptions sub ON art.artid = sub.artid
ORDER BY pub.name
? ? ,sub.srvname
? ? GO'