Hi,
is there any way to realize a case-insensitive String comparisson in the WHERE condition of a SELECT-statement?
Since the function StrComp is not available in the HXTT driver, how do I realize something like this:
SELECT * FROM tbl_user WHERE email = 'Test@test.com'
This statement should find values like this
test@test.com
Test@test.com
test@Test.com
Test@TEST.Com
.
.
.
Regards,
Magnus
|
STRCMP(expr1,expr2): returns 0 if the strings are the same, -1 if the first argument is smaller than the second, and 1 otherwise. But it's not case insenstive.
1st. solution:
You can use ODBCCaseInsensitiveBehavior=true connection property.
ODBCCaseInsensitiveBehavior Indicates whether works like MS Access ODBC driver to be case insensitve for string comparison. You can use null, true, false Default: false
2nd. SELECT * FROM tbl_user WHERE email ilike 'Test@test.com'
3rd.SELECT * FROM tbl_user WHERE upper(email) = upper('Test@test.com')
4th.SELECT * FROM tbl_user WHERE lower(email) = lower('Test@test.com')
|