How to uppercase first letter (without changing the others) in Snowflake

I am aware of INITCAP() and this similar question, but my question is different:

How can I uppercase the first letter only in a given string, and leave the rest of the string untouched?

INITCAP() can be made to uppercase the first letter only -- however, it will lowercase everything else, as mentioned in the documentation:

<delimiters> specified as an empty string (i.e. '') instructs INITCAP to ignore all delimiters, including whitespace characters, in the input expression (i.e. the input expression is treated as a single, continuous word). The resulting output is a string with the first character capitalized (if the first character is a letter) and all other letters in lowercase.


another option is

UPPER(LEFT(my_string,1))||SUBSTR(my_string,2)

and if we use the same whitespace pattern, would win the code golf by 1:

INSERT(my_string,1,1,UPPER(LEFT(my_string,1)))


Managed to do it using a few string manipulations:

SELECT INSERT(my_string, 1, 1, UPPER(LEFT(my_string, 1)));

UPPER(LEFT(my_string, 1)) will extract the first letter of the string, and uppercase it.

INSERT() will replace a portion of the string with something else -- in this case, the first letter will be replaced with its uppercase version.