Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Why we use the symbol '%" when we query a database?
Posted
Updated 18-May-13 1:12am
v2

All rdbms sql implementations provide wildcard. At least two of them: one for substituting any character and one for substituting any character sequence - so actually for simple pattern matching. % is for character sequences in t-sql. Look here for a more detailed explanation: http://www.w3schools.com/sql/sql_wildcards.asp[^].
 
Share this answer
 
It's the SQL equivalent of Windows '*' in file names - it means "match anything"
So in SQL
SQL
SELECT * FROM MyTable WHERE userName LIKE '%fred%'
will match
fred
freda
fred smith
john fredericks

But not
fre del
red adaire


[edit]Wow! Loads of typos... - OriginalGriff[/edit]
 
Share this answer
 
v2
Comments
FjollaValo 18-May-13 21:48pm    
thanks guys..
OriginalGriff 19-May-13 3:46am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900