How to implement LIKE Clause in Query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saadkhan
    New Member
    • Aug 2008
    • 40

    How to implement LIKE Clause in Query?

    I want to find a certain string pattern from database and u`v used the following query for that:
    SELECT * FROM myTable
    WHERE name LIKE 'a%'

    But i want to search a pattern which is been given by the user a the same time. Can there be a variable there with LIKE?
  • Pilgrim333
    New Member
    • Oct 2008
    • 127

    #2
    Originally posted by saadkhan
    I want to find a certain string pattern from database and u`v used the following query for that:
    SELECT * FROM myTable
    WHERE name LIKE 'a%'

    But i want to search a pattern which is been given by the user a the same time. Can there be a variable there with LIKE?
    Hi,

    If you are just submitting the query, then you can use the follwing:
    Code:
     select * from myTable where name like '&p%
    This will ask for user input.

    Pilgrim

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      you can also use regular expression.

      Comment

      Working...