May 14, 2012

sp_MSget_attach_state (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


sys.sp_MSget_attach_state(nvarchar @publisher
, nvarchar @publisher_db
, nvarchar @publication
, int @subscription_type)


-- This proc is called by distribution agent.
create procedure sys.sp_MSget_attach_state
@publisher sysname, -- publishing server name
@publisher_db sysname, -- publishing database name. If NULL then same as current db
@publication sysname, -- publication name,
@subscription_type int
set nocount on
declare @retcode int

-- Security Check
-- We only run on subscriber so we only need sysadmin and dbo
exec @retcode = sys.sp_MSreplcheck_subscribe
if @@error <> 0 or @retcode <> 0
return (1)

-- For non independent agent publications
if @publication is null or @publication = ''
set @publication = 'ALL'

select attach_state, attach_version from MSsubscription_agents
where UPPER(publisher) = UPPER(@publisher)
and publisher_db = @publisher_db
and publication = @publication
and subscription_type = @subscription_type

No comments:

Post a Comment

Total Pageviews