Imports abstract plans from a user table into an abstract plan group.
sp_import_qpgroup tab, usr, group
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.
Use sp_import_qpgroup to import the plans into a new plan group.
Use sp_copy_all_qplans to copy the plans from the newly-created group to the destination group. sp_copy_all_qplans does check queries to be sure that no duplicate plans are created.
If you no longer need the group you created for the import, drop the plans in the group with sp_copy_all_qplans, then drop the group with sp_drop_qpgroup.
select * into load_table from sysqueryplans where 1 = 2
See also create plan in Reference Manual: Commands.
The permission checks for sp_import_qpgroup differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be a user with manage abstract plans privilege. |
Disabled | With granular permissions disabled, you must be the datatype owner or a user with sa_role. |
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 |
|