Removing HTML from an Ntext Field

  • Hey all,

    I have a table which I can not modify its structure. It contains an ntext field. This field is inserted with HTML code and I need to remove it via a stored procedure.

    I already have something working on our SQLServer 2005 machines. Pretty easy there but SQLServer 2000 is the pain and we have too many clients on it to just easily migrate them all.

    So, I have a stored procedure which if given the ntext data will break it up and feed it to a function which will strip out the HTML. The problem is getting it to this stored procedure.

    Here are some of the ...challenges:

    Can't use a stored procedure in a select.

    If stored procedure is converted to a function it will no longer be able to break up the ntext because of the way it works and a function's limitations.

    Thought of doing something slick like passing the info to a function so that I could use a select then in the function calling the stored procedure but can't call a non-extended stored procedure from a function. Thought of creating one and hoping it could then call the stored procedure but I suspect not.

    Anyone have any ideas? Besides upgrading to 2005? 🙂 Right now I'm playing around with an idea to use XML as a way around the limitations of ntext but still researching that. It'll be my last try before giving in to the fact that SQLServer 2000 simply treats ntext as the red headed step child.

  • Here is a starter how to remove tags in a text

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90034


    N 56°04'39.16"
    E 12°55'05.25"

  • Hi there and thanks for the reply. The problem is that the field is Ntext ie we have over 8K worth of text in those fields. The problem isn't just getting it done because we're doing it via ASP. We were trying to optimize it some and move all the code to stored procedures and such but it doesn't look like that will be possible with SQLServer 2000. We have other clients on 2005 and we have things working beautifully. It's just SQLServer 200.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply