Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sp_QuickieStore - Bug in determining workdays #420

Closed
ehaar opened this issue May 14, 2024 · 0 comments · Fixed by #421
Closed

sp_QuickieStore - Bug in determining workdays #420

ehaar opened this issue May 14, 2024 · 0 comments · Fixed by #421

Comments

@ehaar
Copy link

ehaar commented May 14, 2024

Version of the script

@version = '4.5',
@version_date = '20240401';

What is the current behavior?
Somewhere around line 2450 a WHERE-clause is built to only include results for working-days (Mondays to Fridays).

If @df = 7 (first day of week is Sunday) the WEEKDAY-range must be between 2 and 6, which is correct.

However, if @df = 1 (first day of week is Monday) the WEEKDAY-range should be between 1 and 5, but sp_QuickieStore takes the range between 1 and 6. This way, the queries from Saturday would also be included, which is not right:

    IF @df = 1
    BEGIN
       SELECT
           @where_clause += N'AND   DATEPART(WEEKDAY, qsrs.last_execution_time) BETWEEN 1 AND 6' + @nc10; <----- 6 should be 5
    END;/*df 1*/

    IF @df = 7
    BEGIN
       SELECT
           @where_clause += N'AND   DATEPART(WEEKDAY, qsrs.last_execution_time) BETWEEN 2 AND 6' + @nc10;
    END;/*df 7*/
erikdarlingdata added a commit that referenced this issue May 14, 2024
@erikdarlingdata erikdarlingdata mentioned this issue May 14, 2024
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant