How to update data as upper case first letter with t-sql command?

前端 未结 7 562
别跟我提以往
别跟我提以往 2020-12-28 18:14

I have a table on my database. My table\'s name is \"Company\". I want to change data \"company_name\" as upper case first letter. For example;

\"ABC COMPANY\"

7条回答
  •  有刺的猬
    2020-12-28 18:17

    update  YourTable
    set     company_name = upper(substring(company_name,1,1)) + 
                lower(substring(company_name, 2, len(company_name)-1))
    where   len(company_name) > 0
    

    Live example at SQL Fiddle.

提交回复
热议问题