An expression of non-boolean type specified in a context where a condition is expected, near 'AND'.

  • WHERE

    CASE @UWDECISSION

    WHEN 'DECLINED' THEN (SELECT [TBL_IL_PTRNPF].BATCTRCDE FROM [TBL_IL_PTRNPF] WHERE BATCTRCDE = 'T644')

    WHEN 'POSTPONED' THEN (SELECT [TBL_IL_PTRNPF].BATCTRCDE FROM [TBL_IL_PTRNPF] WHERE BATCTRCDE = 'TA63')

    ELSE (SELECT [TBL_IL_PTRNPF].BATCTRCDE FROM [TBL_IL_PTRNPF] WHERE BATCTRCDE IN ( 'T644','TA63'))

    END

    i am getting error like this

    "An expression of non-boolean type specified in a context where a condition is expected, near 'AND'"

    could you please help me to fix this error. advance thank you.

  • kuchanarajendraprasad (6/4/2015)


    WHERE

    CASE @UWDECISSION

    WHEN 'DECLINED' THEN (SELECT [TBL_IL_PTRNPF].BATCTRCDE FROM [TBL_IL_PTRNPF] WHERE BATCTRCDE = 'T644')

    WHEN 'POSTPONED' THEN (SELECT [TBL_IL_PTRNPF].BATCTRCDE FROM [TBL_IL_PTRNPF] WHERE BATCTRCDE = 'TA63')

    ELSE (SELECT [TBL_IL_PTRNPF].BATCTRCDE FROM [TBL_IL_PTRNPF] WHERE BATCTRCDE IN ( 'T644','TA63'))

    END

    i am getting error like this

    "An expression of non-boolean type specified in a context where a condition is expected, near 'AND'"

    could you please help me to fix this error. advance thank you.

    The logic you posted there should evaluate to TRUE or FALSE (1 or 0) for the WHERE clause syntax to be correct. Are you forgetting to compare the result of the CASE statement to a certain value?



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • CASE

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply