April 18, 2012

sp_dropanonymousagent (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_dropanonymousagent(uniqueidentifier @subid
, int @type)

MetaData:

   

create procedure sys.sp_dropanonymousagent
@subid uniqueidentifier,
@type int -- 1 tran sub, 2 merge sub
as
set nocount on
declare @login sysname
-- Null @login indicates sysadmin or db_owner
if IS_SRVROLEMEMBER ('sysadmin') = 0 and is_member('db_owner') = 0
select @login = suser_sname()
--
-- Get distribution server information for remote RPC
-- agent verification.
--
declare @distributor sysname
declare @distribdb sysname
declare @distproc nvarchar(1000)
declare @retcode int

EXEC @retcode = sys.sp_MSrepl_getdistributorinfo @rpcsrvname = @distributor OUTPUT,
@distribdb = @distribdb OUTPUT

IF @@error <> 0 OR @retcode <> 0
BEGIN
RAISERROR (14071, 16, -1)
RETURN (1)
END

--
-- Call proc to change the distributor
--
SELECT @distproc = QUOTENAME(RTRIM(@distributor)) + '.' + QUOTENAME(@distribdb) +
'.dbo.sp_MSdrop_anonymous_entry'

exec @retcode = @distproc
@subid = @subid,
@login = @login,
@type = @type

IF @@error <> 0 OR @retcode <> 0
RETURN (1)

RETURN (0)

No comments:

Post a Comment

Total Pageviews