Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSdetectinvalidaddarticle

  No additional text.


Syntax
create procedure sys.sp_MSdetectinvalidaddarticle
(
    @publication	sysname,
    @dest_table		sysname,
    @dest_owner		sysname
)
as
begin
	declare @OPT_ENABLED_FOR_P2P int
	
	declare @retcode 		bit,
			@publisher 		sysname,
		    @publisher_db 	sysname,
		    @publication_2	sysname

	select @OPT_ENABLED_FOR_P2P = 0x1,
			@publisher			= publishingservername(),
		    @publisher_db 		= db_name(),
		    @publication_2		= NULL

	-- check to see if this articles base table is a
	-- part of any other peer-to-peer publication
	select @publication_2 = sp.name
				from syspublications sp
					join sysextendedarticlesview sa
						on sp.pubid = sa.pubid
				where sp.name != @publication
					and (sp.options & @OPT_ENABLED_FOR_P2P) = @OPT_ENABLED_FOR_P2P
					and sa.dest_table = @dest_table
					and isnull(sa.dest_owner, N'dbo') = isnull(@dest_owner, N'dbo')
					
	if @publication_2 is not NULL
	begin
		select @dest_owner = isnull(@dest_owner, 'dbo')

		-- Articles can only be included in a single Peer-To-Peer publication. [@dest_owner].[@dest_table] is already included in the Peer-To-Peer publication '%s'.
		raiserror(20804, 16, -1, @dest_owner, @dest_table, @publication_2)
		return 1
	end

	-- if this database does not contain any subscriptions just exit
	if object_id('MSsubscription_agents', 'U') is NULL
		or object_id('MSsubscription_articles', 'U') is NULL
	begin
		return 0
	end

	-- check to see if this article's base table is being referenced
	-- by a subscription to any publication other than one by this name
	select @publisher = mssag.publisher,
		    @publisher_db = mssag.publisher_db,
		    @publication_2 = mssag.publication
		from MSsubscription_agents mssag
			join MSsubscription_articles mssa
				on mssag.id = mssa.agent_id
		where mssag.publication != @publication
			and mssa.dest_table = @dest_table
			and isnull(mssa.owner, N'dbo') = isnull(@dest_owner, N'dbo')
	
	if @publication_2 is not NULL
	begin
		select @dest_owner = isnull(@dest_owner, 'dbo')

		-- Peer-To-Peer topologies require identical publication names on each publisher. You are attempting to republish object [@dest_owner].[@dest_table] that is already being published in the Peer-To-Peer publication [%s].[%s].[%s].
		raiserror(20805, 16, -1, @dest_owner, @dest_table, @publisher, @publisher_db, @publication_2)
		return 1
	end

	return 0
end

 
Last revision 2008RTM
See also

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