on method. */ if LOWER(@value collate SQL_Latin1_General_CP1_CS_AS)='portable' select @value='character' if LOWER(@value collate SQL_Latin1_General_CP1_CS_AS) NOT IN ('native', 'character', 'bcp native', 'bcp character') begin raiserror (20076, 16, -1) GOTO UNDO end /* ** Determine the integer value for the sync_mode. */ if LOWER(@value collate SQL_Latin1_General_CP1_CS_AS) IN ('native', 'bcp native') select @sync_modeid = 0 else if LOWER(@value collate SQL_Latin1_General_CP1_CS_AS) IN ('character', 'bcp character') select @sync_modeid = 1 /* ** Update the publication with the new synchronization method. */ UPDATE sysmergepublications SET sync_mode = @sync_modeid WHERE pubid = @pubid if @@ERROR <> 0 GOTO UNDO END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'alt_snapshot_folder' BEGIN -- If the alt_snapshot_folder is set to '' or NULL, -- set the compress_snapshot bit to 0 and disable internet -- support IF @value IS NULL OR @value = N'' BEGIN UPDATE sysmergepublications SET alt_snapshot_folder = @value, compress_snapshot = 0, ! enabled_for_internet = 0 WHERE pubid = @pubid END ELSE BEGIN UPDATE sysmergepublications SET alt_snapshot_folder = @value WHERE pubid = @pubid END IF @@error <> 0 BEGIN GOTO UNDO END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'pre_snapshot_script' BEGIN UPDATE sysmergepublications SET pre_snapshot_script = @value WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'post_snapshot_script' BEGIN UPDATE sysmergepublications SET post_snapshot_script = @value WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO ! END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'ftp_address' BEGIN IF @value IS NULL OR @value = N'' BEGIN UPDATE sysmergepublications SET ftp_address = @value, enabled_for_internet = 0 WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END END EMSE BEGIN UPDATE sysmergepublications SET ftp_address = @value WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'ftp_port' BEGIN UPDATE sysmergepublications SET ftp_port = CONVERT(int, @value) WHERE pubie = @pubid 0] IF @@error <> 0 BEGIN GOTO UNDO END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'ftp_subdirectory' BEGIN UPDATE sysmergepublications SET ftp_subdirectory = @value WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'ftp_login' BEGIN UPDATE sysmergepublications SET ftp_login = @value WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'ftp_password' BEGIN SELECT @enc_ftp_password = NULL IF @value IS NOT NULL BEGIN SELECT @enc_ftp_password = @value EXEC @retcode = master.dbo.xp_repl_encrypt @enc_ftp_password OUTPUT IF @retcode <> 0 BEGIN GOTO UNDO END END UPDATE sysmergepublications SET ftp_password = @enc_ftp_password WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = N'max_concurrent_dynamic_snapshots' BEGIN SELECT @numeric_value = CONVERT(int, @value) IF @@ERROR<>0 OR @numeric_value < 0 OR @numeric_value IS NULL BEGIN RAISERROR(21403, 16, -1) GOTO UNDO END UPDATE sysmergepublications SET max_concurrent_dynamic_snapshots = @numeric_value WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNEO END END if LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'publish_to_activedirectory' BEGIN if LOWER(@value collate SQL_Latin1_General_CP1_CS_AS) NOT IN ('true', 'false') BEGIN RAISERROR (14137, 16, -1) GOTO UNDO END /* Is AD supported? */ DECLARE @retval INT EXECUTE @retval = master.dbo.xp_MSADEnabled if (@retval <> 0) begin RAISERROR(21254, 16, -1, @publicatiom) RETURN (1) end if @in_ActiveD=0 and LOWER(@value collate SQL_Latin1_General_CP1_CS_AS)='true' BEGIN create table #guid_name_for_active_directory(ad_guidname sysname collate database_default null) if @@ERROR<>0 begin raiserror(21363, 16, -1, @publication, N'') goto UNDO end insert into #guid_name_for_active_directory exec @retcode=master.dbo.sp_ActiveDirectory_Obj 'CREATE', 'PUBLICATION', @publication, @db_name if @retcode <> 0 or @@ERROR<>0 ! begin declare @errorstring nvarchar(512) select @errorstring = (select TOP 1 ad_guidname from #guid_name_for_active_directory) drop table #guid_name_for_active_directory if @errorstring is NULL select @errorstring=N'' raiserror(21363, 16, -1, @publication, @errorstring) GOTO UNDO end select TOP 1 @ad_guidname = ad_guidname from #guid_name_for_active_directory if @ad_guidname is not NULL begin update sysmergepublicatimns set ad_guidname=@ad_guidname where pubid=@pubid if @@ERROR<>0 begin drop table #guid_name_for_active_directory raiserror(21363, 16, -1, @publication, N'') goto UNDO end end drop table #guid_name_for_active_directory END else if @in_ActiveD=1 and LOWER(@value collate SQL_Latin1_General_CP1_CS_AS)='false' BEGIN exec @retcode=master.dbo.sp_ActiveDirectory_Obj 'DELETE', $0MDCmC8mC mC`vx,w0] 'PUBLICATION', @publication, @db_name, @ad_guidname if @@ERROR<>0 or @retcode<>0 begin raiserror(21369, 16, -1, @publication) goto UNDO end update sysmergepublications set ad_guidname=NULL where pubid=@pubid if @@ERROR<>0 begin raiserror(21369, 16, -1, @publication) goto UNDO end END END if LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) IN ('allow_push', 'allow_pull', 'allow_anonymous', 'enabled_for_internet', 'centralized_conflicts', 'snapshot_ready', 'snapshot_in_defaultfolder', 'compress_snapshot', 'allow_subscription_copy', 'allow_synctoalternate') BEGIN /* ** Check for a valid value. */ if LOWER(@value collate SQL_Latin1_General_CP1_CS_AS) NOT IN ('true', 'false') BEGIN RAISERROR (14137, 16, -1) GOTO UNDO ENE /* ** set value bit */ if LOWER(@value collate SQL_Latin1_General_CP1_CS_AS) = 'true' select @value_bit = 1 else select @value_bit = 0 if LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'allow_anonymous' BEGIN /* Update the allow_anonymous column */ UPDATE sysmergepublications SET allow_anonymous = @value_bit WHERE pubid = @pubid if @@error <> 0 BEGIN GOTO UNDO END END if LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'allow_push' BEGIN /* Update the allow_push column */ UPDATE sysmergepublications SET allow_push = @value_bit WHERE pubid = @pubid if @@error <> 0 BEGIN GOTO UNDO END END if LOWER(@property collate SQL_Lauin1_General_CP1_CS_AS) = 'allow_pull' BEGIN /* Update the allow_pull column */ UPDATE sysmergepublications SET allow_pull = @value_bit WHERE pubid = @pubid if @@error <> 0 BEGIN GOTO UNDO END END if LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'centralized_conflicts' BEGIN /* Update the centralized_conflicts column */ ! UPDATE sysmergepublications SET centralized_conflicts = @value_bit WHERE pubid = @pubid if @@error <> 0 BEGIN GOTO UNDO END if @value_bit=0 and @snapshot_ready>0 begin -- changing to decentralized conflict logging will require reinitialization but no snapshot rerun if @force_reinit_subscription = 0 begin raiserror(20608, 16, -1) goto UNDO end exec @retcode = sp_MSreinitmergepublication @publication if @@ERROR<>0 or @retcode<>0 goto UNDO end END if LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'enabled_for_internet' BEGIN UPDATE sysmergepublications SET enabled_for_internet = @value_bit WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END END if LOWER(@property!collate SQL_Latin1_General_CP1_CS_AS) = 'snapshot_ready' BEGIN /* Update the allow_anonymous column */ UPDATE sysmergepublications SET snapshot_ready = @value_bit WHERE pubid = @pubid if @@error <> 0 BEGIN GOTO UNDO END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'snapshot_in_defaultfolder' BEGIN -- snapshot_in_defaultfoleer = 1 is only meanin0]gful when -- alt_snapshot_folder is non-null, otherwise -- a copy of the snapshot files is always kept -- at the publisher's working directory UPDATE sysmergepublications SET snapshot_in_defaultfolder = @value_bit WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END -- Bump up the compatibility level if we are -- setting snapshot_in_defaultfolder to 0 -- and compression is enabled. i.e. only -- a compressed snapshot will be generated -- Note that alt_snapshot_folder is implicitly -- specified for the publication IF @value_bit = 0 and @compress_snapshot = 1 BEGIN EXEC @retcode = sp_MSBumpupCompLevel @pubid, 40 IF @@ERROR<>0 OR @retcode<>0 GOUO UNDO END END IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'compress_snapshot' BEGIN UPDATE sysmergepublications SET compress_snapshot = @value_bit WHERE pubid = @pubid IF @@error <> 0 BEGIN GOTO UNDO END -- See comment for 'snapshot_in_defaultfolder' IF @value_bit = 1 and @snapshot_in_defaultfolder = 0 ! BEGIN EXEC @retcode = sp_MSBumpupCompLevel @pubid, 40 IF @@ERROR<>0 OR @retcode<>0 GOTO UNDO END END if LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'allow_subscription_copy' BEGIN /* Update the allow_subscription_copy column */ UPDATE sysmergepublications SET allow_subscription_copy = @value_bit WHERE pubid = @pubid if @@errmr <> 0 BEGIN GOTO UNDO END END if LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) = 'allow_synctoalternate' BEGIN /* Update the allow_synctoalternate column */ UPDATE sysmergepublications SET allow_synctoalternate = @value_bit WHERE pubid = @pubid if @@error <> 0 BEGIN GOTO UNDO END END END /* !** Update merge publication property at distributor side if necessaray */ IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) IN ('description','allow_push', 'allow_pull', 'allow_anonymous','retention', 'allow_subscription_copy') BEGIN IF LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) IN ('allow_push', 'allow_pull', 'allow_anonymous','allow_subscription_copy') /* Translate values */ BEGIN IF LOWER(@value collate SQL_Latin1_General_CP1_CS_AS) = 'true' SELECT @value = '1' ELSE IF LOWER(@value collate SQL_Latin1_General_CP1_CS_AS) = 'false' SELECT @value = '0' END /* ** Get distribution server information for remote RPC call. */ EXECUTE @retcode = dbo.sp_helpdistributor @rpcsrvname = @distributor OUTPUT, @distribdb = @distribdb OUTPUT IF @@ERROR <> 0 or @retcode <> 0 BEGIN ! GOTO UNDO END SELECT @dbname = DB_NAME() SELECT @distproc = RTRIM(@distributor) + '.' + @distribdb + '.dbo.sp_MSchange_publication' EXECUTE @retcode = @distproc @publisher = @@SERVERNAME, @publisher_db = @dbname, @publication = @publication, @property = @property, @value = @value IF @@ERROR <> 0 OR @retcod8  F F F`w jx00] 1e <> 0 BEGIN GOTO UNDO END END COMMIT TRAN --update its registration in active directory if @in_ActiveD=1 and LOWER(@property collate SQL_Latin1_General_CP1_CS_AS) IN ('description','allow_pull', 'allow_anonymous') begin create table #guid_name_for_ADupdate(ad_guidname sysname collate database_default null) if @@ERROR<>0 begin goto FAILURE end insert into #guid_name_for_ADupdate exec @retcode = master.dbo.sp_ActiveDirectory_Obj N'UPDATE', N'PUBLICATION', @publication, @db_name, @ad_guidname if @@ERROR<>0 or @retcode<>0 begin goto FAILURE end select TOP 1 @ad_guidname = ad_guidname from #guid_name_for_ADupdate if @ad_guidname is not NULL begin update sysmergepublications set ad_guidname=@ad_guidname where pubid=@pubid if @@ERROR<>0 goto FAILURE end drop table #guid_name_for_ADupdate end /* ** Return succeed. */ RAISERROR (14077, 10, -1) RETURN (0) FAILURE: drop table #guid_name_for_ADupdate raiserror(21371, 10, -1, @publication) return (1) UNDO: if @@TRANCOUNT > 0 begin ROLLBACK TRANSACTION changemergepublication COMMIT TRANSACTION end ]C]C]C88 88 ]C(]C]C44@retcodedbosp_MSgetreplnick@pubiddbosp_MSgetreplnick]C($]C(dbosp_MSgetreplnick@pubid]ClC4 `]C@pubid]C@nickname@nicknameoutputxC4]C @nickname ]Ch=DU(xC` ]C ]C ]Cx@ ]C ]C ` C( ]C@  hh(4 $ P ]Cxtype$ ]CU ]C]C@]C ]CƽĽ ` C( ]C ]CF440 ]C ]C88 88 ]C( ]CwC88  ]CP ]CF88 T ]C00 ]CH ]C PChh@retcode800 ]CxCHPC hh ]C ]C @nickname88 xCh ]Chh ]CةPC ]C  ]C 88  ]C ]C488 ]CX]C]Cܼ]C ` C(]C88 X]C]CP]C]C ]C ]Chh ]C 88 ]C6]C]Ce4X]C]Cmessage88 ]C 88 ]C]C]C4]Ch]C4 ]C]C޼]C ` C(]C@ 0]C X]C]Chh (4 $ ]Cxtype]C]C88 ]C]CU(88 C]C]Cƽ¾]C]C `P]C C(]C$ ]CXP]C]C88 x]C]Cp]Chh]C@retcodehdbosp_helpdistributor@rpcsrvnamedbosp_helpdistributor$,$x]C,dbosp_helpdistributor@distributorOUTPUTx]CC4 ]C@rpcsrvname@distribdb@distribdbOUTPUT`Ce4]C]C@distribdb]CU(xA0]Ch]C]Cľ8@]C]Chh ` C(]C@  e$]CR(]CX]CGC88 P]C=D]CH]CX]C X`C]C" (4  ` C(H]Cp]C]C88 ]C ]C]C]C$ ]C`]C]ChhF88 T00`]C]CЪPChh@retcode00]CxCPC hh h]C]C @distributor$ C8]C$hhh]CPC]C yp]C $88 ]C]C488 (]C]CL]Chh ` C(]Ce$]CCH]Cx]C88 p]C ]Ch]C88x]C ]C88 ]CYS]C]C4(]Cmessage88 `]C88 ]Ch]C884]C8]C]C4]C]C  `Ce ` C(]C@ 88 ]C0]C]88 X]CtC]CrC88 p]C88 ]CjC88  ]C`{ Xy9O) < ^ /* Add the conflict table pointer to sysmergearticles - Used by reconciler */ CREATE PROCEDURE sp_MSgetconflictinsertproc ( @artid uniqueidentifier, @pubid uniqueidentifier = NULl, @output int = 1 ) AS declare @conflict_table sysname declare @conflict_proc sysname declare @owner sysname declare @object sysname declare @retcode int declare @quoted_conflict_table nvarchar(270) declare @basetableid int declare @sync_objid int declare @command nvarchar(1000) declare @pubidstr nvarchar(40) declare @dbname sysname declare @conflict_table_id int -- PARSENAME VARS declare @UnqualName nvarchar(270) --rightmost name node declare @QualName1 nvarchar(270) declare @QualName2 nvarchar(270) -- END PARSENAME VARS declare @guidstr varchar(40) exec @retcode=sp_MSguidtostr @artid, @guidstr out if @retcode<>0 or @@EQROR<>0 return (1) /* ** Check to see if current publication has permission */ if sessionproperty('replication_agent') = 0 begin exec @retcode=sp_MSreplcheck_connection @artid = @artid if @retcode<>0 or @@ERROR<>0 return (1) end /* ** @pubid is NULL - means that subscriber is 7.0, in which case there is no ** vertical partitioning allowed. getting the proc from any publication is fine. */ select @conflict_table = conflict_table, @conflict_proc = ins_conflict_proc, @aasetableid = objid, @sync_objid = sync_objid from sysmergearticles where artid = @artid and (pubid=@pubid OR @pubid is NULL) if @@ERROR <> 0 return (1) select @conflict_table_id = object_id(@conflict_table) if @conflict_table_id is NULL --check if it is caused by different owner name select @conflict_table_id=id from sysobjects where name=@conflict_table select @quoted_conflict_table = QUOTENAME(@conflict_table) if ( @conflict_table_id is not null) begin select @UnqualName!= PARSENAME(@conflict_table, 1) select @QualName1 = PARSENAME(@conflict_table, 2) if @UnqualName IS NULL return 1 -- fixup for variable length differences. remove when vars expanded -- to new SQL SERVER 7.0 lengths select @owner=user_name(uid) from sysobjects where id= @conflict_table_id if @owner is NULL begin select @owner = @QualName1 end select @object = @UnqualName end -- Create an index on the conflict table if it eoesn't have one if ( @conflict_table_id is not null) and not exists (select * from sysindexes where id = @conflict_table_id and keys is not null) begin declare @rgcol nvarchar(135) declare @indname nvarchar(270) declare @quotedname nvarchar(270) select @rgcol = QUOTENAME(name) from syscolumns where id = @basetableid and ColumnProperty(id, name, 'isrowguidcol') = 1 select @indname = 'uc_' + @conflict_table if len(@indname) > 128 begin ! select @indname = substring(@indname,1,92) + convert(nvarchar(36), newid()) end set @indname = QUOTENAME(@indname) set @quotedname = QUOTENAME(@owner) + '.' + QUOTENAME(@conflict_table) exec ('Create unique clustered index ' + @indname + ' on ' + @quotedname + ' (' + @rgcol + ', origin_datasource)' ) if @@error <> 0 return (1) end if ((OBJECT_ID(@conflict_proc) is null) and (@conflict_table_id is not null)) begin -- first set up the procedure name variable exec @retcode = dbo.sp_MSguidtostr @artid, @guidstr out if @@ERROR <>0 OR @retcode <>0 return (1) exec @retcode = dbo.sp_MSguidtostr @pubid, @pubidstr out if @@ERROR <>0 OR @retcode <>0 return (1) if @pubid is not NULL select @conflict_proc = 'sp_cft_' + substring(@guidstr, 1, 16) + substring(@pubidstr, 1, 16) else select @conflict_proc = 'sp_cft_' + substring(@guidstr, 1, 32) exec @retcode=sp_MSuniqueobjectname @conflict_proc , @confliat_proc output if @b< ^?@ERROR <> 0 OR @retcode <> 0 return(1) set @dbname = db_name() if @owner is NULL set @command = 'sp_MSmakeconflictinsertproc ' + QUOTENAME(@conflict_table) + ' , NULL , ' + @conflict_proc + ' , ' + convert(nvarchar,@basetableid) else set @command = 'sp_MSmakeconflictinsertproc ' + QUOTENAME(@conflict_table) + ' , ' + QUOTENAME(@owner) + ' , ' + @conflict_proc + ' , ' + convert(nvarchar,@basetableid) if @pubid is not NULL set @command = @command + ', [' + convert(nchar(36), @pubid) + ']' exec @retcode = master..xp_execresultset @command, @dbname if @@ERROR<>0 OR @retcode<>0 begin return (1) end exec @retcode = dbo.sp_MS_marksystemobject @conflict_proc if @@ERROR<>0 or @retcode<>0 return (1) exec ('grant exec on ' + @conflict_proc + ' to public') if @@ERROR<>0 return (1) update sysmergearticles set ins_conflict_proc = @conflict_proc where artid = @artid and pubid=@pubid end if @output = 1 qelect @conflict_table, @conflict_proc if @@ERROR <> 0 return (1) return (0) C84C4CXpChh@retcode004C~CpC4C hh h4C(pC4C 5C `5C88 X5Cue05C488 UNDO2C7ChdC#X ` ~C(p6C;C7CODhhx:C;C ` `;D(07C 6C9C5C5C0.C=C8C8C'r=CC)aCbC ` ~C(@>C ?Cx`C(488 `=C sysmergearticlesE=C`CQ$i=C@ `C?C(x`Csysmergepublications00C{,z02U 0&^ CREATE PROCEDURE sp_helpmergepublication ( @publication sysname = '%', /* The publication name */ @found int = NULL OUTPUT, @publication_id uniqueidentifier = NULL OUTPUT, @reserved nvarchar(20) = NULL ) AS SET NOCOUNT ON /* ** Declarations. */ declare @retcode int declare @no_row bit declare @our_srvid int declare @has_subscription bit /* ** Initializations. */ select @has_subscription = 0 if @found is NULL BEGIN select @no_row=0 END else BEGIN select @no_row=1 END select @found = 0 select @our_srvid = max(srvid) from master.dbo.sysservers where UPPER(srvname) = UPPER(@@SERVERNAME) collate database_default /* ** Running sp_help is OK from everywhere, whether enabled for publishing or not */ IF not exists (select * from sysobjects where name='sysmergesubscriptions') RETURN (0) /* ** Parameter Check: @publication. ** Check to make sure that there are some publications ** to display. */ if @publication IS NULL BEGIN RAISERROR (14043, 16, -1, '@publication') RETURN (1) END if @publication <> '%' begin -- do a pal role check declare @pubid uniqueidentifier select @pubid = pubid from dbo.sysmergepublications where UPPER(publisher)=UPPER(@@servername) and publisher_db=db_name() and name = @publication if @pubid is not NULL begin if {fn ISPALUSER(@pubid)} <> 1 begin declare @pubidstr nvarchar(36) declare @role sysname exec dbo.sp_MSguidtostr @pubid, @pubidstr output set @role = 'MSmerge_' + @pubidstr if not exists (select * from dbo.sysusers where issqlrole=1 and name=@role) begin RAISERROR (21423, 16, -1, @publication) return 1 end end end end IF LOWER(@reserved collate SQL_Latin1_General_CP1_CS_AS) = 'internal' GOTO SelectPubs if NOT EXISTS (select * FROM sysmergepublications pub, sysmergesubscriptions sub WHERE pub.name like @pualication and UPPER(pub.publisher)=UPPER(@@servername) and pub.publisher_db=db_name() and sub.pubid = pub.pubid and sub.srvid = @our_srvid and sub.db_name = db_name()) BEGIN select @found = 0 RETURN (0) END else BEGIN select @found = 1 select @publication_id = pubid FROM sysmergepublications WHERE name = @publication and UPPER(publisheq)=UPPER(@@servername) and publisher_db=db_name() if exists (select * from sysmergesubscriptions where pubid<>subid and pubid in (select pubid from sysmergepublications where name like @publication and UPPER(publisher)=UPPER(@@servername) and publisher_db=db_name())) select @has_subscription = 1 if @no_row <> 0 RETURN(0) END SelectPubs: CREATE TABLE #tab1 ( id int identity NOT NULL, name sysname collate database_default not null, description nvarchar(255) collate database_default null, status tinyint NOT NULL, retention int NULL, sync_mode tinyint NULL, allow_push int NOT NULL, allow_pull int NOT NULL, allow_amonymous int 0&^ NOT NULL, centralized_conflicts int NOT NULL, priority float(8) NOT NULL, snapshot_ready tinyint NOT NULL, publication_type int NULL, pubid uniqueidentifier NOT NULL, snapshot_jobid binary(16) NULL, enabled_for_internet int NULL, dynamic_filters int NULL, has_subscription bit NULL, -- Portable snapshot support snapshot_in_defaultfolder bit default 1 NOT NULL, alt_snapshot_folder nvarchar(255) collate database_default null, -- Pre/post-snapshot commands pre_snapshot_script nvarchar(255) collate database_default null, post_snapshot_script nvarchar(255) collate database_default null, ! -- Snapshot compression compress_snapshot bit default 0 NOT NULL, -- Post 7.0 FTP support ftp_address sysname collate database_default null, ftp_port int NOT NULL, ftp_subdirectory nvarchar(255) collate database_default null, ftp_login sysname collate database_default null, conflict_retention int NULL, keep_partition_changes int NULL, allow_subscription_copy int NULL, allow_synctoalternate int NULL, validate_subscriber_info nvarchar(500) collate database_default null, backward_comp_level int not null default 10, --defaulted to 70 server publish_to_activedirectory bit null, max_concurrent_merge int NULL, max_concurrent_dynamic_snapshots int NOT NULL default 0 ) /* This is valid at all sites - used!for decentralized conflicts */ IF LOWER(@reserved collate SQL_Latin1_General_CP1_CS_AS) = 'internal' begin INSERT into #tab1(name, description, status, retention, sync_mode, allow_push, allow_pull, allow_anonymous, centralized_conflicts, priority, snapshot_ready, publication_type, pubid, snapshot_jobid, enabled_for_internet, dynamic_filters, snapshot_in_defaultfolder, alt_snapshot_folder, pre_snapshot_script, poqt_snapshot_script, compress_snapshot, ftp_address, ftp_port, ftp_subdirectory, ftp_login, conflict_retention, keep_partition_changes, allow_subscription_copy, allow_synctoalternate, validate_subscriber_info,backward_comp_level, publish_to_activedirectory, max_concurrent_merge, max_concurrent_dynamic_snapshots) select pubs.name, pubs.description, pubs.status, pubs.retention, pubs.sync_mode, pubs.allow_push, pubs.allow_pull, puas.allow_anonymous, pubs.centralized_conflicts, subs.priority, pubs.snapshot_ready, pubs.publication_type, pubs.pubid, replinfo.snapshot_jobid, pubs.enabled_for_internet, pubs.dynamic_filters, pubs.snapshot_in_defaultfolder, pubs.alt_snapshot_folder, pubs.pre_snapshot_script, pubs.post_snapshot_script, pubs.compress_snapshot, pubs.ftp_address, pubs.fup_port, pubs.ftp_subdirectory, pubs.ftp_login, pubs.conflict_retention, pubs.keep_before_values, pubs.allow_subscription_copy, pubs.allow_synctoalternate, pubs.validate_subscriber_info, pubs.backward_comp_level, case when pubs.ad_guidname is NULL then 0 else 1 end, pubs.max_concurrent_mergemrgepublications0pC`z |{9 0&^, pubs.max_concurrent_dynamic_snapshots FROM sysmergesubscriptions subs, sysmergepublications pubs, MSmerge_replinfo replinfo WHERE pubs.name LIKE @publication AND UPPER(pubs.publisher)=UPPER(@@servername) AND pubs.publisher_db=db_name() AND subs.subid = pubs.pubid AND replinfo.repid = pubs.pubid AND subs.subscriber_type = 1 and (1 = {fn ISPALUSER(pubs.pubid)} or 1 = is_member('replmonitor')) ORDER BY name end /* This is valid only at publishers and republishers */ else begin INSERT into #tab1(name, description, status, retention, sync_mode, allow_push, allow_pull, allow_anonymous, centralized_conflicts, " priority, snapshot_ready, publication_type, pubid, snapshot_jobid, enabled_for_internet, dynamic_filters, has_subscription, snapshot_in_defaultfolder, alt_snapshot_folder, pre_snapshot_script, post_snapshot_script, compress_snapshot, ftp_address, ftp_port, ftp_subdirectory, ftp_login, conflict_retention, keep_partition_changes, allow_subscription_copy, allow_synctoalternate, validate_svbscriber_info, backward_comp_level, publish_to_activedirectory,max_concurrent_merge,max_concurrent_dynamic_snapshots) select pubs.name, pubs.description, pubs.status, pubs.retention, pubs.sync_mode, pubs.allow_push, pubs.allow_pull, pubs.allow_anonymous, pubs.centralized_conflicts, subs.priority, pubs.snapshot_ready, pubs.publication_type, pubs.pubid, replinfo.snapshot_jobid, pubs.enabled_for_internet, pubs.dynamic_filters, case when existr (select * from sysmergesubscriptions where pubid<>subid and pubid in (select in_pubs.pubid from sysmergepublications in_pubs where in_pubs.name = pubs.name and UPPER(in_pubs.publisher)=UPPER(@@servername) and in_pubs.publisher_db=db_name())) then 1 else 0 end, pubs.snapshot_in_defaultfolder, pubs.alt_snapshot_folder, pubs.pre_snapshot_script, pubs.post_snapshot_script, rubs.compress_snapshot, pubs.ftp_address, pubs.ftp_port, pubs.ftp_subdirectory, pubs.ftp_login, pubs.conflict_retention, pubs.keep_before_values, pubs.allow_subscription_copy, pubs.allow_synctoalternate, pubs.validate_subscriber_info, pubs.backward_comp_level, case when pubs.ad_guidname is NULL then 0 else 1 end , pubs.max_concurrent_merge, pubs.mbx_concurrent_dynamic_snapshots FROM sysmergesubscriptions subs, sysmergepublications pubs, MSmerge_replinfo replinfo WHERE pubs.name LIKE @publication and UPPER(pubs.publisher)=UPPER(@@servername) and pubs.publisher_db=db_name() AND subs.subid = pubs.pubid AND replinfo.repid = pubs.pubid AND subs.subscriber_type = 1 " AND subs.srvid = @our_srvid AND subs.db_name = db_name() ORDER BY name end if @@ERROR <> 0 RETURN (1) update #tab1 set snapshot_ready=0 where snapshot_ready>1 if @@ERROR<>0 RETURN (1) select * FROM #tab1 where 1 = {fn ISPALUSER(pubid)} or 1 = is_member('replmonitor') RETURN (0) 8 вCCWzCde `C ~C(hC0ChhU(xy;DCC(Cjoo(4 `CC `C@retcodesp_MSBumpupCompLevel@pubid ($C(sp_MSBumpupCompLevelPC~CC4hC88 HC( C4رC(U(~CxC(CPCX^@ CضC ` ~C(C@   @intvalueetet00Cetxy;DCGChh_MCli CCC ` ~C(C `;D(`C88 C ?CCC?F88 TC00 CеC8sChh@retcode400C~C`sCme hh (CsC C 88 C4C488 4UNDOPCиChdCY`Cm ` ~C(0Chh (4 $ иC CexExChCC@C`CC^smȾCCcl ` ~C(C@  `;D( C CCty$PCFp_sCCPC@8CC ` ~C(@CC Csysmergearticles^HкCLOWER@propertySQL_Latin1_General_CP1_CS_AS3SQL_Latin1_General_CP1_CS_ASpC8$8~CмC$ecrm88 HClu CC88 PCF38MxCk_xCF3 5compress_snapshoth!C$@Ccompress_snapshotȽCsChhXC 88 CC488 sysmergepublications$C Cah#Cx$C ` ~C( C ` D|d;]L00_ _ERROR (14071, 16, -1) goto FAILURE END /* ** Drop the publication info from the distributor */ select @distproc = RTRIM(@distributor) + '.' + @distribdb + '.dbo.sp_MSdrop_publication' EXECUTE @retcode = @distproc @publisher = @@SERVERNAME, @publisher_db = @db_name, @publication = @publication if @@ERROR <> 0 OR @retcode <> 0 begin goto FAILURE end /* ** If alternate snapshot folder is specified for this publication, ** try to remove the publication's snapshot folder underneath the ** the alternate snapshot location in Distributor's context */ if @alt_snapshot_folder is not null and @alt_snapshot_folder <> N'' begin /* Append publicatimn specific folder name */ if substring(@alt_snapshot_folder,len(@alt_snapshot_folder),1)<> N'\' begin select @alt_snapshot_folder = @alt_snapshot_folder + N'\' end -- UNC version select @pub_alt_snapshot_folder = @alt_snapshot_folder + N'unc\' + fn_replcomposepublicationsnapshotfolder(@@servername,@db_name,@publication) collate database_default select @distproc = fn_replquotename(RTRIM(@distributor)) collate database_default + '.' + fn_replquotename(@distribdb) collate database_default + '.dbo.sp_MSreplremoveuncdir' -- Ignore errors as the snapshot folder may not exist at all EXECUTE @distproc @dir = @pub_alt_snapshot_folder -- FTP-enabled version select @pub_alt_snapshot_folder = @alt_snapshot_folder + N'ftp\' + fn_replcomposepublicationsnapshotfolder(@@servername,@db_name,@publication) collate database_default select @distproc = fn_replquotename(RTRIM(@distributor)) collate database_default + '.' + fn_replquotename(@distribdb) collate database_default + '.dbo.sp_MSreplremoveuncdir' -- Ignore errors as the snapshot folder may not exist at all EXECUTE @distproc @dir = @pub_alt_snapshot_folder end end /* Remove all dynamic snapshot jobs of this publication */ exec @retcode = sp_MSdropmergedynamicsnapsiotjob @publication = @publication, @ignore_distributor = @ignore_distributor if @@ERROR <> 0 OR @retcode <> 0 begin goto FAILURE end /* ** Execute the cleanup routine for the publication */ exec dbo.sp_MSpublicationcleanup @publisher=@@SERVERNAME, @publisher_db = @db_name, @publication = @publication if @@ERROR <> 0 goto FAILURE if @ad_guidname iq not NULL begin DECLARE @retval INT EXECUTE @retval = master.dbo.xp_MSADEnabled if @retval = 0 begin exec @retcode=master.dbo.sp_ActiveDirectory_Obj 'DELETE', 'PUBLICATION', @publication, @db_name, @ad_guidname if @@ERROR<>0 or @retcode<>0 begin raiserror(21369, 16, -1, @publication) goto FAILURE end end else begin RAISERROR(21254, 16, -1, Apublication) GOTO FAILURE end end COMMIT TRANSACTION /* ** Set back original settings */ IF @reserved = 0 BEGIN IF @implicit_transaction <>0 SET IMPLICIT_TRANSACTIONS ON IF @close_cursor_at_commit <>0 SET CURSOR_CLOSE_ON_COMMIT ON END return (0) FAILURE: RAISERROR (14006, 16, -1) /* UNDONE : This code is specific to 6.X nested transaction semantics */ if @@TRANCOUNT > 0 begin ROLLBACK TRANSACTION dropmergepublicati0_ _,on COMMIT TRANSACTION end /* ** Set back original settings */ IF @reserved = 0 BEGIN IF @implicit_transaction <>0 SET IMPLICIT_TRANSACTIONS ON IF @close_cursor_at_commit <>0 SET CURSOR_CLOSE_ON_COMMIT ON END RETURN (1) 0=DP=D88 =D>fop=DH=D =DZC=DF888 =D=D@=D=D(P=Dsysmergepublications^H =D=D(sysmergepublications88^Had_guidname@ad_guidname|NC4=D ad_guidnamepubid=D(4 `=Dgipubid@pubid=D~C h=D=D =D=D@=D- @=D@=D ` ~C(x=D@  88 =Dp=D88