SQLTeam.com | Weblogs | Forums

Conversion issue from RTF to PlainText


Hello All,

I have a table where the the end data stored in RTF format. but I would like to see the same data in plain text format. I referred the forum and created a function called fnParseRTF in my database and used that function to see the output of my rtf data.

Below is the link which I referred for creating the function


below is the query which i tried from my side

SELECT dbo.fnParseRTF(trf_data) as PlainText
FROM obj2

The Data which I am processing is,

{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman\fcharset1 Tahoma;}}{\colortbl\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue127;\red0\green127\blue127;\red0\green127\blue0;\red127\green0\blue127;\red127\green0\blue0;\red127\green127\blue0;\red127\green127\blue127;\red192\green192\blue192}{\info{\creatim\yr2017\mo2\dy27\hr3\min42\sec58}{\version1}{\vern262367}}\paperw12240\paperh15840\margl239\margr1441\margt239\margb241\deftab720\pard\ql\li0\fi0\ri1440{\f0\fs20\cf0\up0\dn0 Dr. Test is her Internist/GI}}

The output which I got is,


The expected output is, Dr. Test is her Internist/GI

It seems like there is something wrong in the function or in my sql query. can someone help me on it


There was discussion in that thread about the limitations, and also an alternative using COM objects - did you try that?