SQL Server Performance

Image (RTF data) to plain text string

Discussion in 'SQL Server 2005 General Developer Questions' started by atulgoswami, Apr 27, 2010.

  1. atulgoswami New Member

    I have table, in which RTF documents are stored in Image Data type column. Now i need to convert this RTF data to plain text in readable format using T-SQL only.
    Existing code is using some DLL (RTF to TEXT), which is invoked using SP_OACreate and need to change as permission to execute SP_OACreate is revoked.
    I did little search and i found couple of functions
    sys.fn_varbintohexstr
    sys.fn_sqlvarbasetostr
    sys.fn_varbintohexsubstring
    But could not get through.

    Is it something like
    - first i need to convert this to varbinary then hexstring then plain text
    - If i convert this to varbinary and then to str using sys.fn_sqlvarbasetostr then it is in some format, which i can not use directly and again need to fomat to plain text (directly readable fomat)
    - Is there any way to remove additional RTF details from this (like {
    tf1ansiansicpg1252deff0{fonttbl{f0fswissfcharset0 Microsoft Sans Serif;})?
    - Or is there way to extract the main text from this RTF?

    Any idea/suggestion would be of great help.Thanks in advance
  2. FrankKalis Moderator

    Not sure if this is still an issue for you, but I wouldn't think of doing this in the database. Is this a strict requirement to use T-SQL only?

Share This Page