Bonjour,
En utilisant la fonction Contains de full Text search :
pour chercher un simple mot , on le met entre de côtes de la façon suivante:
' monMot '
Pour chercher un texte , on le fait de la façon suivante :
'"mon mot à chercher"'
et ce d'après la documentation msdn :
C'est simple lorsque vous entrez directement le mot ou la phrase à chercher , mais lorsque vous la récupérer dans une variable puis la passer à la fonction contains ça devient compliqué<simple_term>
Specifies a match for an exact word or a phrase. Examples of valid simple terms are "blue berry", blueberry, and "Microsoft SQL Server". Phrases should be enclosed in double quotation marks (""). Words in a phrase must appear in the same order as specified in <contains_search_condition> as they appear in the database column. The search for characters in the word or phrase is not case-sensitive. Noise words (or stopwords) (such as a, and, or the) in full-text indexed columns are not stored in the full-text index. If a noise word is used in a single word search, SQL Server returns an error message indicating that the query contains only noise words. SQL Server includes a standard list of noise words in the directory \Mssql\Binn\FTERef of each instance of SQL Server.
Punctuation is ignored. Therefore, CONTAINS(testing, "computer failure") matches a row with the value, "Where is my computer? Failure to find it would be expensive." For more information on word-breaker behavior, see Word Breakers and Stemmers.
par exemple j'ai une variable @searchedText qui prend une valeur saisie par l'utilisateur puis je vais la passer à la fonction contains : contains (maTable.attribut, @searchedText ), comment je peuxmettre ici @searchedText entre ""
Merci de m'aider![]()
Partager