Then how about this:
A bitwise operation is certainly faster that at most 4 comparisons.Code:DECLARE @Quarters AS int SET @Quarters = @Quarter1 | @Quarter2 | @Quarter3 | @Quarter4 SELECT * FROM Sales WHERE Sales.FiscalYear = @FiscalYear AND (Sales.Quarter & @Quarters) != 0




Reply With Quote