Imports abstract plans from a user table into an abstract plan group.
sp_import_qpgroup tab, usr, group
is the name of a table from which to copy the plans. You can specify a database name, but not an owner name, in the form dbname..tablename. The total length must be 30 characters or less.
is the name of the user whose ID should be assigned to the abstract plans when they are imported.
is the name of the abstract plan group that contains the plans to be imported.
Copies plans from the table moveplans to the new_plans group, giving them the user ID for the Database Owner:
sp_import_qpgroup moveplans, dbo, new_plans
sp_import_qpgroup copies plans from a user table to an abstract plan group in sysqueryplans. With sp_export_qpgroup, it can be used to copy abstract plan groups between servers and databases, or to copy plans belonging to one user and assign them the ID of another user.
sp_import_qpgroup creates the abstract plan group if it does not exist when the procedure is executed.
If an abstract plan group exists when sp_import_qpgroup is executed, it cannot contain any plans for the specified user. sp_import_qpgroup does not check the query text to determine whether queries already exist in the group. If you need to import plans for a user into a group where some plans for the user already exist:
Use sp_import_qpgroup to import the plans into a new plan group.
To create an empty table in order to bulk copy abstract plans, use:
select * into load_table from sysqueryplans where 1 = 2
Only a System Administrator or the Database Owner can execute sp_import_qpgroup.
Commands create plan
System procedures sp_copy_all_qplans, sp_copy_qplan, sp_drop_all_qplans, sp_drop_qpgroup, sp_export_qpgroup, sp_help_qpgroup