The T-SQL UPPER() command allows you to change a lowercase string to an uppercase string.
For example, it will allow you to change the word hello to HELLO.
Declare @MyVar varchar(50);
Select UPPER(@MyVar) => Output will be HELLO in uppercase.
You can use the T-SQL UPPER() command with other commands to Capitalize only the first letter of a word.
For example, change florida to Florida.
DECLARE @MyVar varchar(50);
SELECT UPPER(LEFT(@MyVar,1)) +SUBSTRING(@MyVar,2,49)
Since my string is of length 50, notice that I am selecting the first letter and converting it to upper case and concatenating with the rest 49 letters that are already in lowercase starting with the second position in the string.
Filed under: Uncategorized |