The meta data is from an SQL 2012 Server.
I have posted alot more, find the whole list here.
Goto Definition or MetaData
Definition:
sys.sp_MSrepl_getdistributorinfo(nvarchar @publisher, nvarchar @local)
MetaData:
-- -- Name: -- sp_MSrepl_getdistributorinfo -- -- Description: -- Procedure used to efficiently obtain distributor, distribution database -- rpc server name, and publisher type. -- -- Returns: -- 0 == SUCCESS -- 1 == FAILURE -- Several output parameters -- -- Security: -- public -- Requires Certificate signature for catalog access -- -- Notes: -- This is an internal stored procedure to be used as an alternative -- to sp_helpdistributor when only basic information about the -- distributor is desired. It must be called from a publisher -- having an entry in the sysservers table associated -- with the distributor. -- create procedure sys.sp_MSrepl_getdistributorinfo ( @distributor sysname = NULL OUTPUT, @distribdb sysname = NULL OUTPUT, @publisher sysname = NULL, @local nvarchar(5) = NULL, @rpcsrvname sysname = NULL OUTPUT, @publisher_type sysname = NULL OUTPUT, @publisher_id int = NULL OUTPUT, @working_directory nvarchar(255) = NULL OUTPUT, @version int = NULL OUTPUT ) AS BEGIN SET NOCOUNT ON DECLARE @loc_distributor sysname, @loc_distribdb sysname, @loc_rpcsrvname sysname, @loc_publishertype sysname, @loc_publisherid int, @proc nvarchar(255), @retcode int, @srvid smallint, @dist_rpcname sysname, @loc_working_directory nvarchar(255), @loc_version int -- -- Get the distribution server -- SELECT @dist_rpcname = name, @loc_distributor = upper(data_source collate database_default ), @srvid = server_id, @loc_rpcsrvname = name FROM sys.servers WHERE is_distributor = 1 IF (@loc_distributor is null) RETURN (1) -- -- set publisher if necessary -- process based on where this is invoked -- SELECT @publisher = case when (@publisher IS NULL) then upper(publishingservername()) else upper(@publisher) end if @loc_distributor = UPPER(@@servername) begin -- -- invoked on distributor -- validate the calling publisher -- SELECT @loc_distribdb = msd.distribution_db, @loc_publishertype = msd.publisher_type, @loc_publisherid = ss.server_id, @loc_working_directory = msd.working_directory, @loc_version = @@microsoftversion FROM msdb.dbo.MSdistpublishers as msd join sys.servers as ss ON msd.name = UPPER(ss.name collate database_default ) AND msd.name = @publisher IF (@@ERROR != 0) -- OR @loc_distribdb IS NULL RETURN (1) end else begin -- -- invoked on publisher with remote distributor -- SELECT @proc = @dist_rpcname + N'.master.sys.sp_MSrepl_getdistributorinfo' EXECUTE @retcode = @proc @distributor = @loc_distributor OUTPUT, @distribdb = @loc_distribdb OUTPUT, @publisher = @publisher, @local = @local, @publisher_type = @loc_publishertype OUTPUT, @publisher_id = @loc_publisherid OUTPUT, @working_directory = @loc_working_directory OUTPUT, @version = @loc_version OUTPUT IF @retcode <> 0 or @@ERROR <> 0 RETURN (1) end -- -- Return output parameters -- NOTE: For HREPL, treat the RPC name as the same as the distributor name -- to avoid using RPC calls for HREPL since all HREPL is local -- SELECT @distributor = @loc_distributor, @distribdb = @loc_distribdb, @publisher_type = @loc_publishertype, @publisher_id = @loc_publisherid, @working_directory = @loc_working_directory, @version = @loc_version, -- Remote distributor or local with non-sysadmin rights @rpcsrvname = @loc_rpcsrvname -- -- BUGBUG : The value for @rpcsrvname must match the value returned -- by sp_helpdistributor or we will see indefinite blocking -- in some areas of our code. Example-incremental add article. -- So if you make a change here make it in sp_helpdistributor -- -- For the following cases use LOCAL SERVER NAME -- 1. Hetero will always use local server -- 2. Local distributor with sysadmin access (used to avoid blocking issues) -- if (@loc_publishertype != N'MSSQLSERVER' OR (IS_SRVROLEMEMBER('sysadmin') = 1 AND @loc_distributor = UPPER(@@SERVERNAME))) begin select @rpcsrvname = name from sys.servers where UPPER(name collate database_default ) = @loc_distributor end -- all done return 0 END
No comments:
Post a Comment