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

  • Hi all,

    I have a report with this query which has the below filter:

    WHERE (CASE_STATUS IN (@CaseStatus) or CASE_STATUS is null)

    AND

    (

    (NULLIF(isnull(d.dw_ac_approval_date,''),'') IS NOT NULL and @approval_date = 'YES')

    OR (NULLIF(isnull(d.dw_ac_approval_date,''),'') IS NULL and @approval_date = 'NO')

    )

    I have selected in the approval_date parameter in the report to allow multiple values and blank values. However It only works either WHEN YES OR NO is selected and gives the above subject error when Select all is selected.

    Any Help is appreciated

    EO

  • This seems to work for me in another way. I now have ALL in the parameter select box which shows everything .

    AND

    (

    (NULLIF(isnull(d.dw_ac_approval_date,''),'') IS NOT NULL and @approval_date = 'YES')

    OR (NULLIF(isnull(d.dw_ac_approval_date,''),'') IS NULL and @approval_date = 'NO')

    )

    OR (NULLIF(isnull(d.dw_ac_approval_date,''),'') is not null and @approval_date = 'all') OR (NULLIF(isnull(d.dw_ac_approval_date,''),'') is null and @approval_date = 'all')

  • eobiki10 (2/2/2016)


    This seems to work for me in another way. I now have ALL in the parameter select box which shows everything .

    AND

    (

    (NULLIF(isnull(d.dw_ac_approval_date,''),'') IS NOT NULL and @approval_date = 'YES')

    OR (NULLIF(isnull(d.dw_ac_approval_date,''),'') IS NULL and @approval_date = 'NO')

    )

    OR (NULLIF(isnull(d.dw_ac_approval_date,''),'') is not null and @approval_date = 'all') OR (NULLIF(isnull(d.dw_ac_approval_date,''),'') is null and @approval_date = 'all')

    This would be a heck of a lot easier if you removed the nonsense expressions:

    SELECT MyDate, NULLIF(isnull(MyDate,''),'')

    FROM (VALUES

    (CAST('20160202' AS date)),

    (NULL)

    ) d (MyDate)

    “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