Is it possible to build the list of operators "dynamically"? In other words, in the WHERE clause I want to vary some of the operators on a case by case basis. Is this possible? I've tried the query below (after many other unsucessful attempts) but still getting an error: Server: Msg 170, Level 15, State 1, Line 8Line 8: Incorrect syntax near '='.SELECT AcctNum, FirstName, LastName, OrderType, ShimpmentType, RepID, TeamIDFROM CustomersWHERE RepID = @pRepIDAND TeamID = @pTeamID--Start custom and all filtersANDCASE WHEN @pFilter = 'JSmith' THENOrderType = 'New' AND StatusInDays > 7OR ShipmentType = 'UPS'WHEN @pFilter = 'Platnum' THENOrderType = 'Priority' AND StatusInDays > 2OR ShipmentType = 'FedEx'END
thanks,Cameron