Create a new resource limit with sp_add_resource_limit. The syntax is:
sp_add_resource_limit name, appname, rangename, limittype, limit_value, enforced, action, scope
Use this system procedure’s parameters to:
Specify the name of the user or application to which the resource limit applies.
You must specify either a name or an appname or both. If you specify a user, the name must exist in the syslogins table. Specify “null” to create a limit that applies to all users or all applications.
Specify the type of limit (io_cost, row_count, elapsed_time, or tempdb_space), and set an appropriate value for the limit type.
For more information, see “Choosing a limit type”.
Specify whether the resource limit is enforced prior to or during query execution.
Specify numeric values for this parameter. Preexecution time resource limits, which are specified as 1, are valid only for the io_cost limit. Execution time resource limits, which are specified as 2, are valid for all three limit types. For more information, see “Determining time of enforcement”.
Specify the action to be taken (issue a warning, abort the query batch, abort the transaction, or kill the session).
Specify numeric values for this parameter.
Specify the scope (query, query batch, or transaction).
Specify numeric values for this parameter. For more information, see “Determining the scope of resource limits”.
For detailed information, see sp_add_resource_limit in the Reference Manual.