User SQLServer 2005 Here is an example of string I'm stuck with: {\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 one with (textlong1 is the 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'm using the case statement to prevent the SubString from error.
Since I am not replacing 'fcharset', even if I loop through, it is not finding the second instance (always gets stuck on the first).