Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSrepl_DistributorReplMonitorAccess

  No additional text.


Syntax


-- Name:
--          sp_MSrepl_DistributorReplMonitorAccess

-- Description:

--          This stored procedure runs in any database at a distributor.  It returns
--          Success (0) if the current user has ReplMonitor access to distribution related
--          information at the distributor.  Access is granted to those in the
--          db_owner or replmonitor role of the/any distribution database.

--          If @distribution_db is specified, only this distribution database is checked.
--          If @distribution_db is not specified, all distribution databases are checked.

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

-- Returns:
--          Success (0) or failure (1)

-- Owner:
--          


create procedure sys.sp_MSrepl_DistributorReplMonitorAccess
(
    @distribution_db sysname = '%'
)
AS
begin
    set nocount on
    declare
         @db_name sysname
        ,@has_access bit
        ,@cmd nvarchar(200)
        ,@retcode int

    
    -- If SA then we will return success
    
    if is_srvrolemember('sysadmin') = 1
        return (0)
    
    -- initialize
    
    select @has_access = 1
    
    -- Search sysdababases for distribution databases
    
    declare hCdatabase CURSOR LOCAL FAST_FORWARD FOR
        select dist.name
              from master.dbo.sysdatabases d
        inner join msdb.dbo.MSdistributiondbs dist
                on dist.name = d.name collate database_default
        where dist.name like @distribution_db collate database_default
                and has_dbaccess(d.name) = 1

    open hCdatabase
    fetch next from hCdatabase into @db_name
    while (@@fetch_status <> -1 and @has_access = 1)
    begin
        
        -- Check to see if the user has 'replmonitor' access to the distribution database.
        
        begin
            -- Check 'db_owner' and 'replmonitor' roles in distribution database
            select @cmd = quotename(@db_name) + '.sys.sp_executesql'

            exec @cmd N'if is_member(N''db_owner'') = 1 or isnull(is_member(N''replmonitor''),0) = 1 set @has_access = 0',
                            N'@has_access bit output',
                            @has_access output

        end
        fetch next from hCdatabase into @db_name
    end
    close hCdatabase
    deallocate hCdatabase
    return(@has_access)
end

 
Last revision 2008RTM
See also

  sp_browsereplcmds (Procedure)
sp_MSdelete_tracer_history (Procedure)
sp_MSdrop_replcom (Procedure)
sp_MShelptracertokenhistory (Procedure)
sp_MShelptracertokens (Procedure)
sp_MSload_tmp_replication_status (Procedure)
sp_replmonitorhelppublisher (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