×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Partial Matches

Partial Matches

Partial Matches

(OP)
I would like to be able to detect partial matches in a Database field. I know the LIKE command, but it doesn't seem to want to work here. What I'm trying to match has the wildcard character IN the database field, the reverse of the usual where %xxx% = FIELD. The fields are layed out similar to this h%dh%nt%r.

RE: Partial Matches

There are a couple of ways you might try. Remember that the '%' is used for multiple character wildcards. You can also use a single character search, I believe its the '?' but I would have to look it up. The search that you are using should work, but if your fields are long, then you will have problems. There is no wildcard that will do UP TO (say) 5 characters, but not more. If you want more than one character, you statement building it from scratch would grow exponentially, and I think it would cause you other problems. It does look like you are searching for key words, or full text indexing. Are either of these the case? There are some other ways of thinking about how to do things. If you want to give me some more info, I will try to help out. I hope this was useful.

RE: Partial Matches

(OP)
Here's my code: SELECT Handle.Mail, Restrict.Email from Handle, Restricted WHERE Handle.Mail LIKE Restrict.Email. My wildcard characters are in Restrict.Email. It gives me an error saying that I am improperly using the field (like it is in the wrong place). If I put Restrict.Email first, it doesn't return anything at all, even when I know it should give me a match.

RE: Partial Matches

Salam (Hi)
There are two wild cards that are used in SQL, LIKE and Underscore '_' and you can use these as

Example 1
Select Field1 from mytable where Field1 LIKE '%mile'
Result: It will retrieve words that start with anything but that end with mile. e.g Smile, Shumile, frafrommile etc.
Example 2
Select Field1 from mytable where Field1 LIKE 'mi_e'
Result: It will return words that start with 'm' end with 'e' but can contain any character after 'i' e.g "mine", "mile", "mike" etc.
This '_' is called character wild card.

I hope it will help you. :)

RE: Partial Matches

(OP)
Thanks, actually that was exactly what I was looking for. I'll give it a try...:)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close