28

我需要获取为从 MS-SQL 数据库复制而发布的所有表的列表。我可以运行系统存储过程或查询来生成这样的列表吗?

4

2 回答 2

37

是的:

SELECT *
FROM sys.tables
WHERE is_replicated = 1

MSDN获取 is_replicated 字段:

1 = 使用快照复制或事务复制发布表。

于 2010-03-29T17:19:02.370 回答
23

可以查询distribution数据库以查看发布了哪些文章(表/视图/对象...)以及它们来自哪个出版物。

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];
于 2014-05-16T13:20:31.517 回答