473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ADO sql wildcard "Like" queries - Search DB table allowing 0 (zero) to be O (letter O).

Hello there,

Summary:
How far can you go with SQL Select queries using like clauses with wildcard
characters. Can you apply anything like regular expressions?

Full details:

On a Intranet website, I request a code from a user which is then compared
with a code in an ADO access database.

The common problem that has been happening though is that users are getting
0 and O's mixed up so I want to ignore this when it happens.

E.g.
User enters
RCxT0wR when it should be RCxTOwR

A match is checked by doing a select on a database table, therefore:
Select * from CodeTable where code = "USER-INPUT"

if there are any row matches then the code is correct.

With regard to the 0 and O issue I first thought of using a "Like" query
and replacing all users "O" or "0" with a % character (single wild card I
believe) but then it dawned upon me that a user only had to enter all 0's
and they will match every code.

I was wondering if it is possible in ADO SQL, if you can sort of apply
regular expression type syntax to a like clause.

Therefore, I change the like string to something like

Select * from CodeTable where code = "USER-INPUT"
but I change "USER-INPUT" to be that any occurrence of a 0 or O is changed
to [O/0] where [O/0] means, any single character at that position can be O
or 0.

If this is not possible, then I will have to take each code from the
database one at a time, and convert all O's to 0's and then do the same in
the user entered code. but this means a like for like comparison with each
entry in the database.

Also I cannot change all the entries in the database to already be 0's only
because I need to maintain the original code.

I hope this makes sense and I welcome any suggestions.

TIA

Dave
Nov 12 '05 #1
2 13341
Replace all the Os with [O0]. A string of characters within brackets means to
match any character in the list. This works in VBA, JET, and SQL Server.

On Thu, 13 Nov 2003 16:42:27 -0000, "Dave Smithz" <Spam Free> wrote:
Hello there,

Summary:
How far can you go with SQL Select queries using like clauses with wildcard
characters. Can you apply anything like regular expressions?

Full details:

On a Intranet website, I request a code from a user which is then compared
with a code in an ADO access database.

The common problem that has been happening though is that users are getting
0 and O's mixed up so I want to ignore this when it happens.

E.g.
User enters
RCxT0wR when it should be RCxTOwR

A match is checked by doing a select on a database table, therefore:
Select * from CodeTable where code = "USER-INPUT"

if there are any row matches then the code is correct.

With regard to the 0 and O issue I first thought of using a "Like" query
and replacing all users "O" or "0" with a % character (single wild card I
believe) but then it dawned upon me that a user only had to enter all 0's
and they will match every code.

I was wondering if it is possible in ADO SQL, if you can sort of apply
regular expression type syntax to a like clause.

Therefore, I change the like string to something like

Select * from CodeTable where code = "USER-INPUT"
but I change "USER-INPUT" to be that any occurrence of a 0 or O is changed
to [O/0] where [O/0] means, any single character at that position can be O
or 0.

If this is not possible, then I will have to take each code from the
database one at a time, and convert all O's to 0's and then do the same in
the user entered code. but this means a like for like comparison with each
entry in the database.

Also I cannot change all the entries in the database to already be 0's only
because I need to maintain the original code.

I hope this makes sense and I welcome any suggestions.

TIA

Dave


Nov 12 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes, you can use "... LIKE 'RCxT[O|0]wR' ... "

Use the "up-and-down" line between the zero and the oh - it means
logical OR.

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7RZq4echKqOuFEgEQJMCwCgmthMYyWUHNefqy3YSw4LYr 939coAoKOW
YF1Bq72K7HNtD4Tp0yZ/gNif
=nc9d
-----END PGP SIGNATURE-----

Dave Smithz wrote:
Hello there,

Summary:
How far can you go with SQL Select queries using like clauses with wildcard
characters. Can you apply anything like regular expressions?

Full details:

On a Intranet website, I request a code from a user which is then compared
with a code in an ADO access database.

The common problem that has been happening though is that users are getting
0 and O's mixed up so I want to ignore this when it happens.

E.g.
User enters
RCxT0wR when it should be RCxTOwR

A match is checked by doing a select on a database table, therefore:
Select * from CodeTable where code = "USER-INPUT"

if there are any row matches then the code is correct.

With regard to the 0 and O issue I first thought of using a "Like" query
and replacing all users "O" or "0" with a % character (single wild card I
believe) but then it dawned upon me that a user only had to enter all 0's
and they will match every code.

I was wondering if it is possible in ADO SQL, if you can sort of apply
regular expression type syntax to a like clause.

Therefore, I change the like string to something like

Select * from CodeTable where code = "USER-INPUT"
but I change "USER-INPUT" to be that any occurrence of a 0 or O is changed
to [O/0] where [O/0] means, any single character at that position can be O
or 0.

If this is not possible, then I will have to take each code from the
database one at a time, and convert all O's to 0's and then do the same in
the user entered code. but this means a like for like comparison with each
entry in the database.

Also I cannot change all the entries in the database to already be 0's only
because I need to maintain the original code.

I hope this makes sense and I welcome any suggestions.

TIA

Dave

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alastair | last post by:
Hello guys, I've been building a search facility for an intranet site I'm part of developing and we've been building a search engine using Index Server. It mostly works, however there have been...
2
by: Adam Short | last post by:
I've never needed it before but now I do! Does anyone know if you are able to perform a NOT Like search using Classic ASP ADO? i.e. myData.Filter = "Ref NOT LIKE '*1234*'" by the way this...
10
by: joshsackett | last post by:
I am starting an encryption project for my database and I'm performing some tests on decryption speed. A lot of my application queries use a LIKE parameter in the WHERE clause. To keep from...
16
by: Andrew Baker | last post by:
I am trying to write a function which provides my users with a file filter. The filter used to work just using the VB "Like" comparision, but I can't find the equivilant in C#. I looked at...
1
by: Craig Kenisston | last post by:
Hi, I need to write a function that should behave like the SQL's "like" operator on a list of words. I was wondering if I can use Regex directly to do this job. But I've been reading about...
8
by: DQ dont quit | last post by:
I'm currently working on a ASP.Net / C# / SQL 2000 project that involves the entering of keywords, that a web user enters, and then searching MSWord documents for those words. This information...
1
by: Dean Slindee | last post by:
Can anyone point me to a code example or repository that would allow me to provide some "sounds like" comparison capability when doing a search for LastName? Thanks, Dean Slindee
11
by: Bruce Lawrence | last post by:
Ok, I'm baffled... I'm making a query in access 97 between 2 tables. There is a field in both tables called "DWGNO". OPENORD has a record with a DWGNO of "00000012345" DIEDATA has a record...
2
by: vag | last post by:
This is going to be easy for any of you who is experienced. What is wrong with the following query? Select Company from Generalview Where Company Like '%'@search'%'
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.