View Single Post
  #1   IP: 112.87.93.182
Old 2015-03-31, 09:30 AM
Hamel Hamel is offline
初级会员
 
Join Date: 2010-12-13
Posts: 1
Hamel 现在声名狼藉
Default Capitalize first letter. MySQL

It's almost the same, you just have to change to use the CONCAT() function instead of the + operator :

Code:
UPDATE tb_Company
SET CompanyIndustry = CONCAT(UCASE(LEFT(CompanyIndustry, 1)), 
SUBSTRING(CompanyIndustry, 2));
This would turn hello to Hello, wOrLd to WOrLd, BLABLA to BLABLA, etc. If you want to upper-case the first letter and lower-case the other, you just have to use LCASE function :

Code:
UPDATE tb_Company
SET CompanyIndustry = CONCAT(UCASE(LEFT(CompanyIndustry, 1)), 
LCASE(SUBSTRING(CompanyIndustry, 2)));
Note that UPPER and UCASE do the same thing.
Reply With Quote