开发者

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

开发者 https://www.devze.com 2022-12-25 04:11 出处:网络
I need to get a list of all tables that are published for replication from MS-SQL dat开发者_开发知识库abases. Is there a system stored procedure or a query I could run to generate such a list?Yes:

I need to get a list of all tables that are published for replication from MS-SQL dat开发者_开发知识库abases. Is there a system stored procedure or a query I could run to generate such a list?


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.


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];
0

精彩评论

暂无评论...
验证码 换一张
取 消