April 17, 2012

sp_create_plan_guide (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_create_plan_guide(nvarchar @name
, nvarchar @stmt
, nvarchar @type
, nvarchar @module_or_batch
, nvarchar @params
, nvarchar @hints)

MetaData:

 create procedure sys.sp_create_plan_guide  
@name sysname,
@stmt nvarchar(max) = NULL,
@type nvarchar(60),
@module_or_batch nvarchar(max) = NULL,
@params nvarchar(max) = NULL,
@hints nvarchar(max) = NULL
as
BEGIN TRANSACTION

if( lower(@type) = 'object')
begin
declare @module nvarchar(4000)
set @module = convert(nvarchar(4000), @module_or_batch)
EXEC %%PlanGuide(Name = @name).CreateAndFireTrigger(Value = @name, Value = @stmt, Value = @type,
Value = @module, Value = @params, Value = @hints)
end
else
begin
EXEC %%PlanGuide(Name = @name).CreateAndFireTrigger(Value = @name, Value = @stmt, Value = @type,
Value = @module_or_batch, Value = @params, Value = @hints)
end

COMMIT TRANSACTION

No comments:

Post a Comment

Total Pageviews