April 30, 2012

sp_IHget_loopback_detection (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
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_IHget_loopback_detection(nvarchar @publisher
, nvarchar @publisher_db
, nvarchar @publication
, nvarchar @subscriber
, nvarchar @subscriber_db)

MetaData:

   
CREATE PROCEDURE sys.sp_IHget_loopback_detection
(
@publisher sysname,
@publisher_db sysname,
@publication sysname,
@subscriber sysname,
@subscriber_db sysname
)
as
begin
set nocount on

DECLARE @retcode int

-- Security check: Sysadmins and db_owners only
exec @retcode = sys.sp_MSreplcheck_publish
if @@error <> 0 or @retcode <> 0
begin
return 1
end

-- Has to be executed from distribution database
if sys.fn_MSrepl_isdistdb (db_name()) != 1
begin
raiserror (21482, 16, -1, 'sp_IHget_loopback_detection', 'distribution')
return 1
end

select distinct loopback_detection
from
MSsubscriptions s,
master.dbo.sysservers ss
where
s.publisher_id =
(select srvid from master.dbo.sysservers
where UPPER(srvname collate database_default) = UPPER(@publisher) collate database_default) and
s.publisher_db = @publisher_db and
s.publication_id =
(select publication_id from MSpublications
where publisher_id = s.publisher_id and
publisher_db = s.publisher_db and
publication = @publication) and
s.subscriber_db = @subscriber_db and
s.subscriber_id = ss.srvid and
UPPER(ss.srvname collate database_default) = UPPER(@subscriber) collate database_default and
s.subscriber_id >= 0
end

No comments:

Post a Comment

Total Pageviews