SQL wildcard
What is SQL wildcard?I am not familiar with it.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Priya LingeRank #785 · 2.9K reputationPosted Nov 21, 2011, 7:46 PM EST
1.SQL wildcards can be used when searching for data in a database.
2.SQL wildcards can substitute for one or more characters when searching for data in a database.
SQL wildcards must be used with the SQL LIKE operator.
WildCard
% : A substitute for zero or more characters
_ : A substitute for exactly one character
[charlist] :Any single character in charlist
[^charlist]
or :Any single character not in charlist
[!charlist]
3.Example :
we want to select the persons living in a city that starts with "sa" from the "Persons" table.
SELECT * FROM Persons WHERE City LIKE 'sa%'
we want to select the persons living in a city that contains the pattern "nes" from the "Persons" table.
SELECT * FROM Persons WHERE City LIKE '%nes%'
we want to select the persons with a first name that starts with any character, followed by "la" from the "Persons" table.
SELECT * FROM Persons
WHERE FirstName LIKE '_la'
For more information please check below link,
http://www.w3schools.com/sql/sql_wildcards.asp
http://www.roseindia.net/sql/SQL_Wildcards.shtml
Hope this will help you.
Thanks.
Satyapriya NayakRank #47 · 31.5K reputationPosted Nov 21, 2011, 8:15 PM EST
Please refer our recommended article
Wildcards in SQL Server 2005
http://www.c-sharpcorner.com/uploadfile/karthikarajamma/wildcards-in-sql-server-2005/default.aspx
Thanks