on 04-17-2009 6:08 AM
Hi Experts,
I am having trouble in retrieving the results from a table using select query.
I have a table (Users) as below
Name (VARG) Number(INTEGER)
-
Murthy 0001
murthy 0002
-
when I am querying the table with select query as -
select * from Users where Name = 'Murthy'
this query is returning only one record which matches with capital letter of 'M', though both the record names are same.
I have seen in IBM forum to make the select query as case insensitive using the UPPER key word, I have tried this as below -
select * from Users where UPPER(Name) = 'MURTHY'
But this query is not working in my case...
My DB2 version is 8.1.5
Can any one please help in fixing this problem...
Thanks in Advance,
Murthy
Resolved the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, you do not say, why the function UPPER does not work (what is the result / SQL error, ... ?). The 8.2 documentation points to function TRANSLATE. As alternative, use SQL function LOWER, or LCASE.
select * from users where lcase(name) = 'murthy'
Malte
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Murthy,
your scenario worked fine on my DB2 LUW test database on version 9.5 .
> db2 " create table hugo ( c varchar(10) ) "
DB20000I The SQL command completed successfully.
> db2 " insert into hugo values ( 'Hallo' )"
DB20000I The SQL command completed successfully.
> db2 " select c from hugo where UPPER(c) = 'HALLO' "
C
-
Hallo
1 record(s) selected.
Is your question really related to DB2 LUW ? If yes, what are the column types of your test table?
Regards
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does not look like a issue with DB2 for IBM i. Moved to DB2 for Linux, Unix, Windows forum.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.