Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2003
    Location
    Dublin,Ireland
    Posts
    13

    Unanswered: 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??

  2. #2
    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.

  3. #3
    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"

    ???

  4. #4
    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.

  5. #5
    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.

    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.

  6. #6
    Join Date
    Feb 2004
    Location
    Dublin, Ireland
    Posts
    212
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •