Passing IS Null to a variable

  • I have a stored procedure and I am hoping this to be a very simple question, but I don't know if I have dealt with this before. I have an SSRS report that has an internal report parameter to turn a filter either on or off. If on, I need to return records where the ReleaseDate is NOT NULL; conversely, if filter is on, I need the stored procedure to return where ReleaseDate IS NULL.

    I know that I can just create two reports, but I am hoping not to do this.

    I appreciate any help.

  • Try a where clause like:

    WHERE

    (

    releasedate IS NULL AND

    @filterparam = 'off'-- or whatever it would be when you want null

    ) OR

    (

    relasedate IS NOT NULL AND

    @filterparm = 'on'

    )

    Tim Januario

  • Yep, I was just thinking that. I am going to pass a "dummy" variable switch and I am using an IF ELSE statement.

    Thanks!

  • That's probably a better solution. Cleaner and more obvious what the purpose is.

    Tim Januario

  • And it works. Just tested it. Thanks again!

Viewing 5 posts - 1 through 4 (of 4 total)

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