Skip to main content
New Participant
December 5, 2008
Answered

How to get an exact match

  • December 5, 2008
  • 3 replies
  • 853 views
How do you get a SELECT statement to look for an exact match when comparing strings ?

For example, SELECT name FROM table WHERE name="Jim"

returns records even if the name field is "JIM". I need an exact match. im using MS Access for database
This topic has been closed for replies.
Correct answer JR__Bob__Dobbs-qSBHQ2
MS Access has a StrComp function that might help you do this.

http://support.microsoft.com/kb/209674
http://support.microsoft.com/kb/244693

3 replies

Inspiring
December 5, 2008
Are you able to switch dbs? Access might be the only one that is not case sensitive.
DioPallyAuthor
New Participant
December 5, 2008
Unfortunatly, no. I must use their existing database. I checked and am surprised Access doesnt have a field type of binary or something simular.

So there is no way of doing this ?
JR__Bob__Dobbs-qSBHQ2Correct answer
Inspiring
December 5, 2008
MS Access has a StrComp function that might help you do this.

http://support.microsoft.com/kb/209674
http://support.microsoft.com/kb/244693
DioPallyAuthor
New Participant
December 5, 2008
I need the strings to match exactly. The fields i am comparing to is a mixture of upper and lower case characters and I cannot change the case. I need Jim to be different from JIM to be different from JiM.

Changing everything to upper case is not an exact match. The fields is a ID field generated using random upper and lower case letters and number 0-9. an example of a value in the field is:
H10h6FFSJQzjIKRi57ZWFMNkPaq8qsyGRdjCeAxM0yW1t3Ui2W

and you see why i cannot use UCase to change the case of the string.

I need an exact match
Inspiring
December 5, 2008
Your select statement should be,

SELECT name FROM table where upper(name) = "#TRIM(UCASE(form.NAME))#"
DioPallyAuthor
New Participant
December 5, 2008
quote:

Originally posted by: Daverms
Your select statement should be,

SELECT name FROM table where upper(name) = "#TRIM(UCASE(form.NAME))#"