Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSrecordsnapshotdeliveryprogress

  No additional text.


Syntax

-- Name: sp_MSrecordsnapshotdeliveryprogress

-- Description: This procedure is used by the distribution agent or the merge
--              agent to record a snapshot delivery work item that has been
--              applied to a subscriber database in the
--              MSsnapshotdeliveryprogress table. In the event of restarting
--              an interrupted snapshot delivery process, the distribution or
--              merge agent can use the information stored in the
--              MSsnapshotdeliveryprogress table to avoid redoing snapshot
--              delivery processing that has already been applied to the
--              subscriber.

-- Note: This procedure should only be called by the distribution agent or
--       the merge agent at the subscriber database.

-- Parameters: @snapshot_session_token nvarchar(260) (mandatory)
--               - a UniCode string that uniquely identifies a snapshot
--                 delivery session. For now, this will be a the full folder
--                 path of the particular snapshot being applied (hence the
--                 260 characters size).
--             @snapshot_progress_token nvarchar(500) (mandatory)
--               - A unicode string that uniquely identifies a snapshot work
--                 item (schema creation, bulk-loading data) that has been
--                 applied to the subscriber.

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

-- Security: Execute permission of this procedure is granted to public;
--           procedural security check will be performed to make sure
--           that the caller is either a db_owner of the current database
--           or a sysadmin.

create procedure sys.sp_MSrecordsnapshotdeliveryprogress (
    @snapshot_session_token nvarchar(260),
    @snapshot_progress_token nvarchar(500)
    )
as
begin
    set nocount on
    set arithabort on
    declare @retcode int
    declare @snapshot_progress_token_hash int
    select @retcode = 0

    exec @retcode = sys.sp_MSreplcheck_subscribe
    if @retcode <> 0 or @@error <> 0
    begin
        select @retcode = 1
        goto FAILURE
    end

    if object_id('dbo.MSsnapshotdeliveryprogress') is null
    begin
        create table dbo.MSsnapshotdeliveryprogress
        (
           session_token nvarchar(260) not null,
           progress_token_hash int not null,
           progress_token nvarchar(500) not null,
           progress_timestamp datetime default getdate()
        )
        if @@ERROR <> 0
        begin
            select @retcode = 1
            goto FAILURE
        end
        create index ci_MSsnapshotdeliveryprogress_progress_token_hash
            on dbo.MSsnapshotdeliveryprogress(progress_token_hash)
        if @@ERROR <> 0
        begin
            select @retcode = 1
            goto FAILURE
        end
        create index nci_MSsnapshotdeliveryprogress_session_token
            on dbo.MSsnapshotdeliveryprogress(session_token)
        if @@ERROR <> 0
        begin
            select @retcode = 1
            goto FAILURE
        end
        exec @retcode = dbo.sp_MS_marksystemobject 'dbo.MSsnapshotdeliveryprogress'
        if @retcode <> 0 or @@ERROR <> 0
        begin
            select @retcode = 1
            goto FAILURE
        end
    end

    select @snapshot_progress_token_hash = sys.fn_repl32bitstringhash(@snapshot_progress_token)
    if @retcode <> 0 or @@ERROR <> 0
    begin
        select @retcode = 1
        goto FAILURE
    end

    if exists (select * from MSsnapshotdeliveryprogress
                where progress_token_hash = @snapshot_progress_token_hash
                  and progress_token = @snapshot_progress_token
                  and session_token = @snapshot_session_token)
    begin
        update MSsnapshotdeliveryprogress
           set progress_timestamp = getdate()
         where progress_token = @snapshot_progress_token
           and session_token = @snapshot_session_token
        if @@ERROR <> 0
        begin
            select @retcode = 1
            goto FAILURE
        end
    end
    else
    begin
        insert MSsnapshotdeliveryprogress
            values (
                @snapshot_session_token,
                @snapshot_progress_token_hash,
                @snapshot_progress_token,
                default)
        if @@ERROR <> 0
        begin
            select @retcode = 1
            goto FAILURE
        end
    end
    if @@ERROR <> 0
    begin
        select @retcode = 1
        goto FAILURE
    end

FAILURE:
    return @retcode
end

 
Last revision 2008RTM
See also

  sp_MSdroparticletombstones (Procedure)
sp_MSregisterdynsnapseqno (Procedure)
sp_MSregistermergesnappubid (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