Skip to content

Commit

Permalink
Update sp_QuickieStore.sql
Browse files Browse the repository at this point in the history
Formatting tweaks
  • Loading branch information
erikdarlingdata committed Jan 23, 2024
1 parent aae1397 commit c500538
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions sp_QuickieStore/sp_QuickieStore.sql
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ BEGIN
WHEN N'@format_output' THEN '0 or 1'
WHEN N'@get_all_databases' THEN '0 or 1'
WHEN N'@workdays' THEN '0 or 1'
WHEN N'@work_start' THEN 'a "time" like 8am, 9am or something'
WHEN N'@work_end' THEN 'a "time" like 5pm, 6pm or something'
WHEN N'@work_start' THEN 'a time like 8am, 9am or something'
WHEN N'@work_end' THEN 'a time like 5pm, 6pm or something'
WHEN N'@help' THEN '0 or 1'
WHEN N'@debug' THEN '0 or 1'
WHEN N'@troubleshoot_performance' THEN '0 or 1'
Expand Down Expand Up @@ -2079,13 +2079,13 @@ BEGIN
IF @df = 1
BEGIN
SELECT
@where_clause += N'AND DATEPART(WEEKDAY, qsrs.last_execution_time) BETWEEN 1 AND 6' + @nc10;
@where_clause += N'AND DATEPART(WEEKDAY, qsrs.last_execution_time) BETWEEN 1 AND 6' + @nc10;
END;/*df 1*/

IF @df = 7
BEGIN
SELECT
@where_clause += N'AND DATEPART(WEEKDAY, qsrs.last_execution_time) BETWEEN 2 AND 6' + @nc10;
@where_clause += N'AND DATEPART(WEEKDAY, qsrs.last_execution_time) BETWEEN 2 AND 6' + @nc10;
END;/*df 7*/

IF @work_start_utc IS NOT NULL
Expand All @@ -2107,13 +2107,14 @@ BEGIN
*/
IF (@work_start_utc < @work_end_utc)
SELECT
@where_clause += N'AND CAST(qsrs.last_execution_time as time(0)) BETWEEN @work_start_utc AND @work_end_utc' + @nc10;
@where_clause += N'AND CONVERT(time(0), qsrs.last_execution_time) BETWEEN @work_start_utc AND @work_end_utc' + @nc10;
ELSE
SELECT
@where_clause += N'AND (' + @nc10 +
' CAST(qsrs.last_execution_time as time(0)) BETWEEN @work_start_utc AND ''23:59:59'' ' + @nc10 +
' OR CAST(qsrs.last_execution_time as time(0)) BETWEEN ''00:00:00'' AND @work_end_utc' + @nc10 +
')' + @nc10;
@where_clause += N'AND
(' + @nc10 +
N' CONVERT(time(0), qsrs.last_execution_time) BETWEEN @work_start_utc AND ''23:59:59'' ' + @nc10 +
N' OR CONVERT(time(0), qsrs.last_execution_time) BETWEEN ''00:00:00'' AND @work_end_utc' + @nc10 +
N')' + @nc10;
END; /*Work hours*/
END; /*Final end*/

Expand Down

0 comments on commit c500538

Please sign in to comment.