This may need to be optimized for more, but it will even allow you to upgrade the version of MULQL called mulitple
select 'mary ellen' as firstname into
insert into
select
Case when patindex('% %',firstname) >0 then
upper(left(firstname,1))
+ rtrim(substring(firstname,2,patindex('% %',firstname)-1))
+ ' '
+ Upper(substring(firstname,patindex('% %',firstname)+1,1))
+ rtrim(substring(firstname,patindex('% %',firstname)+2, len(firstname)))
else
upper(left(firstname,1)) + substring(firstname,2,len(firstname))
end as firstname
from
update
set firstname = Case when patindex('% %',firstname) >0 then
upper(left(firstname,1))
+ rtrim(substring(firstname,2,patindex('% %',firstname)-1))
+ ' '
+ Upper(substring(firstname,patindex('% %',firstname)+1,1))
+ rtrim(substring(firstname,patindex('% %',firstname)+2, len(firstname)))
else
upper(left(firstname,1)) + substring(firstname,2,len(firstname))
end
source
share