Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Convert Text to Proper Case is huge problme - response (7) by amit.saxena0782

$
0
0

Hi ,
 
the above query is able to format the output upto two words in a string, its not searching for the second space.
column data as below before query run:
wrath of titans
serious hospital (disk) fnut 
 
Query :
Select
CASE
  WHEN col_name LIKE '% %' -- LAST NAMES WITH HYPHENS IN THEM - DISPLAY AS : JONES-SMITH
     THEN SUBSTR(col_name,1,1) || LOWER(SUBSTR(col_name, 2, INDEX(col_name, '') -2)) || '' ||
            SUBSTR(col_name, INDEX(col_name, '') +1,1) || LOWER(SUBSTR(col_name, INDEX(col_name, '')+2))
   ELSE              -- REGULAR ONE WORD LAST NAMES
          SUBSTR(col_name,1,1) ||  LOWER(SUBSTR(col_name,2)) 
END AS col_name
from database.table;
Data after query run as below:
Wrath Of titans
Serious Hospital (disk) fnut --- Third word is not changing to proper case.
 
Required data as below shud be:
Wrath Of Titans
Serious Hospital (Disk) Fnut.
 
Kindly suggest.

 


Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>