Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_helpsubscriptionerrors

  No additional text.


Syntax
CREATE PROCEDURE sys.sp_helpsubscriptionerrors
(
    @publisher		sysname,
    @publisher_db	sysname,
    @publication	sysname,
	@subscriber		sysname,
	@subscriber_db	sysname
)
AS
BEGIN
	DECLARE @retcode		int,
			@publisher_id	int,
			@subscriber_id	int,
			@agent_id		int

	-- database must be distribution db
	IF sys.fn_MSrepl_isdistdb(DB_NAME()) <> 1
	BEGIN
		RAISERROR (21482, 16, -1, 'sp_helpsubscriptionerrors', 'distribution')
		RETURN 1
	END
	
	-- retrieve pub/sub/agent id
	SELECT @publisher_id = server_id
		FROM sys.servers
		WHERE UPPER(name) = UPPER(@publisher)

	SELECT @subscriber_id = server_id
		FROM sys.servers
		WHERE UPPER(name) = UPPER(@subscriber)

	SELECT @agent_id = id
		FROM MSdistribution_agents
		WHERE publisher_id = @publisher_id
			AND publisher_db = @publisher_db
			AND (publication = @publication
				OR lower(publication) = N'all')
			AND subscriber_id = @subscriber_id
			AND subscriber_db = @subscriber_db	

    -- PAL Security Check
    EXEC @retcode = sys.sp_MScheck_pull_access @agent_id = @agent_id,
												@agent_type = 0 -- distribution agent
    IF @@ERROR <> 0 OR @retcode <> 0
        RETURN 1

	-- return the resultset
	SELECT msre.*
		FROM MSrepl_errors msre
		WHERE msre.id IN (SELECT error_id
							FROM MSdistribution_history
							WHERE agent_id = @agent_id)
		ORDER by msre.time desc

	RETURN 0
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