Exports all plans for a specified user and abstract plan group to a user table.
sp_export_qpgroup usr, group, tab
is the name of the user who owns the abstract plans to be exported.
is the name of the abstract plan group that contains the plans to be exported.
is the name of a table into which to copy the plans. It must be a table in the current database. You can specify a database name, but not an owner name, in the form dbname..tablename. With large identifiers, the total length must be no more than 255 characters.
Creates a table called moveplans containing all the plans for the user “freidak” that are in the ap_stdout group:
sp_export_qpgroup freidak, ap_stdout, "tempdb..moveplans"
sp_export_qpgroup copies plans from an abstract plan group to a user table. With sp_import_qpgroup, it can be used to copy abstract plans groups between servers and databases or to assign user IDs to copied plans.
The user table name that you specify cannot exist before you run sp_export_qpgroup. The table is created with a structure identical to that of sysqueryplans.
sp_export_qpgroup uses select...into to create the table to store the copied plans. You must use sp_dboption to enable select into/bulkcopy/pllsort in order to use sp_export_qpgroup, or create the table in tempdb.
The permission checks for sp_export_qpgroup differ based on your granular permissions settings.
Granular permissions enabled |
With granular permissions enabled, you must be a user with manage abstract plans privilege. |
Granular permissions disabled |
With granular permissions disabled, you must be the database owner or a user with sa_role. |
Values in event and extrainfo columns from the sysaudits table are:
Event |
Audit option |
Command or access audited |
Information in extrainfo |
---|---|---|---|
38 |
exec_procedure |
Execution of a procedure |
|
System procedures sp_copy_all_qplans, sp_copy_qplan, sp_dboption, sp_import_qpgroup