MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 467

Developing coldfusion mx applications
Table of Contents

Advertisement

LIKE conditional
This conditional lets you perform wildcard searches, in which you compare your data to search
patterns. This strategy differs from other conditionals, such as BETWEEN or IN, because the
LIKE conditional compares your data to a value that is partially unknown.
Syntax
like_cond ::= left_string_exp [NOT] LIKE right_string_exp [ESCAPE escape_char]
The left_string_exp can be either a constant string, or a column reference to a string column. The
right_string_exp can be either a column reference to a string column, or a search pattern. A search
pattern is a search condition that consists of literal text and at least one wildcard character. A
wildcard character is a special character that represents an unknown part of a search pattern, and is
interpreted as follows:
The underscore (_) represents any single character.
The percent sign (%) represents zero or more characters.
Square brackets ([ ]) represents any character in the range.
Square brackets with a caret [^] represent any character not in the range.
All other characters represent themselves.
Note: Earlier versions of ColdFusion do not support bracketed ranges.
Examples
The following example uses the LIKE conditional to retrieve only those dogs of the breed Terrier,
whether the dog is a Boston Terrier, Jack Russell Terrier, Scottish Terrier, and so on:
SELECT dog_name, dog_IQ, breed
FROM Dogs
WHERE breed LIKE '%Terrier';
The following examples are select statements that use bracketed ranges:
SELECT lname FROM Suspects WHERE lname LIKE 'A[^c]%';
SELECT lname FROM Suspects WHERE lname LIKE '[a-m]%';
SELECT lname FROM Suspects WHERE lname LIKE '%[]';
SELECT lname FROM Suspects WHERE lname LIKE 'A[%]%';
SELECT lname FROM Suspects WHERE lname LIKE 'A[^c-f]%';
Case sensitivity
ColdFusion supports two string functions,
case-insensitive matching.
Examples
The following example matches only 'Sylvester':
SELECT dog_name
FROM Dogs
WHERE dog_name LIKE 'Sylvester';
and
UPPER()
LOWER()
, which you can use to achieve
Query of Queries user guide
467

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents