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

Convert Text to Proper Case is huge problme - response (6) by Teraditya

$
0
0
I ended up doing this in the view to display Last Names graciously. Our email team can now use the data without having to spend time on formatting data every time.  CASE   WHEN LAST_NAME LIKE '%-%' -- Last Names with hyphens in them - display as : Jones-Smith     THEN SUBSTR(LAST_NAME,1,1) || LOWER(SUBSTR(LAST_NAME, 2, INDEX(Last_Name, '-') -2)) || '-' || SUBSTR(LAST_NAME, INDEX(Last_Name, '-') +1,1) || LOWER(SUBSTR(LAST_NAME, INDEX(Last_Name, '-')+2))   WHEN LAST_NAME LIKE '%''%'     -- Last Names with apostrophes in them - display as : O'Brien      THEN SUBSTR(LAST_NAME,1,1) || LOWER(SUBSTR(LAST_NAME, 2, INDEX(Last_Name, '''') -2)) || '''' || SUBSTR(LAST_NAME, INDEX(Last_Name, '''') +1,1) || LOWER(SUBSTR(LAST_NAME, INDEX(Last_Name, '''')+2))   ELSE              -- Regular One Word Last Names     SUBSTR(LAST_NAME,1,1) ||  LOWER(SUBSTR(LAST_NAME,2))     END AS LAST_NAME

Viewing all articles
Browse latest Browse all 27759

Trending Articles