Skip to Content
0

how to extract data from rtf file

May 08 at 02:58 PM

36

avatar image

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 }')

10 |10000 characters needed characters left characters exceeded

Any help please

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

leo dec May 10 at 10:31 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Andrew Harderson May 09 at 05:06 PM
0

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.


rtf-test.png (45.8 kB)
Share
10 |10000 characters needed characters left characters exceeded