I have a table on my database. My table\'s name is \"Company\". I want to change data \"company_name\" as upper case first letter. For example;
\"ABC COMPANY\"
A further modification handles possessives ('s) and words starting with Mc
if ' ' + @OutputString like '% Mc%'
set @OutputString = ' ' + @OutputString
set @index = CHARINDEX ( ' Mc', @OutputString)
while @Index > 0
begin
set @OutputString = SUBSTRING(@outputString, 1, @index + 2) + UPPER(SUBSTRING(@outputString, @index + 3, 1)) + SUBSTRING(@outputString, @index + 4, len(@outputString))
set @index = CHARINDEX ( ' Mc', @OutputString, @Index + 4)
end
set @outputstring = ltrim(rtrim(@outputstring))
if @OutputString + ' ' like '%''S %'
set @OutputString = ltrim(rtrim(REPLACE(@outputstring + ' ', '''S ', '''s ')))
place right before Return