Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSupdatecachedpeerlsn

  No additional text.


Syntax
create procedure sys.sp_MSupdatecachedpeerlsn
(
	@type						int,		-- 1-insert/update, 2-clear
	@agent_id					int,
	@originator					sysname = NULL,
	@originator_db				sysname = NULL,
	@originator_publication_id	int = NULL,
	@originator_db_version		int = NULL,
	@originator_lsn				varbinary(16) = NULL
)
as
begin
	declare @retcode bit

	-- security check - the distribution agent must have access
	exec @retcode = sys.sp_MScheck_pull_access @agent_id = @agent_id, @agent_type = 0
    if @@error <> 0 or @retcode <> 0
    begin
        return 1
    end
	
	if @type not in (0, 1, 2)
	begin
		-- Invalid '@type' value for stored procedure 'sys.sp_MSupdatecachedpeerlsn'.
		raiserror(20587, 16, -1, '@type', 'sys.sp_MSupdatecachedpeerlsn')
		return 1
	end

	begin tran t_MScached_peer_lsns
	
	-- insert/update row
	if @type = 1
	begin
		update MScached_peer_lsns
			set originator_lsn = @originator_lsn
			where agent_id 						= @agent_id
				and UPPER(originator) 			= UPPER(@originator)
				and originator_db 				= @originator_db
				and originator_publication_id 	= @originator_publication_id
				and originator_db_version 		= @originator_db_version
		if @@rowcount < 1
		begin
			insert into MScached_peer_lsns
			(
				agent_id,
				originator,
				originator_db,
				originator_publication_id,
				originator_db_version,
				originator_lsn
			)
		    values
			(
				@agent_id,
				UPPER(@originator),
				@originator_db,
				@originator_publication_id,
				@originator_db_version,
				@originator_lsn
			)
		    if @@rowcount < 1 or @@error <> 0
		    	goto FAILURE
		end
		
		if @@error <> 0
		begin
			-- The distribution agent was unable to update the cached lsns for Originator:%s OriginatorDB:%s OriginatorDBVersion:%d OriginatorPublicationID:%d.
			raiserror(21680, 16, -1, @originator, @originator_db, @originator_db_version, @originator_publication_id)
			goto FAILURE
		end
	end
	-- clear cache for the specified agent
	else if @type = 2
	begin
		delete from MScached_peer_lsns
			where agent_id = @agent_id
		if @@error <> 0
       			goto FAILURE
	end
	
	commit transaction t_MScached_peer_lsns

	return 0
FAILURE:
	if @@trancount > 0
		rollback transaction t_MScached_peer_lsns

	-- The procedure sys.sp_MSupdatecachedpeerlsn failed to UPDATE the resource MScached_peer_lsns Server error =  21499.
	raiserror (21499, 16, -1, 'sys.sp_MSupdatecachedpeerlsn', 'UPDATE', 'MScached_peer_lsns', @@error)
   	return 1
end

 
Last revision 2008RTM
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