Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSrefreshdynamicsnapshotlocations

  No additional text.


Syntax
create procedure sys.sp_MSrefreshdynamicsnapshotlocations (
    @pubid uniqueidentifier
)
as
    set nocount on

    -- This should not be a public proc
    declare @retcode int
    declare @distributor sysname
    declare @distribdb sysname
    declare @rpcsrvname sysname
    declare @distproc nvarchar(4000)
    declare @publisher sysname
    declare @publisher_db sysname
    declare @publication sysname
    declare @suser_sname sysname
    declare @host_name sysname
    declare @partition_id int
    declare @dynamic_snapshot_location nvarchar(255)

    --exec @retcode = sys.sp_MSreplcheck_publish
    --if @@error<>0 or @retcode<>0
    --    return 1

    select @publisher = upper(publishingservername())
    select @publisher_db = db_name()
    select @publication = name from dbo.sysmergepublications where pubid = @pubid
    if @publication is NULL
    begin
        raiserror (21402, 11, -1, '@pubid')
        return (1)
    end

    -- Get distributor information for RPC
    exec @retcode = sys.sp_MSrepl_getdistributorinfo @distributor = @distributor output,
                                           @distribdb = @distribdb output,
                                           @rpcsrvname = @rpcsrvname output
    if @@error <> 0 or @retcode <> 0
        return (1)

    select @distproc = quotename(rtrim(@rpcsrvname)) + N'.' + quotename(@distribdb) + N'.' + N'dbo.sp_MSchangedynsnaplocationatdistributor'

    declare hDynamicSnapshotsCursor cursor local fast_forward for
        select partition_id, dynamic_filter_login, dynamic_filter_hostname
          from MSdynamicsnapshotjobs
          where pubid = @pubid and computed_dynsnap_location = 1
    if @@error <> 0
        return 1

    open hDynamicSnapshotsCursor
    if @@error <> 0
        return 1

    fetch hDynamicSnapshotsCursor into @partition_id, @suser_sname, @host_name

    begin transaction
    save transaction sp_MSrefreshdynsnaplocation

    while (@@fetch_status <> -1)
    begin
        exec @retcode = sys.sp_MSgetpartitionsnapshotfolder
                                    @publication,
                                    @suser_sname,
                                    @host_name,
                                    @partition_id,
                                    @dynamic_snapshot_location output
        if @@error <> 0 or @retcode <> 0
        begin
            raiserror(20631, 16, -1)
            goto CursorFailure
        end

        exec @retcode = @distproc
            @publisher = @publisher,
            @publisher_db = @publisher_db,
            @publication = @publication,
            @dynamic_filter_login = @suser_sname,
            @dynamic_filter_hostname = @host_name,
            @dynamic_snapshot_location = @dynamic_snapshot_location
        if @@error <> 0 or @retcode <> 0
            goto CursorFailure

        update MSdynamicsnapshotjobs
            set dynamic_snapshot_location = @dynamic_snapshot_location
            where pubid = @pubid and partition_id = @partition_id
        if @@error <> 0
            goto CursorFailure

        fetch hDynamicSnapshotsCursor into @partition_id, @suser_sname, @host_name
    end

    commit transaction
    close hDynamicSnapshotsCursor
    deallocate hDynamicSnapshotsCursor		
    return 0

CursorFailure:

    rollback transaction sp_MSrefreshdynsnaplocation
    commit transaction
    close hDynamicSnapshotsCursor
    deallocate hDynamicSnapshotsCursor
    raiserror(20726, 16, -1)
    return 1

 
Last revision 2008RTM
See also

  sp_changemergepublication (Procedure)
sp_MSchangedynsnaplocationatdistributor (Procedure)
sp_MSdrop_rladmin (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