Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select a character that is also a wildcard 2

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, I like to select from a table column strings that contains the underscore ( _ ) character (for example
U1.01/98_0, U1.01/98_1, U2.01/95_0 etc. ). The problem is that this character is also a whildcard (single-character
whildcard ) and because of this the SQL statement " ....... LIKE '%_%' " does not work properly.
What is the SQL syntax for this query? (I'm using MS Access)
Thanks for your help!
 
If you don't get a satisfactory answer in this ANSI SQL forum, try reposting in the MS Access forum. I know how to do this in Oracle, but I doubt that the Access syntax is the same.

I quick search of the online help in Access 97 leads me to believe that the single character wildcard is "?" in Access, not "_". It appears that one can get Access to suppress the wildcard function of any character by enclosing it in brackets. I was unable to verify that "_" is a wildcard, but if it is, something like " ....... LIKE '%[_]%' " should work.
 
From Access 2000 help...
When using wildcard characters to search for an asterisk (*), question mark (?), number sign (#), opening bracket ([), or hyphen (-), you must enclose the item you're searching for in brackets. For example, to search for a question mark, type [?] in the Find dialog box. If you're searching for a hyphen and other characters simultaneously, place the hyphen before or after all the other characters inside the brackets. (However, if you have an exclamation point (!) after the opening bracket, place the hyphen after the exclamation point.) If you're searching for an exclamation point (!) or closing bracket (]), you don't need to enclose it in brackets.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top