diff --git a/sp_QuickieStore/sp_QuickieStore.sql b/sp_QuickieStore/sp_QuickieStore.sql index 3a331ac..d3d09a3 100644 --- a/sp_QuickieStore/sp_QuickieStore.sql +++ b/sp_QuickieStore/sp_QuickieStore.sql @@ -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' @@ -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 @@ -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*/