Query access keysensitive


I have a query of the style:

SELECT * FROM tabla WHERE keyTabla = 'cadena';

What I want is for this query to compare the key and the string but discriminating upper case of lowercase.

asked by G3l0 13.12.2017 в 15:32

2 answers


If what you want is that you compare the strings exactly, taking into account uppercase and lowercase, the function is StrComp() .

Used as follows:

SELECT * FROM tabla WHERE StrComp(keytabla, "cadena", 0) = 0;

The function has the following syntax:

StrComp(string1, string2, modoComparacion)

string1 and string 2 are the strings to compare.

Comparison mode is how the strings compare, and can be ' Binary ' (value 0) which distinguishes case-sensitive and ' Text '(value 1) that is not case-sensitive.

The function returns 0 if the strings are the same. If they are not, return 1 or -1 .

I hope this feature solves the problem.

answered by 01.01.2018 / 23:34

Good! I think what you're looking for is the following, always compare in uppercase or lowercase:

SELECT * FROM tabla WHERE UCase(keyTabla) = UCase('cadena');

In this case I would compare the field of the table in uppercase with the data of the chain also in capital letters

answered by 13.12.2017 в 15:39