Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Permalink
live
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_marksubscriptionvalidation (Transact-SQL)
sp_marksubscriptionvalidation (Transact-SQL)
markingmyname
maghan
03/16/2017
sql
replication
reference
sp_marksubscriptionvalidation
sp_marksubscriptionvalidation_TSQL
sp_marksubscriptionvalidation
TSQL

sp_marksubscriptionvalidation (Transact-SQL)

[!INCLUDE SQL Server]

Marks the current open transaction to be a subscription-level validation transaction for the specified subscriber. This stored procedure is executed at the Publisher on the publication database.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

  
sp_marksubscriptionvalidation [ @publication = ] 'publication'  
        , [ @subscriber = ] 'subscriber'  
        , [ @destination_db = ] 'destination_db'  
    [ , [ @publisher = ] 'publisher' ]  

Arguments

[ @publication = ] 'publication' Is the name of the publication. publication is sysname, with no default.

[ @subscriber = ] 'subscriber' Is the name of the Subscriber. subscriber is sysname, with no default.

[ @destination_db = ] 'destination_db' Is the name of the destination database. destination_db is sysname, with no default.

[ @publisher = ] 'publisher' Specifies a non- [!INCLUDEmsCoName] [!INCLUDEssNoVersion] Publisher. publisher is sysname, with a default of NULL.

[!NOTE]
publisher should not be used for a publication that belongs to a [!INCLUDEssNoVersion] Publisher.

Return Code Values

0 (success) or 1 (failure)

Remarks

sp_marksubscriptionvalidation is used in transactional replication.

sp_marksubscriptionvalidation does not support non- [!INCLUDEssNoVersion] Subscribers.

For non- [!INCLUDEssNoVersion] Publishers, you cannot execute sp_marksubscriptionvalidation from within an explicit transaction. This is because explicit transactions are not supported over the linked server connection used to access the Publisher.

sp_marksubscriptionvalidation must be used together with sp_article_validation (Transact-SQL), specifying a value of 1 for subscription_level, and can be used with other calls to sp_marksubscriptionvalidation to mark the current open transaction for other subscribers.

Permissions

Only members of the sysadmin fixed server role or db_owner fixed database role can execute sp_marksubscriptionvalidation.

Example

The following query can be applied to the publishing database to post subscription-level validation commands. These commands are picked up by the Distribution Agents of specified Subscribers. Note that the first transaction validates article 'art1', while the second transaction validates 'art2'. Also note that the calls to sp_marksubscriptionvalidation and sp_article_validation (Transact-SQL) have been encapsulated in a transaction. We recommend only one call to sp_article_validation (Transact-SQL) per transaction. This is because sp_article_validation (Transact-SQL) holds a shared table lock on the source table for the duration of the transaction. You should keep the transaction short to maximize concurrency.

begin tran  
  
exec sp_marksubscriptionvalidation @publication = 'pub1',  
 @subscriber = 'Sub', @destination_db = 'SubDB'  
  
exec sp_marksubscriptionvalidation @publication = 'pub1',  
 @subscriber = 'Sub2', @destination_db = 'SubDB'  
  
exec sp_article_validation @publication = 'pub1', @article = 'art1',  
 @rowcount_only = 0, @full_or_fast = 0, @shutdown_agent = 0,  
 @subscription_level = 1  
  
commit tran  
  
begin tran  
  
exec sp_marksubscriptionvalidation @publication = 'pub1',  
 @subscriber = 'Sub', @destination_db = 'SubDB'  
  
exec sp_marksubscriptionvalidation @publication = 'pub1',  
 @subscriber = 'Sub2', @destination_db = 'SubDB'  
  
exec sp_article_validation @publication = 'pub1', @article = 'art2',  
 @rowcount_only = 0, @full_or_fast = 0, @shutdown_agent = 0,  
 @subscription_level = 1  
  
commit tran  

See Also

System Stored Procedures (Transact-SQL)
Validate Replicated Data