Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSrepl_publicationsnapshotjobcontrol

  No additional text.


Syntax
create procedure sys.sp_MSrepl_publicationsnapshotjobcontrol
(
    @publication    sysname,
    @publisher      sysname,
    @action         tinyint
)
as
begin
    set nocount on

    declare @retcode        int
    declare @tranpub_found  bit
    declare @mergepub_found bit
    declare @dbname         sysname
    declare @start          tinyint

    set @retcode        = 0
    set @tranpub_found  = 0
    set @mergepub_found = 0
    set @dbname         = db_name()
    set @start          = 0

    if @publisher is null
        set @publisher = publishingservername()

    exec @retcode = sys.sp_MSreplcheck_name @publication, '@publication', 'sp_MSrepl_publicationsnapshotjobcontrol'
    if @@error <> 0 or @retcode <> 0 begin set @retcode = 1 return @retcode end

    exec @retcode = sys.sp_MSreplcheck_publish
    if @@error <> 0 or @retcode <> 0 begin set @retcode = 1 return @retcode end

    if sys.fn_MSrepl_ispublished(@dbname) != 1
    begin
        raiserror (18757, 16, -1)
        return (1)
    end

    if sys.fn_MSrepl_istranpublished(@dbname, 1) = 1
    begin
        if exists (select * from dbo.syspublications where name = @publication)
        begin
            set @tranpub_found = 1
        end
    end

    if sys.fn_MSrepl_ismergepublished(@dbname) = 1
    begin
        if exists (select * from dbo.sysmergepublications where name = @publication and publisher_db = @dbname and upper(publisher) = upper(@publisher))
        begin
            set @mergepub_found = 1
        end
    end

    if @tranpub_found = 0 and @mergepub_found = 0
    begin
        raiserror (15001, 11, -1, @publication)
        return (1)
    end

    declare @distributor    sysname
    declare @distribdb      sysname
    declare @dist_rpcname   sysname
    declare @distproc       nvarchar(4000)
    declare @pubtype        sysname

    set @distproc = N''
    set @pubtype = null

    exec @retcode = sys.sp_MSrepl_getdistributorinfo
            @publisher = @publisher,
            @distributor = @distributor output,
            @distribdb = @distribdb output,
            @rpcsrvname = @dist_rpcname output,
            @publisher_type = @pubtype output
    if @@error <> 0 or @retcode <> 0 begin set @retcode = 1 return @retcode end

    if (@publisher is not null) and (@pubtype is null or @distribdb is null or @distributor is null)
    begin
        raiserror (21600, 16, -1, @publisher)
        return (1)
    end

    set @distproc = quotename(rtrim(@dist_rpcname)) + '.' + quotename(@distribdb) + case when @action = @start then '.sys.sp_MSstartsnapshot_agent' else '.sys.sp_MSstopsnapshot_agent' end
    exec @retcode = @distproc
                    @publisher = @publisher,
                    @publisher_db = @dbname,
                    @publication = @publication
    return @retcode

end

 
Last revision 2008RTM
See also

  sp_MSdrop_replcom (Procedure)
sp_startpublication_snapshot (Procedure)
sp_stoppublication_snapshot (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