You can do this with just using an OR
statement in your WHERE
criteria:
CREATE PROCEDURE quoteConversionByCategory(
@startDate date,
@endDate date,
@lowerPriceLimit numeric(18),
@upperPriceLimit numeric(18)
)
AS
BEGIN
SELECT *
FROM XYZTABLE
WHERE price > 0
AND ORIGQUOTEDATE >= @startDate
AND ORIGQUOTEDATE <= @endDate
AND (Order_Total >= @lowerPriceLimit OR @lowerPriceLimit = 0)
AND (Order_Total <= @upperPriceLimit OR @upperPriceLimit = 0)
Depending on how your passing the lower and upper limits, you may need to alter the OR
criteria above. For example:
(Order_Total <= @upperPriceLimit OR @upperPriceLimit IS NULL)