June 11, 2012

sp_syspolicy_subscribe_to_policy_category (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_syspolicy_subscribe_to_policy_category(nvarchar @policy_category)

MetaData:

 CREATE PROCEDURE sys.sp_syspolicy_subscribe_to_policy_category  
@policy_category sysname
AS
BEGIN
IF( @policy_category IS NULL)
BEGIN
RAISERROR(14043, -1, -1, '@policy_category', 'sp_syspolicy_subscribe_to_policy_category')
RETURN(1)
END

IF (IS_MEMBER('db_owner') != 1)
BEGIN
RAISERROR(21050, -1, -1)
RETURN(1)
END
DECLARE @dbname sysname
SET @dbname = DB_NAME()
DECLARE @ret int
EXEC @ret = [msdb].[dbo].[sp_syspolicy_add_policy_category_subscription]
@target_type = N'DATABASE',
@target_object = @dbname,
@policy_category = @policy_category
RETURN @ret
END

No comments:

Post a Comment

Total Pageviews