Hi,
I am building a search Query which takes 7 parameters:
Lets call them @P1 .. @P7 (all Int's)
The query is a simple select query like:
SELECT * FROM MyTable WHERE (Field1 = @P1) AND (Field2 = @P2) ....
My problem is that if some parameters are -1 they shall be disregarded.
Is there any way to set a parameter to a value meaning "Anything", or do I
have to
remove the criteria from the select clause?
(In the latter case I cannot use a stored procedure, which is what I prefer)
Cheers
Gunnar
I am building a search Query which takes 7 parameters:
Lets call them @P1 .. @P7 (all Int's)
The query is a simple select query like:
SELECT * FROM MyTable WHERE (Field1 = @P1) AND (Field2 = @P2) ....
My problem is that if some parameters are -1 they shall be disregarded.
Is there any way to set a parameter to a value meaning "Anything", or do I
have to
remove the criteria from the select clause?
(In the latter case I cannot use a stored procedure, which is what I prefer)
Cheers
Gunnar
Comment