A Microsoft platform for building enterprise-level data integration and data transformations solutions.
Hi,@Shambhu Rai
Welcome to Microsoft T-SQL Q&A Forum!
Please check this:
CREATE FUNCTION Capital_Word(@Text NVARCHAR(200))
RETURNS NVARCHAR(200)
AS
BEGIN
RETURN STUFF((
SELECT ' ' + UPPER(LEFT(s.value,1)) + LOWER(SUBSTRING(s.value,2,LEN(s.value)))
FROM
OPENJSON('["' + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(@Text,'\','\\'),'"','\"'),CHAR(9),'\t'),CHAR(10),'\n'),' ','","') + '"]') s
ORDER BY s.[key]
FOR XML PATH(''),TYPE).value('(./text())[1]','NVARCHAR(MAX)'),1,1,'');
END
SELECT First_lastname,dbo.Capital_Word(First_lastname)as Updated_First_lastname
FROM #main13;
Here is the result:
Best regards,
Bert Zhou
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.