Hi - Just another addition to this using the great syntax suggested by @Kurumi, if you ever need to do something with each word in a text field or string, you can use the following:
CASE WHEN LEN('[@field:YourTextField]')>0
THEN STUFF((SELECT ' '+ UPPER(LEFT(value,1))+LOWER(SUBSTRING(value,2,LEN(value))) FROM STRING_SPLIT('[@field:YourTextField]',' ') FOR XML PATH ('')), 1, 1, '')
ELSE NULL
END
In the above, the STRING_SPLIT function is used to separate each word in a string (using space (' ') as the separator) in separate rows instead of Selecting multiple rows from a Table. Once we have each word in a row, Upper/Lower/Substring functions are used to capitalize only the first letter. Then we "merge" every row back into one with the STUFF/FOR XML PATH functions.
The CASE/WHEN was added because for some reason, if the field is blank the formula would output the whitespace hex code in a Calculated Value/Field.
Input text:
'hi, this is a test'
Result:
'Hi, This Is A Test'
See this article STRING_SPLIT (Transact-SQL) - SQL Server for reference and an example. Hope this helps someone!