Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSchange_originatorid

  No additional text.


Syntax
create procedure sys.sp_MSchange_originatorid
(
	@originator_node			sysname,
	@originator_db			sysname,
	@originator_publication		sysname,
	@originator_publication_id	int,
	@originator_db_version		int,
	@originator_id				int,
	@originator_version		int
)
as
begin
	declare @retcode bit

	-- security check for subscriber
	exec @retcode = sys.sp_MSreplcheck_subscribe
	if @@error <> 0 or  @retcode <> 0
	begin
       	return 1
	end
	
	begin tran
	save tran tr_sp_MSchange_originatorid

	update dbo.MSpeer_lsns
	set originator_id =	case @originator_id
						when 0 then NULL
	                                   else @originator_id
					end,
	     originator_version = @originator_version
	where UPPER(originator) = UPPER(@originator_node)
		and originator_db = @originator_db
		and originator_publication	= @originator_publication
		and originator_publication_id = @originator_publication_id
		and originator_db_version	= @originator_db_version

	if @@error <> 0
	begin
		-- The procedure sys.sp_MSchange_originatorid failed to UPDATE the resource MSpeer_lsns. Server error =  @@error.
		raiserror (21499, 16, -1, 'sys.sp_MSchange_originatorid', 'UPDATE', 'MSpeer_lsns', @@error)
		goto FAILURE
       end

	if object_id(N'dbo.MSpeer_originatorid_history') is not NULL
	begin
		if @originator_id is not NULL and @originator_id <> 0 and not exists(select * from dbo.MSpeer_originatorid_history where originator_publication = @originator_publication
																				and originator_id = @originator_id
																				and UPPER(originator_node) = UPPER(@originator_node)
																				and originator_db = @originator_db
																				and originator_db_version = @originator_db_version)
		begin
			insert dbo.MSpeer_originatorid_history
				(originator_publication, originator_id, originator_node, originator_db, originator_db_version, originator_version)
			values(@originator_publication, @originator_id, UPPER(@originator_node), @originator_db, @originator_db_version, @originator_version)

			if @@error <> 0
			begin
				-- The procedure sys.sp_MSchange_originatorid failed to INSERT into the resource MSpeer_originatorid_history. Server error =  @@error.
				raiserror (21499, 16, -1, 'sys.sp_MSchange_originatorid', 'INSERT into', 'MSpeer_originatorid_history', @@error)
				goto FAILURE
			end
		end
	end

	commit tran
	
	return 0

FAILURE:
	
	rollback tran tr_sp_MSchange_originatorid
	commit tran
	
	return 1
end

 
Last revision SQL2008SP2
See also

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