I have a stored procedure that I am using to pass several variables from a form to search a few tables to get data. I would like allow the user to select the operator plus enter a value to further filter results.For example, allow them to search a field for values greater then 10:Size > 10I would want to pass in the '>' and the value '10' into the following sp.Here is my sp:ALTER PROCEDURE [dbname].[sp_Search] @vDESC varchar(150), @vAVLQTY varchar(30) = '', @vOVRSZ varchar(3) = ''ASBEGIN SET NOCOUNT ON; DECLARE @AvDESC_V2 varchar(152) SET @vDESC_V2 = '%' + @vDESC + '%' SELECT [id] ,[itemno], [desc] ,[entry_dt] ,[modified_dt] FROM maindatatable WHERE desc like @vDESC_V2 AND ((@vAVLQTY = '') OR (AVLQTY = @vAVLQTY)) AND ((@vOVRSZ = '') OR (OVRSZ = @vOVRSZ))END
Is there a good way of doing this without creating dynamic sql?