Home > DeveloperSection > Forums > SQL LIKE clause in Sqlserver
Ankit Singh

Total Post:341

Points:2389
Posted on    November-24-2015 9:56 PM

 Database Database  SQL Server  SQL 
Ratings:


 1 Reply(s)
 401  View(s)
Rate this:
i want to use  LIKE clause How to use .


aditya kumar Patel

Total Post:250

Points:1782
Posted on    November-24-2015 10:05 PM

The SQL LIKE clause is used to compare a value to similar values using wildcard operators. There are two wildcards used in conjunction with the LIKE operator:
The percent sign (%)
The underscore (_)
The percent sign represents zero, one, or multiple characters. The underscore represents a single number or character. The symbols can be used in combinations.

SELECT * FROM Customer

WHERE CustomerName LIKE 'a%'

GO

SELECT * FROM Customer

WHERE CustomerName LIKE '%a%'

Go

SELECT * FROM Customer

WHERE CustomerName LIKE 'a_'

Go

SELECT * FROM Customer

WHERE CustomerName LIKE '_a'

GO

SELECT * FROM Customer

WHERE CustomerName LIKE '_a_'

 


Don't want to miss updates? Please click the below button!

Follow MindStick