iOS.Wolf iOS.Wolf - 3 years ago 111
SQL Question

SQL case sensitive string comparison with like and "="

i have one table named category.

in this table i have two columns 1.)

cat_id
, 2.)
cat_name


in this table i have added record with this value :
cat_id
=
1
,
cat_name
=
test


Now when i am going to run select query

SELECT * FROM category WHERE cat_name = 'Test'


this query returns me null result because in database record string is
test
and in query it's a
Test
mark the differance of capital string here. Instade of null result i want the result with 1st record.

also i want same result in vice versa small and capital string.

i am using sqlite as database.

Answer Source

Use upper function.

SELECT * FROM category WHERE upper(cat_name) = upper('Test')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download