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

Search for * 1

Status
Not open for further replies.

csk003

Programmer
Feb 9, 2004
26
0
0
US
How can I search for character * through a query in a column's data?
 
One way:
WHERE FieldName LIKE '*[*]*'

Another way:
WHERE InStr(FieldName, '*') > 0

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I see, need the brackets for the *, interesting.....learn something new everyday.

Thanks!
Les
 
need the brackets for the *
Yes, JetSQL lacks the Escape character ...
 
Thanks PHV.
I am trying to replace this * with null and I am using this query
update test1 set column1 = replace(column1,'*[*]*' ,"",1)
Nothing gets replaced. Any ideas?
 
I think the replace function is looking to replace
*[*]*, which it is not finding. Have you tried:
[tt]
replace(column1, "*", "")[/tt]
 
Furthermore, to avoid unnecessary updates:
UPDATE test1
SET column1 = Replace([column1], '*', '')
WHERE column1 Like '*[*]*'


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thak you Paul. I was thinking it would replace all characters if use "*" as it is wildcard but as we are using in " should be fine.
 
Thanks PHV. I am glad the query now prompts that it only updates how many ever rows that had * now instead of all the rows that the table has (it was giving this message earlier which got me confused)
 
For me it's a good habbit to always use a WHERE clause in an UPDATE or DELETE instruction ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top