Simple table:
create table Items
(
Price money null
)
Now I need to create a stored procedure that accepts one paramter of type bit @ItemsWithPriceTenDollarsOrMore which:
I have difficulty expressing this filter in a single where statement (not using dynamic sql or conditional logic).
Try this one:
SELECT * FROM Items
WHERE (@ItemsWithPriceTenDollarsOrMore = 1 AND Price >=10)
OR (@ItemsWithPriceTenDollarsOrMore = 0 AND Price <10)
OR (@ItemsWithPriceTenDollarsOrMore IS NULL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With