Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Search by each word in a phrase
Message
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Search by each word in a phrase
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01331706
Message ID:
01331706
Vues:
50
Hi everybody,

I'm thinking of writing an SP that would attempt to seach mutltiple fields by each word in a phrase. Here is a part I'm not sure how to handle.

Say, I pass "Name1 Name2" and I need to create a query like this

select ... from ... where (field1 like "Name1%" or field2 like "Name1%" etc.) and (field1 like "Name2" or ...)

I can get a list of words into table valued function, but does it mean I would have to create a dynamic SQL? In this case I don't need an SP, I guess.

Since I would probably have just few words (less than 4, I guess) I may try to code with IF statements...

Appreciate your ideas.

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform