Skip to Content

how to extract data from rtf file

hi

I need to extract data from rtf file and save in sql server column...

Is there any function to achieve the same?

rtf file :-

('{\rtf1\ansi\ansicpg1252\deff0\deflang1030\deflangfe1030{\fonttbl{\f0\froman\fprq2\fcharset0 CG \par \par Times;}{\f1\froman\fcharset0 Times New;}{\f2\froman\fprq2\fcharset0 Times New Roman;}}\par \viewkind4\uc1\pard\nowidctlpar\tx5100\tx6690\f0\fs24 ACCIDENT AND EMERGENCY \par \par \par BROWN,JACKIE 00030110R PROF. G. PAR \par 39 Claremint Gardens 06/11/1928 OP \par MP \par 1805252166 \par \par 08/12/2002 GEB02-46531 L FOOT \par Left foot:- \par there is an oblique fracture through the proximal phalanx of the \par little toe. \par DR. W. BASHIST/TT REPORTED USING VOICE \par Final ID: 196582166 \par 09/12/2002 FOOT GEB02-47831/0003250R \par \par }')

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 10 at 10:31 AM

    Hi

    Thanks for the reply.... I tried what you suggested.. but it is showing all the tags as well... I don't want any formatted tags... only data needs to be extracted...

    sql table showing data:-

    {\rtf1\ansi\ansicpg1252\deff0\deflang1030\deflangfe1030{\fonttbl{\f0\froman\fprq2\fcharset0CG \par \par Times;}{\f1\froman\fcharset0 Times New;}{\f2\froman\fprq2\fcharset0 Times NewRoman;}}\par \viewkind4\uc1\pard\nowidctlpar\tx5100\tx6690\f0\fs24 ACCIDENT AND EMERGENCY

    result expected:-

    ACCIDENT AND EMERGENCY BROWN,JACKIE 00030110R PROF. G. PAR 39 Claremint Gardens 06/11/1928 OP 1805252166 08/12/2002 GEB02-46531 L FOOT Left foot: there is an oblique fracture through the proximal phalanx of the little toe.DR. W. BASHIST REPORTED USING VOICE Final ID: 196582166 09/12/2002 FOOT GEB02-47831/0003250R

    Add comment
    10|10000 characters needed characters exceeded

  • May 09 at 05:06 PM

    Have you tried creating a fixed width file format, with a single field (size 1000 or so, bigger than the length of the text in the file) and 'none' as the row delimiter? I just tested an RTF file with the content you posted and it extracted everything in the file into a SQL Server temp table without issue.

    This is assuming you don't need to parse through the file to extract specific pieces of information.

    Add comment
    10|10000 characters needed characters exceeded