June 11, 2012

sp_subscribe (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_subscribe(nvarchar @publication
, nvarchar @article
, nvarchar @destination_db
, nvarchar @sync_type
, nvarchar @loopback_detection)

MetaData:

 create procedure sys.sp_subscribe   
(
@publication sysname, -- publication name --
@article sysname = 'all', -- article name --
@destination_db sysname = NULL, -- subscriber database --
@sync_type nvarchar (15) = 'automatic', -- subscription sync type --
@loopback_detection nvarchar(5) = NULL -- loopback detection - use default
)
as
begin

-- New 7.0 sp_addsubscription parameters
DECLARE @subscriber sysname
DECLARE @status sysname
DECLARE @subscription_type nvarchar(4)
DECLARE @update_mode nvarchar(15)
DECLARE @enabled_for_syncmgr nvarchar(5)
DECLARE @retcode int

SET NOCOUNT ON

-- sp_subscribe has to be called from a remote subscriber
-- If not, we state that it is unsupported
SELECT @subscriber = @@REMSERVER
IF @subscriber IS NULL
BEGIN
RAISERROR (21023, 16, -1,'sp_subscribe')
RETURN(1)
END

SELECT @status = NULL
SELECT @subscription_type = 'push'
SELECT @update_mode = 'read only'
SELECT @enabled_for_syncmgr = 'false'

-- Call sp_addsubscription to do the actual work
EXEC @retcode = sys.sp_addsubscription @publication = @publication,
@article = @article,
@destination_db = @destination_db,
@sync_type = @sync_type,
@subscriber = @subscriber,
@status = @status,
@subscription_type = @subscription_type,
@update_mode = @update_mode,
@loopback_detection = @loopback_detection,
@enabled_for_syncmgr = @enabled_for_syncmgr

RETURN @retcode
end

No comments:

Post a Comment

Total Pageviews