May 31, 2013 at 3:15 pm
I have a table with column A. Column A has values 1 or 0. The values represent 2 different outcomes. 1 is cats and 0 is dogs. I want to be able to use the column in a where clause as part of a stored procedure. The parameters are @cats and @dogs. The user can select either @cats or @dogs, or they can select both. If the don't make a selection I want to return both.
If (@cats is 1 and @dogs is 0) then 'all cats'
if (@cats is 0 and @dogs is 1) then 'all dogs'
else 'all cats and all dogs'
May 31, 2013 at 3:34 pm
This seems like a simplified catch-all queries
http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply