Wednesday, March 20, 2013

How to solve Case Insensitive Issue in DB2 Query

we all know that SQL Server are case insensitive. when we implement the stored procedure, we did not worry about the filter criteria in the where clause.

I encounter an very strange error that use must use the correct format criteria when they run the application to search the database. the root cause of this issue is DB2 is case insensitive by default.

here is a work around to solve this issue. we can convert the filter column value to either upper case or lower case.


Select column1, column2 from DB2 Table
Where Upper(column1)=Upper(criteria one) and Lower(column2)=Lower(Criteria)

after I use the upper and lower function to convert the column values and filtered value in the stored procedure. now My Search application will ignore the case sensitive in the search input.

No comments:

Post a Comment