Changes the text of the abstract plan of an existing plan without changing the associated query.
sp_set_qplan id, plan
sp_set_qplan 563789159, "( g_join (scan t1) (scan t2))"
Use sp_set_qplan to change the abstract plan of an existing plan. You can specify a maximum of 255 characters for a plan. If the abstract plan is longer than 255 characters, drop the old plan with sp_drop_qplan, then use create plan to create a new plan for the query.
When you change a plan with sp_set_qplan, plans are not checked for valid abstract plan syntax and the plan is not checked for compatibility with the SQL text. Immediately check all plans modified with sp_set_qplan for correctness by running the query for the specified ID.
To find the ID of a plan, use sp_help_qpgroup, sp_help_qplan or sp_find_qplan. Plan IDs are also returned by create plan and are included in showplan output.
See also create plan in Reference Manual: Commands.
The permission checks for sp_set_qplan differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be a user with manage abstract plans privilege. Any user can execute sp_set_qplan to change the text of a plan for which they own. |
Disabled | With granular permissions disabled, you must be the database owner or a user with sa_role. Any user can execute sp_set_qplan to change the text of a plan for which they own. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|