SQL LIKE CLAUSE IN SQLSERVER

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 749  View(s)
Ratings:
Rate this:
i want to use  LIKE clause How to use .
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: SQL LIKE clause in Sqlserver

    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_'

     

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!