472,119 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Reading rtf from an image field

Hi,

Tasks in a MS Project SQL Server database have an image field called
TASK_RTF_NOTES. It contains text in RTF format. We would like to convert
this within a standard SQL statement into plain text.

I suspect this is not possible without some sort of bolt-on, or at the very
least using T-SQL in some way.

Any ideas?

Thanks,

Gareth

Jul 20 '05 #1
4 6836

"Gareth Thackeray" <fi****************@logicacmg.com> wrote in message
news:10***************@ernani.logica.co.uk...
Hi,

Tasks in a MS Project SQL Server database have an image field called
TASK_RTF_NOTES. It contains text in RTF format. We would like to convert
this within a standard SQL statement into plain text.

I suspect this is not possible without some sort of bolt-on, or at the very least using T-SQL in some way.

Any ideas?

Thanks,

Gareth


SQL is not a good language for text processing - a better approach would be
to use an external script or program to read out the RTF data, convert it,
then UPDATE the row with the new plain text data.

In theory, you might be able to write something in TSQL using REPLACE() to
remove all the RTF metadata strings, but it would be much easier to look for
an existing tool or piece of code in your preferred language (Perl, VB, C#
etc), then write a simple script to do this.

Simon
Jul 20 '05 #2
Gareth Thackeray (fi****************@logicacmg.com) writes:
Tasks in a MS Project SQL Server database have an image field called
TASK_RTF_NOTES. It contains text in RTF format. We would like to convert
this within a standard SQL statement into plain text.

I suspect this is not possible without some sort of bolt-on, or at the
very least using T-SQL in some way.


I don't know RTF very well, but from what I have seen of it, I certainly
would not try to extract the plain text using T-SQL. Sure, you can use
a screwdriver to drive a nail if you try real hard, but why?`

Possibly in the next version of SQL Server where you can call CLR directly
in SQL Server it could be worth trying.

But for now, do as Simon says and get the data to the client-side and
try something there. (For instance, open the document from Word as
RTF and save as plain text, using a Word-macto. Why reinvent wheels?)
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3
"Erland Sommarskog" <es****@sommarskog.se> wrote in message
news:Xn**********************@127.0.0.1...
Gareth Thackeray (fi****************@logicacmg.com) writes:
Tasks in a MS Project SQL Server database have an image field called
TASK_RTF_NOTES. It contains text in RTF format. We would like to convert this within a standard SQL statement into plain text.

I suspect this is not possible without some sort of bolt-on, or at the
very least using T-SQL in some way.


I don't know RTF very well, but from what I have seen of it, I certainly
would not try to extract the plain text using T-SQL. Sure, you can use
a screwdriver to drive a nail if you try real hard, but why?`

Possibly in the next version of SQL Server where you can call CLR directly
in SQL Server it could be worth trying.

But for now, do as Simon says and get the data to the client-side and
try something there. (For instance, open the document from Word as
RTF and save as plain text, using a Word-macto. Why reinvent wheels?)


Thankyou both for your advice.

FYI, the reason for trying the route we are trying is that we are
integrating into Remedy ARS, and the built-in database integration only
allows views and tables to provide the data for a "View Form".

Furthermore, it is not permitted to add an image (or text...) field to the
form, so we would need to convert it at the SQL level.

I had thought it was probably a long shot but you don't get if you don't
ask..

Thanks again,

Gareth
Jul 20 '05 #4
Gareth Thackeray (fi****************@logicacmg.com) writes:
FYI, the reason for trying the route we are trying is that we are
integrating into Remedy ARS, and the built-in database integration only
allows views and tables to provide the data for a "View Form".

Furthermore, it is not permitted to add an image (or text...) field to the
form, so we would need to convert it at the SQL level.


You could have a separate job that reformats the RTF stuff into something
presentable. But if you cannot present text column in Remedy, you are pretty
lost anyway, unless you can accept to view the first 8000 chars only.

I have never heard of Remedy ARS, but I suppose there is a vendor. It may
be worth contact them and ask for suggestions.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by John | last post: by
1 post views Thread by Cy | last post: by
reply views Thread by Tony Lugg | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.