Yggdrasil75
Yggdrasil75

Reputation: 115

Search SQL database using WHERE CONTAINS a number

I am currently editing a tool site and mass adding specification tags to items based off what their title contains. The method I am using has some local server selection that I probably should not post, followed by the line

WHERE CONTAINS(item_name, '"%4%""" AND "screwdriver"')

I am currently trying to find all 4" screwdrivers, and found that double double quotes escapes the quotes, however the results for my searches on this site have said that using either square brackets around the number, percent signs, or both will work. I know that there is multiple 4" screwdrivers, however I get no results when I query with a number.

I have a method of updating the data once I have a series of results, however I get no results.

At this point, I have spent enough time here and on google trying to get this to work that I could have already manually added the tag.

Upvotes: 0

Views: 87

Answers (1)

WJS
WJS

Reputation: 714

Try this instead:

WHERE item_name LIKE'%4%' 
AND item_name LIKE '%screwdriver%'

So you are just searching for items containing '4' and 'screwdriver'. If you specifically want 4" use LIKE '%4"%'

Upvotes: 1

Related Questions