I created this dynamic sql sp as a test.Alter PROCEDURE spDynCon @ContractNum varchar(50) = null, @PoPStart datetime = null, @PoPEnd datetime = nullASBEGIN SET NOCOUNT ON;select ConID, ProgramID, ProjID, ContractNum, PoPStart, PoPEnd from dbo.Contractswhere ContractNum like coalesce('%' + @ContractNum + '%', '%') and PoPStart = coalesce(PoPStart, @PoPStart) and PoPEnd = coalesce(PoPEnd, @PoPEnd)ENDGO
this seems to work (even though ContractNum is not nullable)However, the real question is how can I dynamically change the operators (i.e. like, not like, =, <, >, <=, >=, <>) ??I was thinking about passing an array of operators (from a web form) but with the final engine going to have say 20 potential parameters + the operators. arg! that's a lot of parametersIs there an easier way to do this? Thanks,