sys.sp_create_plan_guide

general
#stored-procedure

Description

Creates a plan guide for associating query hints or actual query plans with queries in a database. For more information about plan guides, see , with no default, and a maximum length of 124 characters. Plan guide names are scoped to the current database. and can’t start with the number sign ( A Transact-SQL statement against which to create a plan guide. When the SQL Server query optimizer recognizes a query that matches

Syntax

sp_create_plan_guide
[ @name = ]
N
'name'
[ , [ @stmt = ]
N
'stmt'
]
, [ @type = ] {
N
'OBJECT'
|
N
'SQL'
|
N
'TEMPLATE'
}
[ , [ @module_or_batch = ] {
N
' [ schema_name. ] object_name'
|
N
'batch_text'
} ]
[ , [ @params = ]
N
'@parameter_name data_type [ ,. n ]'
]
[ , [ @hints = ] {
N
'OPTION ( query_hint [ ,.n ] )'
|
N
'XML_showplan'
} ]
[ ; ]