The following are examples of setting resource limits.
sp_add_resource_limit NULL, payroll, tu_wed_7_10, elapsed_time, 120, 2, 1, 2
The limit is valid during the tu_wed_7_10 time range. The limit type, elapsed_time, is set to a value of 120 seconds. Because elapsed_time is enforced only at execution time, the enforced parameter is set to 2. The action parameter is set to 1, which issues a warning. The limit’s scope is set to 2, query batch, by the last parameter. Therefore, when the elapsed time of the query batch takes more than 120 seconds to execute, SAP ASE issues a warning.
sp_add_resource_limit joe_user, NULL, saturday_night, row_count, 5000, 2, 3, 1
If a query (scope = 1) returns more than 5000 rows, SAP ASE aborts the transaction (action = 3). This resource limit is enforced at execution time (enforced = 2).
sp_add_resource_limit joe_user, NULL, "at all times", io_cost, 650, 1, 3, 1
However, this resource limit specifies the default time range, “at all times.” When the optimizer estimates that the io_cost of the query (scope = 1) would exceed the specified value of 650, SAP ASE aborts the transaction (action = 3). This resource limit is enforced at preexecution time (enforced = 1).