sp_showpendingchanges (Transact-SQL)

適用於:SQL Server

傳回結果集,顯示正在等待復寫的變更。 這個預存程式會在發行集資料庫的發行者端和訂閱資料庫的訂閱者端執行。

Transact-SQL 語法慣例

注意

此程式提供變更數目的近似值,以及這些變更所涉及的數據列。 例如,程式會從「發行者」或「訂閱者」擷取資訊,但不會同時擷取資訊。 儲存在其他節點上的資訊可能會導致一組比程序估計較小的變更集進行同步處理。

語法

sp_showpendingchanges
    [ [ @destination_server = ] N'destination_server' ]
    [ , [ @publication = ] N'publication' ]
    [ , [ @article = ] N'article' ]
    [ , [ @show_rows = ] show_rows ]
[ ; ]

引數

[ @destination_server = ] N'destination_server'

套用復寫變更的伺服器名稱。 @destination_server為 sysname,預設值為 NULL

[ @publication = ] N'publication'

發行集的名稱。 @publication為 sysname,預設值為 NULL。 指定@publication,結果只會限製為指定的發行集。

[ @article = ] N'article'

發行項的名稱。 @article為 sysname,預設值為 NULL。 指定@article,結果只會限製為指定的發行項。

[ @show_rows = ] show_rows

指定結果集是否包含有關暫止變更的更特定資訊。 @show_rows為 int,預設值為 0。 如果指定了的值 1 ,結果集會包含 資料 is_delete 列和 rowguid

結果集

資料行名稱 資料類型 描述
destination_server sysname 正在復寫變更的伺服器名稱。
pub_name sysname 發行集的名稱。
destination_db_name sysname 要復寫變更的資料庫名稱。
is_dest_subscriber bit 指出變更正在復寫至訂閱者。 的值 1 表示變更正在復寫至訂閱者。 0 表示變更正在復寫至發行者。
article_name sysname 產生變更之數據表的發行項名稱。
pending_deletes int 等候複寫的刪除數目。
pending_ins_and_upd int 等候複寫的插入和更新數目。
is_delete bit 指出擱置中的變更是否為刪除。 的值 1 表示變更為刪除。 @show_rows 需要的值1
rowguid uniqueidentifier 識別已變更之數據列的 GUID。 @show_rows 需要的值1

傳回碼值

0 (成功) 或 1 (失敗)。

備註

sp_showpendingchanges 用於合併式複寫。

sp_showpendingchanges 用於針對合併式複寫進行疑難解答時。

的結果 sp_showpendingchanges 不包含層代 0 中的數據列。

當針對 @article 指定的發行項不屬於針對 @publication 指定的發行集時,會針對 pending_deletespending_ins_and_upd傳回 的計數0

權限

只有系統管理員固定伺服器角色或db_owner固定資料庫角色的成員才能執行 sp_showpendingchanges