Changing an existing plan

sp_set_qplan changes the abstract plan for an existing plan ID without changing the ID or the query text. It can be used only when the plan text is 255 or fewer characters.

sp_set_qplan 588529130, "( i_scan title_ix titles)"

A System Administrator or Database Owner can change the abstract plan for any saved query. Other users can modify only plans that they own.

When you execute sp_set_qplan, the abstract plan is not checked against the query text to determine whether the new plan is valid for the query, or whether the tables and indexes exist. To test the validity of the plan, execute the associated query.

You can also use create plan and the plan clause to specify the abstract plan for a query. See “Creating plans using SQL”.