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 > Data Access, Manipulation & Batch Languages > ANSI SQL > how to tell the difference between upper and lower case?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-19-04, 06:20
MaxJam MaxJam is offline
Registered User
 
Join Date: Dec 2003
Location: Dublin,Ireland
Posts: 13
how to tell the difference between upper and lower case?

Anyway to tell the difference BETWEEN uppercase and lowercase in SQL???

say youve two entries in a table that you wish to treat as different words?

"hello world"
and
"HELLO WORLD"

how would i construct a select statement that takes only the lowercase words??
Reply With Quote
  #2 (permalink)  
Old 02-19-04, 06:36
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
Select *
from table
where column = LOWER('VALUE');
__________________
Bessie Braddock: Winston, you are drunk!
Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.
Reply With Quote
  #3 (permalink)  
Old 02-19-04, 06:53
MaxJam MaxJam is offline
Registered User
 
Join Date: Dec 2003
Location: Dublin,Ireland
Posts: 13
great,
that works
but now, how do you tell the difference between

"Dpi"

and

"dpi"

and

"dPI"

???
Reply With Quote
  #4 (permalink)  
Old 02-19-04, 17:03
chuzhoi chuzhoi is offline
Registered User
 
Join Date: Dec 2002
Posts: 134
Re: how to tell the difference between upper and lower case?

Correct my If I'm wrong, but its seems like you are using MS SQL Server and your database is created with case-insensitive sort order.
(in most cases people have the opposite problem - how to treat mixed case as identical during search .

You can re-create DB and use case-sensitive sort order. Also if i'm not mistaken SQL Server 2000 allows collation sequence on per column basis.
Reply With Quote
  #5 (permalink)  
Old 02-20-04, 07:34
MaxJam MaxJam is offline
Registered User
 
Join Date: Dec 2003
Location: Dublin,Ireland
Posts: 13
Yes im using MS SQL Server 2000

Im gonna create a DB thats case sensitive and test that.

Quote:
You can re-create DB and use case-sensitive sort order. Also if i'm not mistaken SQL Server 2000 allows collation sequence on per column basis.
whats this colation thingy!?!
im trying the help files, but it seems fairly complicated.
Reply With Quote
  #6 (permalink)  
Old 02-24-04, 16:46
madafaka madafaka is offline
Registered User
 
Join Date: Feb 2004
Location: Dublin, Ireland
Posts: 212
Quote:
Originally posted by MaxJam
great,
that works
but now, how do you tell the difference between

"Dpi"

and

"dpi"

and

"dPI"

???
--for Dpi
select * from table where column = initcap('dpi')
--for dpi
select * from table where column = lower('dpi')
--for dPI
select * from table where column != lower('dpi') and column != upper('dpi') and column != initcap('dpi') and lower(column) = lover('dpi')
--for DPI
select * from table where column = upper('dpi')

etc
etc
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