Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSResetTriggerProcs

  No additional text.


Syntax
create procedure sys.sp_MSResetTriggerProcs(
@qual_source_object nvarchar(540),
@pubid uniqueidentifier,
@article_level_only bit = 0,
@upgrade bit = 0
)
AS
declare @artid uniqueidentifier
declare @artname sysname
declare @retcode int
declare @objid int
declare @at_publisher bit
declare @publisher sysname
declare @publisher_db sysname
declare @pubname sysname
declare @len            int
declare @prec            int
declare @scale int
declare @typename nvarchar(270)
declare @command nvarchar(500)
declare @islightweight bit

select @objid = object_id(@qual_source_object)

-- Check whether the article is heavy- or lightweight.
select top 1 @islightweight= lightweight from dbo.sysmergearticles where objid=@objid

select @artid=artid, @artname=name from dbo.sysmergearticles where pubid=@pubid and objid=@objid
select @publisher=publisher, @pubname = name, @publisher_db=publisher_db from dbo.sysmergepublications where pubid=@pubid

select @at_publisher= 0

if 0=@islightweight
begin
    if upper(@publisher collate SQL_Latin1_General_CP1_CS_AS) = upper(publishingservername() collate SQL_Latin1_General_CP1_CS_AS) and
       @publisher_db=db_name()
    begin
        select @at_publisher= 1
    end
end

if @at_publisher = 1
begin
    /* By default, regenerate all the publication views, otherwise only for a give article */
    if (@article_level_only = 0)
    begin
        exec @retcode = sys.sp_MSpublicationview @publication = @pubname, @force_flag = 1
        if @@ERROR<>0 or @retcode <>0 return (1)
    end
    else
    begin
        exec @retcode = sys.sp_MSpublicationview @publication = @pubname, @force_flag = 2, @articlename = @artname
        if @@ERROR<>0 or @retcode <>0 return (1)
    end
end
else if 0=@islightweight -- Create the subscriber-side logical record views before creating merge triggers.
begin
	exec @retcode = sys.sp_MScreate_logical_record_views @pubid
    if @@ERROR<>0 or @retcode <>0 return (1)
end

exec @retcode = sys.sp_MSaddmergetriggers @qual_source_object
if @retcode<>0 or @@ERROR<>0 return (1)

/*
** Force the regeneration of merge procs for all publications that publish the current table
*/
if @at_publisher = 1
    exec @retcode= sys.sp_MSsetartprocs @publication=@pubname, @article=@artname, @force_flag=0, @pubid=@pubid
else  if @upgrade = 1  --this flag is only used when we call sp_vupgrade_mergeobjects codepath.
    exec @retcode = sys.sp_MSmakearticleprocs @pubid, @artid, 1
else
    exec @retcode = sys.sp_MSmakearticleprocs @pubid, @artid
if @retcode<>0 or @@ERROR<>0 return (1)

/*
** passing in one more parameter to sp_MSgetconflictinsertproc such that there is
** no select statement at the end of that SP as needed else where. The default is 1.
*/
exec @retcode= sys.sp_MSgetconflictinsertproc @artid, @pubid, 0, 1
if @retcode<>0 or @@ERROR<>0 return (1)

return (0)

 
Last revision 2008RTM
See also

  sp_MSchange_mergearticle (Procedure)
sp_MScreate_logical_record_views (Procedure)
sp_MSmerge_altertable (Procedure)
sp_vupgrade_mergeobjects (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