SQLite Forum

Capitalize first letters only
Login
If by some cosmic accident you want this as a once-off DB operation or you happen to use [SQLiteSpeed] (https://sqlitespeed.com/) for a DB manager, then there is an SQL function called "TitleCase()" that you can use which will render:

- TitleCase('JOHNNY')     --> 'Johnny'
- TitleCase('john smith') --> 'John Smith'
- TitleCase('jOhNnY b. GOODE') --> 'Johnny B. Goode'
- TitleCase('my name') --> 'My Name'
- etc.


Failing that, the best option is to add such a UDF to the SQLite library that you are using [as explained here](https://sqlite.org/c3ref/create_function.html).

Note some base peculiarities with the above function (or things to consider if you are making your own) that may or may not be desired:

- TitleCase('joe McAdam')     --> 'Joe Mcadam'
- TitleCase('Mary-joe smith') --> 'Mary-Joe Smith'
- TitleCase('JK. Rowling')    --> 'Jk. Rowling'


Other than that, as Gunther mentioned, best to do it inside your application code.

Good luck!