select * , Left(Replace(Replace(Replace(Replace(Ltrim(tag),'<',''),'',''),'>',''),'/',''),
Case when CHARINDEX('{0}',(Replace(Replace(Replace(Replace(ltrim(tag),'<',''),'',''),'>',''),'/',''))) = 0
Then LEN(Replace(Replace(Replace(Replace(Ltrim(tag),'<',''),'',''),'>',''),'/',''))
Else
CHARINDEX('{0}',(Replace(Replace(Replace(Replace(ltrim(tag),'<',''),'',''),'>',''),'/','')))-1
END)
from TableName