Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_distagentstatus

  No additional text.


Syntax


-- Name:
--          sp_distagentstatus

-- Description:
--          Internal procedure for heterogeneous snapshot agent to
--          determine distribution agent status.

-- Security:
--          Internal
-- Requires Certificate signature for catalog access

-- Returns:
--          Result set:  Agent status

-- Owner:
--          sward

create procedure sys.sp_distagentstatus
(
	@publication	sysname,
	@publisher	sysname
)
AS
BEGIN

	DECLARE @independent_agent int
	DECLARE @publisher_id int

    SELECT @publisher_id = srvid
    FROM master.dbo.sysservers
    WHERE UPPER(@publisher) = UPPER(srvname collate database_default)

	-- Determine whether the given publication shares an
    -- agent with other publicaitons in the same database
    -- or not
    SELECT @independent_agent = 0
    SELECT @independent_agent = independent_agent
    FROM dbo.MSpublications
    WHERE publisher_id = @publisher_id
      AND publisher_db = DB_NAME()
      AND publication = @publication

    IF @independent_agent = 0
    BEGIN
        -- If the publication shares an agent with
        -- other publications, change the publication
        -- name to 'ALL' before querying the MSdistribution_agents
        -- table
        SELECT @publication = N'ALL'
    END

    SELECT     (SELECT TOP 1 s.status
                     FROM dbo.MSsubscriptions s
                     WHERE s.agent_id = msda.id),
                msda.job_id
    FROM MSdistribution_agents msda
    WHERE msda.publisher_id = @publisher_id
      AND msda.publisher_db = DB_NAME()
      AND msda.publication = @publication
END

 
Last revision 2008RTM
See also

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