Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_changemergelogsettings

  No additional text.


Syntax
create procedure sys.sp_changemergelogsettings (
    @publication        sysname = NULL, 	/* Publication name */
    @subscriber         sysname = NULL,     /* Subscriber server */
    @subscriber_db      sysname = NULL,     /* Subscription database */
    @support_options	int = NULL,
    @web_server			sysname = NULL,
    @log_severity		int = NULL,
    @log_modules		int = NULL,
    @log_file_path		nvarchar(255) = NULL,
    @log_file_name		sysname = NULL,
    @log_file_size		int = NULL,
    @no_of_log_files	int = NULL,
    @upload_interval	int = NULL,
    @delete_after_upload int = NULL,
    @custom_script	nvarchar(2000) = NULL,
    @message_pattern    nvarchar(2000) = NULL
    ) AS

    declare @retcode                int
    declare @pubid                    uniqueidentifier
    declare @subid                    uniqueidentifier
    /*
    ** Security Check.
    */
    exec @retcode= sys.sp_MSreplcheck_subscribe
    if @@error <> 0 or @retcode <> 0
    begin
        raiserror(15247,-1,-1)
        return (1)
    end


    /*
    **    Check to see if current database is doing publishing/subscribing
    */
    IF object_id('sysmergesubscriptions') is NULL
    BEGIN
        RAISERROR (14055, 16, -1)
        RETURN (1)
    END

    /*
    ** Parameter Check:     @publication.
    ** Make sure that the publication exists.
    */

    IF @publication IS NULL
        BEGIN
            RAISERROR (14043, 16, -1, '@publication', 'sp_changemergelogsettings')
            RETURN (1)
        END

    select @pubid = pubid
       FROM dbo.sysmergepublications
       WHERE name = @publication  and UPPER(publisher)=UPPER(publishingservername()) and publisher_db=db_name()
    IF @pubid IS NULL
    BEGIN
        RAISERROR (20026, 11, -1, @publication)
        RETURN (1)
    END


    /*
    ** Parameter Check:     @subscriber.
    ** Check to make sure we have a valid subscriber.
    */
    IF @subscriber IS NULL
    BEGIN
        RAISERROR (14043, 16, -1, '@subscriber', 'sp_changemergelogsettings')
        RETURN (1)
    END

    /*
    ** Parameter Check:     @subscriber_db.
    ** Check to make sure we have a valid subscriber.
    */
    IF @subscriber_db IS NULL
    BEGIN
        RAISERROR (14043, 16, -1, '@subscriber_db', 'sp_changemergelogsettings')
        RETURN (1)
    END

    /*
    ** Check to see if you have a subscription on this publication
    */
    set @subid = NULL
    select @subid = subid, @pubid = pubid /* identified from publication name */
          from dbo.sysmergesubscriptions
        where UPPER(subscriber_server) collate database_default = UPPER(@subscriber) collate database_default
            and db_name = @subscriber_db

    if @subid IS NULL
        begin
            RAISERROR (14050, 11, -1)
            RETURN(1)
        end

	if not exists (select * from dbo.MSmerge_supportability_settings
			    WHERE pubid = @pubid and subid = @subid and
			        ((@web_server IS NULL and web_server IS NULL) or (@web_server IS NOT NULL and
			        UPPER(web_server) collate database_default = UPPER(@web_server) collate database_default )))
    begin
	    RAISERROR (20718, 16, -1, @subscriber, @subscriber_db,@web_server)
        RETURN(1)
    end

    /*
    ** Parameter Check: all other parameters
    **
    */
    if (@support_options IS NOT NULL) and (@support_options < 0 or @support_options > 5)
    begin
        RAISERROR (20722, 16, -1, 'sp_changemergelogsettings', '@support_options')
        RETURN(1)
    end

    if (@log_severity IS NOT NULL) and (@log_severity < 1 or @log_severity > 4)
    begin
        RAISERROR (20722, 16, -1, 'sp_changemergelogsettings', '@log_severity')
        RETURN(1)
    end

    if (@log_file_size IS NOT NULL) and (@log_file_size < 2000000 or @log_file_size > 999000000)
    begin
        RAISERROR (20722, 16, -1, 'sp_changemergelogsettings', '@log_file_size')
        RETURN(1)
    end

    if (@no_of_log_files IS NOT NULL) and (@no_of_log_files < 2 or @no_of_log_files > 500)
    begin
        RAISERROR (20722, 16, -1, 'sp_changemergelogsettings', '@no_of_log_files')
        RETURN(1)
    end

    if (@upload_interval IS NOT NULL) and (@upload_interval < 0 or @upload_interval > 40320)	-- 60 * 24 * 7 *4 (4 weeks)
    begin
        RAISERROR (20722, 16, -1, 'sp_changemergelogsettings', '@upload_interval')
        RETURN(1)
    end

    if (@delete_after_upload IS NOT NULL) and (@delete_after_upload not in (0,1))
    begin
        RAISERROR (20722, 16, -1, 'sp_changemergelogsettings', '@delete_after_upload')
        RETURN(1)
    end

    begin tran
    save TRAN changemergelogsettings

	update dbo.MSmerge_supportability_settings
		set support_options = case when (@support_options IS NULL) 		then support_options else @support_options end
		,log_severity 	    = case when (@log_severity IS NULL) 		then log_severity 	 else @log_severity end
		,log_modules 		= case when (@log_modules IS NULL) 		    then log_modules 	 else @log_modules end
		,log_file_path 		= case when (@log_file_path IS NULL) 		then log_file_path 	 else @log_file_path end
		,log_file_name 		= case when (@log_file_name IS NULL) 		then log_file_name 	 else @log_file_name end
		,log_file_size 		= case when (@log_file_size IS NULL) 		then log_file_size   else @log_file_size end
		,no_of_log_files 	= case when (@no_of_log_files IS NULL) 		then no_of_log_files else @no_of_log_files end
		,upload_interval 	= case when (@upload_interval IS NULL) 		then upload_interval else @upload_interval end
		,delete_after_upload    = case when (@delete_after_upload IS NULL) 	then delete_after_upload else @delete_after_upload end
		,custom_script          = case when (@custom_script IS NULL or @web_server IS NOT NULL) 	then custom_script else @custom_script end
		,message_pattern        = case when (@message_pattern IS NULL) 	        then message_pattern     else @message_pattern end
	
    WHERE pubid = @pubid and subid = @subid and
        ((@web_server IS NULL and web_server IS NULL) or (@web_server IS NOT NULL and
        UPPER(web_server) collate database_default = UPPER(@web_server) collate database_default ))
	

    if @@ERROR <> 0
    BEGIN
        GOTO FAILURE
    END

	-- Get the subscriber out of supportability mode if there are no
	-- entries for the subscriber with support_options turned on.
	if not exists ( select * from dbo.MSmerge_supportability_settings
		WHERE pubid = @pubid and subid = @subid and
        support_options <> 0
		)
	begin
		update dbo.sysmergesubscriptions
			set supportability_mode = 0
		where subid = @subid and pubid = @pubid

	    if @@ERROR <> 0
	    BEGIN
	        GOTO FAILURE
	    END
	
	end
	else
	begin
		update dbo.sysmergesubscriptions
			set supportability_mode = 1
		where subid = @subid and pubid = @pubid

	    if @@ERROR <> 0
	    BEGIN
	        GOTO FAILURE
	    END
	end

    COMMIT TRAN
    return (0)

FAILURE:
    RAISERROR (20719, 16, -1)
    /* UNDONE : This code is specific to 6.X nested transaction semantics */
    if @@TRANCOUNT > 0
    begin
        ROLLBACK TRANSACTION changemergelogsettings
        COMMIT TRANSACTION
    end
    RETURN (1)

 
Last revision 2008RTM
See also

  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