sp_setpsexe

Description

Sets custom execution attributes for a session while the session is active.

Syntax

sp_setpsexe spid, exeattr, value

Parameters

spid

is the ID of the session for which to set execution variables. Use sp_who to see spids.

exeattr

identifies the execution attribute to be set. Values are priority and enginegroup.

value

is the new value of exeattr. Values for each attribute are as follows:

  • If exeattr is priority, value is HIGH, MEDIUM, or LOW.

  • If exeattr is enginegroup, value is the name of an existing engine group.

Examples

Example 1

This example sets the priority of the process with an ID of 1 to HIGH:

sp_setpsexe 1, "priority", "HIGH"

Usage

Permissions

The permission checks for sp_setpsexe differ based on your granular permissions settings.

Granular permissions enabled

With granular permissions enabled, you must be a user with manage any execution class privilege.

Any user can execute sp_setpsexe to lower the priority of a process owned by that user.

Granular permissions disabled

With granular permissions disabled, you must be a user with sa_role.

Any user can execute sp_setpsexe to lower the priority of a process owned by that user.

Auditing

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

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

See also

System procedures sp_addexeclass, sp_bindexeclass, sp_dropexeclass, sp_showexeclass