Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSpurgepartialmergesnapshot

  No additional text.


Syntax

-- Name: sp_MSpurgepartialmergesnapshot

-- Description: This procedure is used for cleaning up the merge snapshot
--              delivery progress and the associated merge meta-data for
--              a specific publication.

-- Parameters: @pubid uniqueidentifier (mandatory)

-- Returns: 0 - succeeded
--          1 - failed

-- Security: This is an internal system object.

create procedure sys.sp_MSpurgepartialmergesnapshot (
    @pubid uniqueidentifier
    )
as
begin
    set nocount on
    declare @retcode int
    declare @transaction_opened bit
    declare @snapshot_session_token nvarchar(260)
    declare @snapshot_progress_token_hash int
    declare @snapshot_progress_token nvarchar(500)
    declare @pubidprefix nvarchar(100)

    select @retcode = 0
    select @transaction_opened = 0

    begin transaction
    save transaction sp_MSpurgepartialmergesnapshot
    if @@error<>0 or @retcode<>0 begin select @retcode=1 goto Failure end
    select @transaction_opened = 1

    if object_id('dbo.MSsnapshotdeliveryprogress', 'U') is not null
    begin
        select @snapshot_session_token = null
        select @pubidprefix = N':'
        select @snapshot_progress_token = @pubidprefix +  convert(nvarchar(100), @pubid)
        select @snapshot_progress_token_hash = sys.fn_repl32bitstringhash(@snapshot_progress_token)
        if @@error<>0 or @retcode<>0 begin select @retcode=1 goto Failure end

        select @snapshot_session_token = session_token
          from dbo.MSsnapshotdeliveryprogress
         where progress_token_hash = @snapshot_progress_token_hash
           and progress_token = @snapshot_progress_token
        if @@error<>0 or @retcode<>0 begin select @retcode=1 goto Failure end

        if @snapshot_session_token is not null
        begin
            delete from dbo.MSsnapshotdeliveryprogress
             where session_token = @snapshot_session_token
            if @@error<>0 or @retcode<>0 begin select @retcode=1 goto Failure end
        end
    end

    exec @retcode = sys.sp_MSCleanupForPullReinitWithPubId @pubid = @pubid
    if @@error<>0 or @retcode<>0 begin select @retcode=1 goto Failure end

    commit transaction
    if @@error<>0 or @retcode<>0 begin select @retcode=1 goto Failure end
    select @transaction_opened = 0

Failure:

    if @transaction_opened = 1
    begin
        rollback transaction sp_MSpurgepartialmergesnapshot
        commit transaction
    end
    return @retcode
end

 
Last revision 2008RTM
See also

  sp_MSregisterdynsnapseqno (Procedure)
sp_MSregistermergesnappubid (Procedure)
sp_MStrypurgingoldsnapshotdeliveryprogress (Procedure)
sp_resetsnapshotdeliveryprogress (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash