Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSscriptpeerconflictdetection_tableaug

  No additional text.


Syntax
create procedure sys.sp_MSscriptpeerconflictdetection_tableaug (
	@pubid		int, -- not null
	@publication	sysname, -- not null
	@enabling	bit, -- not null
	@originator_id int, --should not be null and not 0 and not 0x80000000, when @enabling is 1 and when the destination is a peer
	@cmdtxt		nvarchar(max) output,
	@execscript	bit = 0
)
as
begin
	set nocount on
	
	declare	@retcode int = 0,
			@fulltablename nvarchar(540), --qualified with owner
			@artlist nvarchar(max), --in xml format
			@publisher sysname,
			@publisher_db sysname

	--check wethether there is any long table name
	declare @tabnames table (fulltablename nvarchar(270))
	insert @tabnames
		select *
		from		(select QUOTENAME(schema_name(objectproperty(objid, 'SchemaId'))) + N'.' + QUOTENAME(OBJECT_NAME(objid)) as fulltablename
				  from dbo.sysarticles
				  where	pubid = @pubid and (type & 1) <> 0) A
		where sys.fn_peerconflicttablename(A.fulltablename) is NULL
	if @@error <> 0
		goto Failure

	select @fulltablename = (select top 1 fulltablename from @tabnames) --report the first long table name
	if @fulltablename is not NULL
	begin
		raiserror(22816, 16, 1, @fulltablename)
		goto Failure
	end

	-- obtain article list
	declare @arttab table (schname sysname,  tabname sysname,  artname sysname,  schema_option bigint)
	insert  @arttab
		select	schema_name(objectproperty(objid, 'SchemaId')),
				OBJECT_NAME(objid),
				name,
				cast(schema_option as bigint)
		from 	dbo.sysarticles
		where	pubid = @pubid and (type & 1) <> 0
		
	if @@error <> 0
		goto Failure
	
	select @artlist = convert(nvarchar(max), (select * from @arttab as art for XML auto))
	if @@error <> 0
		goto Failure
		
	--add root: /arts
	select @artlist = N'' + @artlist + N''

	select @publisher = publishingservername()
	select @publisher_db = db_name()

	if @enabling = 0
		select @originator_id = 0

	if @artlist is not NULL
	begin
		if @execscript = 1
		begin
			exec @retcode = sp_peerconflictdetection_tableaug @publisher, @publisher_db, @publication, @enabling, @originator_id, @artlist
			if @@error <> 0 or @retcode = 1
				goto Failure
		end

		select @originator_id = 0x80000000 --read-only subscriptions
	
		select @cmdtxt = 	N' if @@microsoftversion >= 0x0A000000 ' +
						N' begin' +
						N'	exec sp_peerconflictdetection_tableaug @publisher = N' + QUOTENAME(@publisher, N'''') + N',' +
						N'									 @publisher_db = N' + QUOTENAME(@publisher_db, N'''') + N',' +
						N'									 @publication = N' + QUOTENAME(@publication, N'''') + N','  +
						N'									 @enabling = ' + CAST(@enabling as nvarchar) + N',' +
						N'									 @originator_id = ' + CAST(@originator_id as nvarchar) + N','  +
						N'									 @artlist = N''' + REPLACE(@artlist, N'''', N'''''')  + N'''' +
						N' end'
	end
	else
		select @cmdtxt = NULL
		
	return (0)
	
Failure:

	if @@error <> 0
		raiserror(21542, 16, 1, @@error, 'sp_MSscriptpeerconflictdetection_tableaug')			
	return (1)
end

 
Last revision 2008RTM
See also

  sp_configure_peerconflictdetection (Procedure)
sp_MSdrop_repltran (Procedure)
sp_MSsetupnosyncsubscriptionwithlsn (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