I am trying to create a stored procedure to look for information in specific fields. I am trying to do this by creating a parameter for each field.
Parameters passed:
@strField1 as varchar(20)
@strField2 as varchar (20)
@strField3 as varchar (20)
Values that can be passed:
--For testing purposes
set @strField1='%'
set @strField2='%'
set @strField3='String I'm looking for%'
Any one of the fields can be populated with information at any time.
My select statement looks like:
Select * from MyTable where
Field1 = @strField1 and
Field2 = @strField2 and
Field3 = @strField3
I am not getting all the data back with the select statement. I get only partial results. Is this because you cannot use a wildcard by itself?
Thanks in advance,
Kflasph
Parameters passed:
@strField1 as varchar(20)
@strField2 as varchar (20)
@strField3 as varchar (20)
Values that can be passed:
--For testing purposes
set @strField1='%'
set @strField2='%'
set @strField3='String I'm looking for%'
Any one of the fields can be populated with information at any time.
My select statement looks like:
Select * from MyTable where
Field1 = @strField1 and
Field2 = @strField2 and
Field3 = @strField3
I am not getting all the data back with the select statement. I get only partial results. Is this because you cannot use a wildcard by itself?
Thanks in advance,
Kflasph