How to Title case words in MySQL:
UPDATE person SET lastname= CONCAT( UPPER( SUBSTRING( lastname, 1, 1 ) ) , LOWER( SUBSTRING( lastname FROM 2 ) ) );
How to Title case word delimited with '-' in MySQL:
update person set lastname=
CONCAT(
UPPER(SUBSTRING(lastname, 1, 1)) ,
LOWER(SUBSTRING(lastname FROM 2 FOR (LOCATE( '-', lastname ) -1 ) ) ),
UPPER(SUBSTRING(lastname FROM (LOCATE( '-', lastname ) +1 ) FOR 1 ) ) ,
LOWER(SUBSTRING(lastname FROM (LOCATE( '-', lastname ) +2 ) ))
)
WHERE lastname LIKE '%-%'
Niciun comentariu:
Trimiteți un comentariu