htmlsqlplaintext

Comparison of HTML and plain text from SQL


There are two columns. One of them contains HTML and another contains plain text. How can I compare them as 2 plain texts? Converting HTML -> plain text should be done the same way as a browser does when copying selected HTML into clipboard and pasting it into notepad.


Solution

  • The answer to this SO question links to a user-defined function for stripping HTML tags from text. After doing this you can then compare with the plain text field, e.g.

    SELECT * FROM YourTable
    WHERE plainText = udf_stripHTML(htmlText)