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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding Special Characters

Status
Not open for further replies.
May 7, 1999
130
US
How do I do a "find" for a special character (e.g., asterisk, forward or backward slash, question mark) within a column of a table or within a query? Presumably there are some special characters that tell the query engine to consider the following character(s) literally.

Thanks!
John Harkins
 
Are you looking just to return the special character, or the field's contents, IF it contains the special character?

In a query, a criteria of LIKE "*/*" will return the field if ANY character in it is a backslash. The asterisks are delimiters indicating ANY character, as they have been since the dawn of time.. [smile]

You can also use EDIT/Search off the menu system if you want to do this interactively versus programmatically.

Jim Hare
"Remember, you're unique - just like everonone else"
 
If you are using the LIKE predicate, you can search for wildcards and other special characters embedded in a colmn by enclosing the character in brackets.

Where colname Like "*[*]*"

You can also use the Instr function.

WHERE InStr(ColName,"*"))>0
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top