Skip to main content
Participating Frequently
May 28, 2008
Question

sql Like statement

  • May 28, 2008
  • 2 replies
  • 548 views
how can i get all records starting with % ?
This topic has been closed for replies.

2 replies

Participating Frequently
June 9, 2008
This works for SQL server:
select * from tablename where Left(myfield, 1) = '%'
Participating Frequently
June 9, 2008
Something that I found here ( SQL Tutorial) might help:

The optional ESCAPE sub-clause specifies an escape character for the pattern, allowing the pattern to use '%' and '_' (and the escape character) for matching. The ESCAPE value must be a single character string. In the pattern, the ESCAPE character precedes any character to be escaped.
For example, to match a string ending with '%', use:

x LIKE '%/%' ESCAPE '/'


..or here Using SQL Escape Sequences

... or here How to escape a wildcard in an SQL order with ORACLE.

Phil
Inspiring
May 28, 2008
Does your db have string functions?