Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using a special character in a query
Message
 
 
À
03/05/2011 16:15:26
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01509279
Message ID:
01509280
Vues:
47
This message has been marked as the solution to the initial question of the thread.
>I am converting some code and, in a few places, I see that the query condition was containing the _ character. What is that character used for in a query?

It's a pattern for any 1 character. See LIKE pattern in BOL.


Wildcard character

Description

Example



%

Any string of zero or more characters.

WHERE title LIKE '%computer%' finds all book titles with the word 'computer' anywhere in the book title.



_ (underscore)

Any single character.

WHERE au_fname LIKE '_ean' finds all four-letter first names that end with ean (Dean, Sean, and so on).



[ ]

Any single character within the specified range ([a-f]) or set ([abcdef]).

WHERE au_lname LIKE '[C-P]arsen' finds author last names ending with arsen and beginning with any single character between C and P, for example Carsen, Larsen, Karsen, and so on.



[^]

Any single character not within the specified range ([^a-f]) or set ([^abcdef]).
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform