>And how you could recognize what are you searching if you pass just a list?
>Are '12345678, 555577777' ZIP codes or phones or both?
>Why not build the whole SELECT at your front end with proper WHERE clause and the send it to SQL Server?
>You know where the user enters the search word and know what type is it, ZIP, Phone, Address1 or 2, names
>
>But use parameters:
>
>lcSELECT = [SELECT .... FROM People WHERE ]
>** Now because you know WHAT user wants
>lcSELECT = lcSELECT + [ Zip = ?Par1]
>etc.
>
I have a logic that determines what user typed. So, I was thinking I can have parameters like this
SearchStr1, SearchStr2,SearchStr3, SearchStr4, Telephone
all optional.
In the SP itself I can determine if either of the SearchStr is numeric or not. And then use different IF statements to run each SELECT, e.g.
IF COALESCE(@SearchStr1 + @SearchStr2 + @SearchStr3 + @SearchStr4) <>''
BEGIN
IF @Telephone
....
ELSE
...
END
IF COALESCE(@SearchStr1 + @SearchStr2 + @SearchStr3) <>''
..
You see the idea?
I also see your idea, may be I can work it out...
If it's not broken, fix it until it is.
My Blog