Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Search by each word in a phrase
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01331706
Message ID:
01331806
Vues:
8
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform