Putting a parameter in a where clause

  • I am a newbie, not so much to SQL, but to reporting services.

    I am developing a report that compares results with certain limits. The user selects which limits, and the user is prompted to select up to five of them before the report runs. I have set up a column for each of the limits that says "YES" if the result is greater than the specified limit. That all works fine..

    What I want to do, is allow the user to select ALL results, or only the results that are above the specified limit for each limit. I created 5 variables (eg., @ABOVELIMIT1, @ABOVELIMIT2, etc), each of which is only allowed the value of "ALL" or "ABOVE LIMIT" for the user to select. Problem is that I am not really sure how to specify in the where statement to pull only the user specified data. I am thinking that a case statement should work, but not certain how to specify the script.

    Any help would be appreciated.

    Thank you!

  • What I want to do, is allow the user to select ALL results, or only the results that are above the specified limit for each limit

    A simplified version of your query/stored procedure might look like this:

    SELECT [Field List]

    FROM MyTable

    WHERE SomeColumn>@SomeValue

    so you would only need to pick one value. So you should be able to just use another dataset to get the values for the picklist. If you think about it, what's the difference between

    x>5

    and

    x>5 and x>4?

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

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