List all tables that are currently published for replication MS-SQL

73,415

Solution 1

Yes:

SELECT *
FROM sys.tables
WHERE is_replicated = 1

From MSDN for is_replicated field:

1 = Table is published using snapshot replication or transactional replication.

Solution 2

It's possible to query the distribution database to see what articles (tables/views/objects...) are published and which Publication they are from.

SELECT
     P.[publication]   AS [Publication Name]
    ,A.[publisher_db]  AS [Database Name]
    ,A.[article]       AS [Article Name]
    ,A.[source_owner]  AS [Schema]
    ,A.[source_object] AS [Object]
FROM
    [distribution].[dbo].[MSarticles] AS A
    INNER JOIN [distribution].[dbo].[MSpublications] AS P
        ON (A.[publication_id] = P.[publication_id])
ORDER BY
    P.[publication], A.[article];
Share:
73,415
Admin
Author by

Admin

Updated on September 29, 2020

Comments

  • Admin
    Admin over 3 years

    I need to get a list of all tables that are published for replication from MS-SQL databases. Is there a system stored procedure or a query I could run to generate such a list?