By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 1,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Case INsensitivity for string comparisons

P: n/a
Tom
Hi,

Our development team is adding DB2 8.1 compatibility to our existing
application which currently supports SQLServer 2000. Our code is
written to take advantage of SQLServer's ability to allow query
string compares to be case insensitive. We have identified DB2 forces
all query string compares to be evaluated case sensitive. Since our
code is written to assume case insensitivity, it curently seems that
we must change our code base to force each compare to be case
insensitive in order to be compatible with DB2.

We are looking for a configuration option or similar mechanism for DB2
8.1 to allow for all query string compares to be case insensitive by
default. This is to allow us to avoid making any changes in our code
to compensate for the case sensitive nature of DB2 string compares.

Specifically: what we are looking for is a way that the code:

WHERE lastname = UPPER('Geyer')

can be coded as

WHERE lastname ='Geyer'

and any combination of case in the data that = 'geyer' would match.

1. Does DB2 8.1 have a mechanism for changing all query string
compares to be case insensitive?

2. If not, what is the recommended technique for performing case
insensitive string compares in DB2?

3. If not, does IBM have plans to enable case insensitive string
compares in DB2 in an upcoming release?
Thanx much,

Tom
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
v8.1 has workarounds with views and generated columns (including index
support) described here:

http://www-106.ibm.com/developerwork...3adamache.html

Tom wrote:
Hi,

Our development team is adding DB2 8.1 compatibility to our existing
application which currently supports SQLServer 2000. Our code is
written to take advantage of SQLServer's ability to allow query
string compares to be case insensitive. We have identified DB2 forces
all query string compares to be evaluated case sensitive. Since our
code is written to assume case insensitivity, it curently seems that
we must change our code base to force each compare to be case
insensitive in order to be compatible with DB2.

We are looking for a configuration option or similar mechanism for DB2
8.1 to allow for all query string compares to be case insensitive by
default. This is to allow us to avoid making any changes in our code
to compensate for the case sensitive nature of DB2 string compares.

Specifically: what we are looking for is a way that the code:

WHERE lastname = UPPER('Geyer')

can be coded as

WHERE lastname ='Geyer'

and any combination of case in the data that = 'geyer' would match.

1. Does DB2 8.1 have a mechanism for changing all query string
compares to be case insensitive?

2. If not, what is the recommended technique for performing case
insensitive string compares in DB2?

3. If not, does IBM have plans to enable case insensitive string
compares in DB2 in an upcoming release?
Thanx much,

Tom


Nov 12 '05 #2

P: n/a
Other solutions may include ...

If your app uses it's own database, maybe you can create one using a user
defined collating sequence.
(or find a system collating sequence that is case insensitive?)

Maybe there is also something to do with COLLATING_SEQUENCE option of the
federated features of db2.
(never been there... federating db2 to db2)
Function mapping?

I suggest you also read :
http://publib.boulder.ibm.com/infoce...help/index.jsp
search : "LIKE predicate applied to a CHAR column"
Just to show you that like predicates may behave differently. (db2 vs sql
server)

As for your Q3, i doubt ibm will ever default to
orange = apple or 'a' = 'A'
UCASE and other text functions are there to support users who wish
to deviate from the default.

Maybe there are other solutions available.
Is the app using java, odbc, ... ?

PM

"Tom" <tm*****@gr.com> a écrit dans le message de
news:bb**************************@posting.google.c om...
Hi,

Our development team is adding DB2 8.1 compatibility to our existing
application which currently supports SQLServer 2000. Our code is
written to take advantage of SQLServer's ability to allow query
string compares to be case insensitive. We have identified DB2 forces
all query string compares to be evaluated case sensitive. Since our
code is written to assume case insensitivity, it curently seems that
we must change our code base to force each compare to be case
insensitive in order to be compatible with DB2.

We are looking for a configuration option or similar mechanism for DB2
8.1 to allow for all query string compares to be case insensitive by
default. This is to allow us to avoid making any changes in our code
to compensate for the case sensitive nature of DB2 string compares.

Specifically: what we are looking for is a way that the code:

WHERE lastname = UPPER('Geyer')

can be coded as

WHERE lastname ='Geyer'

and any combination of case in the data that = 'geyer' would match.

1. Does DB2 8.1 have a mechanism for changing all query string
compares to be case insensitive?

2. If not, what is the recommended technique for performing case
insensitive string compares in DB2?

3. If not, does IBM have plans to enable case insensitive string
compares in DB2 in an upcoming release?
Thanx much,

Tom

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.