Changes the text of the abstract plan of an existing plan without changing the associated query.
sp_set_qplan id, plan
is the ID of the abstract plan.
is a new abstract 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, you can drop the old plan with sp_drop_qplan and 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. Also, the plan is not checked for compatibility with the SQL text. All plans modified with sp_set_qplan should be immediately checked 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.
Any user can execute sp_set_qplan to change the text for a plan that he or she owns. Only the System Administrator or the Database Owner can change the text for a plan that belongs to another user.
Commands create plan
System procedures sp_drop_qpgroup, sp_drop_qplan, sp_find_qplan, sp_help_qplan