May 10, 2012

sp_MSdist_activate_auto_sub (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_MSdist_activate_auto_sub(int @publisher_id
, nvarchar @publisher_db
, int @article_id)

MetaData:

 CREATE PROCEDURE sys.sp_MSdist_activate_auto_sub  
(
@publisher_id int,
@publisher_db sysname,
@article_id int
)
as
begin
declare @automatic tinyint
declare @active tinyint
declare @subscribed tinyint

set nocount on
--
-- security check
-- only db_owner can execute this
--
if (is_member ('db_owner') != 1)
begin
raiserror(14260, 16, -1)
return (1)
end

select @automatic = 1
select @subscribed = 1
select @active = 2

begin transaction MSdist_activate_auto_sub

update dbo.MSsubscriptions set status = @active,
subscription_time = getdate()
where
publisher_id = @publisher_id and
publisher_db = @publisher_db and
article_id = @article_id and
sync_type = @automatic and
status in( @subscribed )

if @@ERROR <> 0
begin
if @@trancount > 0
rollback transaction MSdist_activate_auto_sub
return (1)
end

commit transaction
end

No comments:

Post a Comment

Total Pageviews