473,378 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Overriding database collation in queries for LIKE operators

Hi all,

In SQL Server I can use the COLLATE clause to sort, compare(=) and do
LIKE comparisons in queries, overiding the server collation. For
instance I can write a query like
select * from T where (someStringCol COLLATE Latin1_General_CI_AI
LIKE '%Some Text%')

DB2 provides the COLLATION_KEY_BIT function, which will work fine for
sorting and "=" comparisons, but obviously not for "LIKE", as it
returns a key.
Is there any way I can do for instance case insensitive or accent
insensitive searches in DB2 when the database collation is case/accent
sensitive? (Without using to_upper, etc)
thanks!
Nov 5 '08 #1
1 5647
Jo**********@gmail.com wrote:
Hi all,

In SQL Server I can use the COLLATE clause to sort, compare(=) and do
LIKE comparisons in queries, overiding the server collation. For
instance I can write a query like
select * from T where (someStringCol COLLATE Latin1_General_CI_AI
LIKE '%Some Text%')

DB2 provides the COLLATION_KEY_BIT function, which will work fine for
sorting and "=" comparisons, but obviously not for "LIKE", as it
returns a key.
Is there any way I can do for instance case insensitive or accent
insensitive searches in DB2 when the database collation is case/accent
sensitive? (Without using to_upper, etc)
Not built-in. You can use the libraries here:
www.ibm.com/software/globalization/icu/index.jsp
To roll your own.
I while ago I tinkered with them a bit. If you send me an email I'll
gladly sent you as-is code to get you jump-started.

I'd also be interested in your usage. The need for "session level
collation" is highly contested. Any input welcome.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Nov 6 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andrew Durdin | last post by:
In Python, you can override the behaviour of most operators for a class, by defining __add__, __gt__, and the other special object methods. I noticed that, although there are special methods for...
2
by: Sue Swanson | last post by:
Yesterday I received a response to my CI/CS Collation problem and the recommendation was to try and restore a CI Collation database to a CS Collation database. After creating a blank CS database a...
2
by: Captain Flack | last post by:
I have a SQL Server database hosted with a web hosting company. The SQL Server was clearly set up to be case sensitive, however, I want this particular database to be case-insensitive. I have...
1
by: Chris | last post by:
Has anyone ever accomplished a mass update off all databases, tables and columns for collation? If I try to change the collation/character set for the mysql daemon it breaks all of our queries...
4
by: serge | last post by:
If I have to send a database to someone and that person can be using a Case Sensitive or a Case Insensitive SQL Server 2000, what do I do? Should i create two databases: 1 CS and 1 CI? Can't...
4
by: aki999 | last post by:
We need to install CI database on CS server, and there are some issues with stored procedures. Database works and have CI collation (Polish_CI_AS). Server has coresponding CS collation...
21
by: Peter Nurse | last post by:
I have just upgraded to SQL Server 2005 from SQL Server 2000. In Microsoft SQL Server Management Studio, when I click on database properties, I receive the following error:- Cannot resolve the...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.