I have a question on how to convert the first next char to uppercase after the '/' sign in the string.
As an example :
CustomerName
: ramayanan s/o vicky ratnam
First i need it in the propercase, so i use this :
Update
dbo.table set CustomerName = dbo.ProperCase(CustomerName)
result : Ramayanan S/o Vicky Ratnam
but i need it to be as : Ramayanan S/O Vicky Ratnam
(the first char after the /
should be in uppercase
)
Please check:
declare @T table(Insurance varchar(max))
insert into @T values ('roeselare')
insert into @T values ('BRUGGE')
insert into @T values ('ramayanan s/o vicky ratnam')
select (
select upper(T.N.value('.', 'char(1)'))+
lower(stuff(T.N.value('.', 'varchar(max)'), 1, 1, ''))+(CASE WHEN RIGHT(T.N.value('.', 'varchar(max)'), 1)='/' THEN '' ELSE ' ' END)
from X.InsXML.nodes('/N') as T(N)
for xml path(''), type
).value('.', 'varchar(max)') as Insurance
from
(
select cast('<N>'+replace(
replace(
Insurance,
'/', '/</N><N>'),
' ', '</N><N>')+'</N>' as xml) as InsXML
from @T
) as X