create procedure sys.sp_MShelpmergepub_withoutrownumbers (
@publication sysname,
@publisher sysname,
@publisher_db sysname
) AS
if @publication is NULL
begin
raiserror (14043, 16, -1, '@publication', 'sp_MShelpmergepub_withoutrownumbers')
return 1
end
if @publisher is NULL
set @publisher=publishingservername()
if @publisher_db is NULL
set @publisher_db=db_name()
-- if local publisher, and if using workgroup edition, check for subscription limit.
if @publisher = publishingservername()
begin
declare @distributor sysname, @distribdb sysname, @distproc nvarchar(300), @retcode int, @publisher_engine_edition int
select @publisher_engine_edition = sys.fn_MSrepl_editionid()
if @publisher_engine_edition = 21
begin
EXEC @retcode = sys.sp_helpdistributor @rpcsrvname = @distributor OUTPUT,
@distribdb = @distribdb OUTPUT
IF @@ERROR <> 0 OR @retcode <> 0
BEGIN
RAISERROR (14071, 16, -1)
return 1
END
select @distproc = RTRIM(@distributor) + '.' + QUOTENAME(@distribdb) +
'.dbo.sp_MScheck_merge_subscription_count'
EXECUTE @retcode = @distproc
@publisher = @publisher,
@publisher_engine_edition = @publisher_engine_edition,
@about_to_insert_new_subscription=0
if @@ERROR <> 0 OR @retcode <> 0
return 1
end
end
-- ANY COLUMNS ADDED HERE AND RETRIEVED IN THE RESULTSET OF THIS PROC SHOULD PROBABLY ALSO BE ADDED TO
-- sp_MShelpmergepub_withrownumbers. sp_MShelpmergepub_withrownumbers is called by UI and SQL2000 or prior subscribers.
-- sp_MShelpmergepub_withoutrownumbers is called by Yukon subscribers. We need to make sure that the column list
-- in the resultset is the same between these procs.
select NULL, 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,
case when pubs.snapshot_ready > 1 then 0 else pubs.snapshot_ready end,
pubs.publication_type, pubs.pubid, pubs.snapshot_jobid, pubs.enabled_for_internet, pubs.dynamic_filters,
0, -- Merge agent does not retrieve the 18th column when calling sp_MShelpmergepub_withoutrownumbers. If we decide to
-- retrieve this in future, this would need to be replaced by the subquery at the 18th column in sp_MShelpmergepub_withrownumbers.
pubs.snapshot_in_defaultfolder, pubs.alt_snapshot_folder, pubs.pre_snapshot_script, pubs.post_snapshot_script,
pubs.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,
case when pubs.validate_subscriber_info = N'' then NULL else pubs.validate_subscriber_info end,
pubs.backward_comp_level, case when pubs.ad_guidname is NULL then 0 else 1 end ,
pubs.max_concurrent_merge, pubs.max_concurrent_dynamic_snapshots,
case when pubs.use_partition_groups = 1 then 1 else 0 end, -- e.g. value 2 means "do not use partition groups yet".
(select count(*) from dbo.sysmergearticles where pubid = pubs.pubid),
pubs.replicate_ddl, pubs.publication_number, pubs.allow_subscriber_initiated_snapshot,
pubs.allow_web_synchronization, pubs.web_synchronization_url, pubs.allow_partition_realignment, pubs.retention_period_unit,
sys.fn_MSmerge_hasdownloadonlyarticles(pubs.pubid), pubs.decentralized_conflicts, pubs.generation_leveling_threshold, pubs.automatic_reinitialization_policy,
sys.fn_repldecryptver4_wrapper(pubs.ftp_password)
FROM dbo.sysmergesubscriptions subs,
dbo.sysmergepublications pubs
WHERE pubs.name = @publication
and UPPER(pubs.publisher)=UPPER(@publisher)
and pubs.publisher_db=@publisher_db
and subs.subid = pubs.pubid
and subs.subscriber_type = 1
and UPPER(subs.subscriber_server) = UPPER(@publisher)
and subs.db_name = @publisher_db
-- although this proc is not granted to public, it needs security check.
-- This is because the wrapping sp_helpmergepublication does not have the
-- necessary information to do the check itself.
and (1 = {fn ISPALUSER(pubs.pubid)} or
1 = is_srvrolemember('db_owner') or
1 = isnull(is_member('replmonitor'),0))
return 0