Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5939335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:48:50+00:00 2026-05-22T15:48:50+00:00

I am expecting this to return the value of ‘C’, but it is returning

  • 0

I am expecting this to return the value of ‘C’, but it is returning ‘A’. I cannot seem to figure out why this will not work as my logic looks sound.

DECLARE @WeekStartDay varchar(10)
DECLARE @WeekEndDay varchar(10)
SET @WeekStartDay = 'Saturday'
SET @WeekEndDay = 'Saturday'



SELECT

    CASE

        WHEN (
                ((@WeekStartDay = 'Saturday') OR (@WeekStartDay = 'Sunday'))
                         AND 
                ((@WeekEndDay <> 'Saturday') OR (@WeekEndDay <> 'Sunday'))
            )
            THEN 'A'

        WHEN (
                ((@WeekEndDay = 'Saturday') OR (@WeekEndDay = 'Sunday'))
                        AND 
                ((@WeekStartDay <> 'Saturday') OR (@WeekStartDay <> 'Sunday'))
            )
            THEN 'B'
        WHEN (
                ((@WeekEndDay = 'Saturday') OR (@WeekEndDay = 'Sunday'))
                        AND 
                ((@WeekStartDay = 'Saturday') OR (@WeekStartDay = 'Sunday'))
            ) 
            THEN 'C'

    END AS Result

My intended function is:

I am trying to get it to deteremine

IF the @WeekStartDay = Saturday or Sunday AND @WeekEndDay IS NOT Saturday or Sunday THEN ‘A’

IF the @WeekEndDay = Saturday or Sunday AND @WeekStartDay IS NOT Saturday or Sunday THEN ‘B’

IF @WeekStartDay AND @WeekEndDay BOTH = Saturday or Sunday THEN ‘C’

Hmmm from responses looks like my logic was way more off than I thought.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:48:50+00:00Added an answer on May 22, 2026 at 3:48 pm

    Substituting the parameter values in as literals gives (for the first case)

             WHEN ((('Saturday' = 'Saturday')  OR ('Saturday' = 'Sunday'))
                               AND 
                   (( 'Saturday' <> 'Saturday') OR ( 'Saturday' <> 'Sunday')))
    

    Which is

             WHEN ((True OR False) AND (False OR True))
    

    Which is

             WHEN (True AND True)
    

    Which is

             WHEN (True)
    

    I think you need

    SELECT
        CASE WHEN @WeekStartDay IN ('Saturday', 'Sunday') THEN 
            CASE WHEN @WeekEndDay IN ('Saturday', 'Sunday') THEN 
                'C'
            ELSE 
                'A'
            END 
        ELSE 
            CASE WHEN @WeekEndDay IN ('Saturday', 'Sunday') THEN 
                'B'
            ELSE 
                NULL /*You haven't said what should happen here?*/
            END 
        END
     AS Result
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey I have this code but it doesn't work because it is expecting a
I'm having this problem with the grails liferay-plugin: localhost_liferay_portlet_WEB_INF_grails_app_views_test_view_gsp: 17: expecting anything but ''\n'';
Outline OK, I have Google'd this and already expecting a big fat NO!! But
Sounds simple enough, but its not working. In this example, I want to set
sed s/\(.*\)/\t\1/ $filename > $sedTmpFile && mv $sedTmpFile $filename I am expecting this sed
I am expecting when I go $.each($(something).find(something), function(){ $(this).delay(1000).fadeOut(); }); then for each matching
If that title did not make sense (which I'm expecting =)) here is what
I know that CAS is of limited value , but I want to learn
Please I need help getting the exact md5 value of this python script in
I expecting the following to return true. public class HudsonJob { private String name;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.