MYSQL: set first letter of field to uppercase

July 12, 2010
By

I recently had to set values of a set of values from a column from lowercase to Firstuppercase. Nothing easier, run the following code on the database:

1
2
3
UPDATE `affected_table` SET
`field_in_question` = CONCAT(UPPER(LEFT(`field_in_question`, 1)),
SUBSTRING(`field_in_question`, 2))

Tags: , ,

  • http://www.zap.tv zzzap

    Thanks.
    Simple but efficient.
    exactly what i was looking for !

  • http://Thanks Thanks

    Thanks for your help.

  • ramprasad

    i need for entire colums

Follow Me

Subscribe via RSS