Changes the start day, start time, end day, and/or end time associated with a named time range.
sp_modify_time_range name, startday, endday, starttime, endtime
is the name of the time range. This must be the name of a time range stored in the systimeranges system table of the master database.
is the day of the week on which the time range begins. This must be the full weekday name for the default server language, as stored in the syslanguages system table of the master database, or null to keep the existing startday.
is the day of the week on which the time range ends. This must be the full weekday name for the default server language, as stored in the syslanguages system table of the master database, or null to keep the existing end day. The endday can fall either earlier or later in the week than the startday, or it can be the same day as the startday.
is time of day at which the time range begins. Specify the starttime in terms of a twenty-four hour clock, with a value between 00:00 and 23:59. Use the following form, or null to keep the existing starttime:
"HH:MM"
is the time of day at which the time range ends. Specify the endtime in terms of a twenty-four hour clock, with a value between 00:00 (midnight) and 23:59. Use the following form, or null to keep the existing endtime:
"HH:MM"
The endtime must occur later in the day than the starttime, unless endtime is 00:00.
For time ranges that span the entire day, specify a start time of “00:00” and an end time of “23:59”.
Changes the end day of the “business_hours” time range from Friday to Saturday. Retains the existing start day, start time, and end time:
sp_modify_time_range business_hours, NULL, Saturday, NULL, NULL
Specifies a new end day and end time for the “before_hours” time range:
sp_modify_time_range before_hours, Monday, Saturday, NULL, "08:00"
You cannot modify the “at all times” time range.
It is possible to modify a time range so that it overlaps with one or more other time ranges.
The modification of time ranges through the system stored procedures does not affect the active time ranges for sessions currently in progress.
Changes to a resource limit that has a transaction as its scope does not affect any transactions currently in progress.
The permission checks for sp_modify_time_range differ based on your granular permissions settings.
Granular permissions enabled |
With granular permissions enabled, you must be a user with manage resource limit privilege. |
Granular permissions disabled |
With granular permissions disabled, you must be 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 |
|
Documents For more information, see the System Administration Guide.
System procedures sp_add_resource_limit, sp_add_time_range, sp_drop_time_range