Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSscriptpublicationconflicttables

  No additional text.


Syntax

-- Name: sp_MSscriptpublicationconflicttables

-- Description: This is a helper stored procedure for scripting out conflict
--              tables for all (or just one) table articles in a publication.

-- Parameter: @publication sysname (mandatory)

-- Notes:1) This procedure assumes the #scripttext temporary table has been
--       pre-created by the caller.
--       2) Since this is an internal procedure, parameter checking is minimal

-- Security: This is an internall system procedure.

create procedure sys.sp_MSscriptpublicationconflicttables (
    @publication    sysname,
    @article        sysname = N'all'
    )
as
begin
    set nocount on
    declare @retcode          int,
            @cursor_allocated bit,
            @cursor_opened    bit,
            @pubid            int,
            @current_article  sysname


    -- Initializations
    select @retcode = 0,
           @cursor_allocated = 0,
           @cursor_opened = 0,
           @pubid = NULL
    if @@error <> 0 or @retcode <> 0 begin select @retcode = 1 goto Failure end

    select @pubid = pubid
      from dbo.syspublications
     where name = @publication
    if @@error <> 0 or @retcode <> 0 begin select @retcode = 1 goto Failure end
    if @pubid is null
    begin
        raiserror(20026, 16, -1, @publication)
        return 1
    end

    -- Open cursor through all table articles in the specified publication
    -- and script out conflict table

    declare harticle cursor local fast_forward for
        select name
          from dbo.sysarticles
         where pubid = @pubid
           and (type & 1) <> 0
           and (@article = N'all' or name = @article)
    if @@error <> 0 or @retcode <> 0 begin select @retcode = 1 goto Failure end
    select @cursor_allocated = 1

    open harticle
    if @@error <> 0 or @retcode <> 0 begin select @retcode = 1 goto Failure end
    select @cursor_opened = 1

    fetch harticle into @current_article

    while (@@fetch_status<>-1)
    begin

        insert into #scripttext(line)
            exec @retcode = sys.sp_scriptsubconflicttable
                @publication = @publication
                ,@article = @current_article
        -- Insert go
        insert into #scripttext (line) values ('GO')
        fetch harticle into @current_article
    end

Failure:

    if @cursor_opened <> 0
    begin
        close harticle
    end

    if @cursor_allocated <> 0
    begin
        deallocate harticle
    end
    return @retcode

end

 
Last revision 2008RTM
See also

  sp_MSdrop_repltran (Procedure)
sp_MSgeneratenosyncsubscriptionsetupscript (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