Searching for Wildcard Characters
You can search for wildcard characters. There are two methods for specifying
a character that would ordinarily be a wildcard:
* Use the ESCAPE keyword to define an escape character. When the
escape character is placed in front of the wildcard in the pattern, the
wildcard is interpreted as a character. For example, to search for the
string 5% anywhere in a string, use:
WHERE ColumnA LIKE '%5/%%' ESCAPE '/'
In this LIKE clause, the leading and ending percent signs
(%) are interpreted as wildcards, and the percent sign preceded by a slash
(/) is interpreted as the % character.
* Use square brackets ([ ]) to enclose the wildcard by itself. To
search for a dash (-), rather than using it to specify a search range, use
the dash as the first character inside a set of brackets:
WHERE ColumnA LIKE '9[-]5'
(Books Online: Pattern Matching in Serach Conditions
> -----Original Message-----
> From: Conahan, Patrick [SMTP:Patrick.[Email Address Removed] Sent: Wednesday, May 08, 2002 9:40 PM
> To: [Email Address Removed] Subject: SELECTING "*"
>
> I know this is bad design, but there's no way I can get it changed.....
> I need to count the rows of a table that have "**" within a field. Of
> course I realize that its counting as a wild card. How can I get around
> this?
> In Access, I've successfully used stuff like Like "*[*]*" And Not Like
> "*[*][*]*"...but I have no idea how I'm going to do this in sql 6.5
>
> Patrick Conahan
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: mssqldba-[Email Address Removed] For additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page