Is there a simple way to convert MySQL data into Title Case?

后端 未结 11 2196
太阳男子
太阳男子 2020-11-27 15:35

I have a MySQL table where all the data in one column was entered in UPPERCASE, but I need to convert in to Title Case, with recognition of \"small words\" akin to the Darin

11条回答
  •  攒了一身酷
    2020-11-27 15:44

    I used something like this

    UPDATE `tablename` 
    SET `fieldname` =  CONCAT(UCASE(SUBSTRING(`fieldname`,1,1)),'', LCASE(SUBSTRING(`fieldname`,2,LENGTH(`fieldname`)))) 
    

    Note: This will only convert the first character to uppercase. and rest of the value to lowercase.

提交回复
热议问题