SQLServer 2005 user Here is an example of a line I'm stuck on: {\ rtf1 \ ansi \ ansicpg1252 \ deff0 \ deflang1033 {\ fonttbl {\ f0 \ fnil \ fcharset0 Arial Rounded MT Bold;} {\ f1 \ fnil \ fcharset0 Arial;}} \ viewkind4 \ uc1 \ pard \ f0 \ fs54 1000 \ f1 \ fs20 \ par}
I want to replace any font name with "Times New Roman"
I can get the first with (textlong1 is this field):
Select Replace(textlong1, CASE When CharIndex(';',textlong1)> 10 Then SubString(textlong1 , Charindex('fcharset',textlong1)+10 , CharIndex(';',textlong1) - Charindex('fcharset',textlong1)-10) Else '' End , 'Times New Roman') From exampletable
I use case statement to prevent SubString error.
Since I do not replace "fcharset", even if I go through it, it does not find the second instance (it always loops on the first).
Jeffo source share