sql - Full Stop/Capital letters in TSQL -


i trying format text , although have used various tpes of propercase function in past time it's not quite after. example text :-

this test see if correct. once has been done please let mark know.

how want format follows

this test see if correct. once has been done please let mark know.

in essence want capital letter either @ beginning of text string or after full stop, possible?

thanks pd

you use code below. i'm pretty sure sql not best tool interesting exercise. code below works following assumptions:

there's no exceptions words "mark" in example, 2 rules beginning , full stop.

there's space after full stop (it easy change code below though if not case)

declare @input nvarchar(max) = 'this test see if correct. once has been done please let mark know.' declare @result nvarchar(max) = ''  ;with cte (     select substring(@input, 1, 1) ch, 1 idx      union      select substring(@input, cte.idx + 1, 1) ch, cte.idx + 1 idx     cte     cte.idx < len(@input) )  select     @result = @result + case when idx > 2 , (select ch cte t t.idx = cte.idx - 2) = '.'     upper(ch)     else           case idx         when 1 upper(ch)         else lower(ch)          end     end cte  print @result 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -