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
↧