Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2013
    Posts
    4

    Propercase or Title Case Function?

    Hello all,
    My name is Donald and I'm new to the DB2 forum. I'm trying to figure out if there is a command (or way) to change all the uppercase text strings to proper?


    Any help would be great!!

    -Donald

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,431
    As far as I know, there are no built-in functions like that, you'll need to roll your own.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    May 2009
    Posts
    505
    Donald, in DB2 LUW V9.7, the INITCAP function might be what you are looking for:

    SELECT INITCAP('AAA bb CCC dddd EEE')
    FROM SYSIBM.SYSDUMMY1

    1
    -------------------
    Aaa Bb Ccc Dddd Eee

    1 record(s) selected.
    [/CODE]
    (I am not sure exactly what you mean by 'proper'.

  4. #4
    Join Date
    Jan 2013
    Posts
    4
    Quote Originally Posted by Stealth_DBA View Post
    Donald, in DB2 LUW V9.7, the INITCAP function might be what you are looking for:

    SELECT INITCAP('AAA bb CCC dddd EEE')
    FROM SYSIBM.SYSDUMMY1

    1
    -------------------
    Aaa Bb Ccc Dddd Eee

    1 record(s) selected.
    [/CODE]
    (I am not sure exactly what you mean by 'proper'.
    Thank you for the recommendation. Maybe I should provide more information. I'm an enduser of DB2 Version 8 and when I query data, my description column contains text strings that are all in uppercase ex. (JOHN SMITH), I'm trying find out a way if there is a command like that would act like the "proper" function in MS Excel so the outcome would be "John Smith". I'm familar with the "lcase" function and also the "ucase" function.

    I tried to incorporate the "INITCAP" function, and looked it up on the net, apparently there's no DB2 equivalent, but best suited for Oracle SQL.

  5. #5
    Join Date
    May 2009
    Posts
    505
    There is no DB2 equivalent in DB2 LUW V8. There is in DB2 LUW V9.7 (which doesn't do you any good in V8, however). But even INITCAP would have a problem with 'double' capitals in a name (i.e. James MacDougall). PS probably not your call but I would upgrade from V8 as soon as possible. It went out of support quite awhile ago.

  6. #6
    Join Date
    Jan 2013
    Posts
    4
    Quote Originally Posted by Stealth_DBA View Post
    There is no DB2 equivalent in DB2 LUW V8. There is in DB2 LUW V9.7 (which doesn't do you any good in V8, however). But even INITCAP would have a problem with 'double' capitals in a name (i.e. James MacDougall). PS probably not your call but I would upgrade from V8 as soon as possible. It went out of support quite awhile ago.
    Thanks for the additional insight Stealth DBA. Unfortunately, I don't forsee the company I work for upgrading in the near future.

    -Donald

  7. #7
    Join Date
    May 2003
    Location
    USA
    Posts
    5,734
    Quote Originally Posted by Donald L View Post
    Thanks for the additional insight Stealth DBA. Unfortunately, I don't forsee the company I work for upgrading in the near future.

    -Donald
    Are you using DB2 for Linux, UNIX, Windows, or DB2 for z/OS (mainframe).
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  8. #8
    Join Date
    Jan 2013
    Posts
    4
    Quote Originally Posted by Marcus_A View Post
    Are you using DB2 for Linux, UNIX, Windows, or DB2 for z/OS (mainframe).
    I'm using DB2 for Windows.

Posting Permissions

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