If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > problem about case-sensitive

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-03, 08:30
kylin kylin is offline
Registered User
 
Join Date: Nov 2003
Location: China
Posts: 2
Talking problem about case-sensitive

By default ,DB2 is case-sensitive
That means 'A' and 'a' are not the same
Can i change some options to make it insensitive?
Thanks a lot
Reply With Quote
  #2 (permalink)  
Old 12-05-03, 08:35
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Not to my knowledge. You have to do case insentive checks on as as needed basis.

Andy
Reply With Quote
  #3 (permalink)  
Old 12-05-03, 08:50
kylin kylin is offline
Registered User
 
Join Date: Nov 2003
Location: China
Posts: 2
Quote:
Originally posted by ARWinner
Not to my knowledge. You have to do case insentive checks on as as needed basis.

Andy
We migrate some sps from MSSQL to DB2.
It is too late When we wake up to the problem
It seems that we have to check all the sps manually
Thank you all the same
Reply With Quote
  #4 (permalink)  
Old 12-05-03, 13:21
GertK GertK is offline
Registered User
 
Join Date: Nov 2003
Location: Netherlands
Posts: 96
Quote:
Originally posted by kylin
We migrate some sps from MSSQL to DB2.
It is too late When we wake up to the problem
It seems that we have to check all the sps manually
Thank you all the same
Well, it depends on what you need. You can add an uppercased version of the column you need to search with
<new column> GENERATED ALWAYS AS (UPPER(<original column>))

When searching the table using where <original column> = UPPER('Search text') DB2 will use the generated column. All you have to do is to create an index on this column.

I've also seen a way to generate a totally case insensitive database but you need to use the C API to get that done. If you are interested in this I can try to find it, I mailed it my work some weeks ago.

Hope this helps.
Reply With Quote
  #5 (permalink)  
Old 12-19-03, 20:09
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
It will be quiet interesting if you can provide us with information on how to do create a case-insensitive db using C APIs ...

Thanks in Advance

Cheers
Sathyaram


I've also seen a way to generate a totally case insensitive database but you need to use the C API to get that done. If you are interested in this I can try to find it, I mailed it my work some weeks ago.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #6 (permalink)  
Old 12-19-03, 21:00
GertK GertK is offline
Registered User
 
Join Date: Nov 2003
Location: Netherlands
Posts: 96
Quote:
Originally posted by sathyaram_s
It will be quiet interesting if you can provide us with information on how to do create a case-insensitive db using C APIs ...

Thanks in Advance

Cheers
Sathyaram


I've also seen a way to generate a totally case insensitive database but you need to use the C API to get that done. If you are interested in this I can try to find it, I mailed it my work some weeks ago.
Hi Sathyaram

I found it in the outbox of my newsreader also. It's copied from a post from Sydney Monteiro on one of the newsgroups on the IBM newsserver.

Here it is:

============================================


The collating sequence is set at the database level and it can only be set
when creating a database. That means that once set it can not be changed.

The CREATE DATABASE STATEMENT only offers rudimentary support for
setting the collating sequence
Code:
>--+-----------------------------------+------------------------>
1   |                .-SYSTEM---------. |
1   '- COLLATE USING--+-COMPATIBILITY--+-'
1                    +-IDENTITY-------+
1                    +-IDENTITY_16BIT-+
1                    '-NLSCHAR--------'
(Realistically SYSTEM, IDENTITY and COMPATIBILITY are the only reasonable choices for U.S. folks)

On the other hand, the administrative routine sqlecrea has the means to get the work done.

Go to the copyrighted IBM material at
http://publib.boulder.ibm.com/infoce...brecov-sqc.htm

Find the int DbCreate(char existingDbAlias[], char newDbAlias[])
function and modify

dbDescriptor.sqldbcss = SQL_CS_NONE;

to read

Code:
dbDescriptor.sqldbcss = SQL_CS_USER;
 {
  int i;
    for(i=0;i<256;i++)
    {
   if (isalpha(i))
    dbDescriptor.sqldbudc[i]=toupper(i);
   else
    dbDescriptor.sqldbudc[i]=i;
     }
 }
If compiled on the server and ran on the server, even the issues with code points for the EBCDIC versus ASC collating sequence are handled transparently by the C library's isalpha().

BAM! Now you have a function that creates a new database with same code set and territory as the existing database, and ALL compare operations (>,<,like, indexing, and order by) are done case insensitively. :-)

============================================


I don't have a C compiler on my system so I can't give it a try. It would be interesting to know if it really works.

Kind regards, Gert
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On