Skip to content

Instantly share code, notes, and snippets.

@devacto
Created November 6, 2013 03:45
Show Gist options
  • Save devacto/7330538 to your computer and use it in GitHub Desktop.
Save devacto/7330538 to your computer and use it in GitHub Desktop.
MySQL function to change the first letter into upper case.
CREATE FUNCTION ucfirst(x varchar(255)) returns varchar(255)
return concat( upper(substring(x,1,1)),lower(substring(x,2)) );
@devacto
Copy link
Author

devacto commented Nov 6, 2013

SELECT ucfirst("TEST");

+-----------------+
| ucfirst("TEST") |
+-----------------+
| Test            |
+-----------------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment