List all tables that are currently published for replication MS-SQL
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];
精彩评论