Decode html in SQL Server

  • Thread starter Thread starter Susan Geller
  • Start date Start date
S

Susan Geller

I have an c#.net app which writes to a sql server db and in one table,
stores data with html coding. (string strNote =
HttpUtility.HtmlEncode(txtNote.Text);) I want to report on this data from
SQL Server using an Access adp application. Is there a way in SQL Server
that can decode the html so that I don't have text that shows up like this
on my report: >Subject: RE: my program
>Date: Thu, 30 Dec 2004 09:25:12 -0600

Thanks.
--Susan
 
You have quite a problem on your hands. Not all HTML is text. Some is HTML
elements, such as tables, divs, etc. It is designed to be displayed in a
browser, which interprets it according to the rules of HTML. What would your
business rules be in regards to, for example, a table with 2 columns having
text in one column and an image in the other?

Bottom line is, the problem can be solved, but you need to more finely
define the business requirements before you can come up with a solution.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
Kevin,

The data that is entered into the one field in question is a simple note
field. There are lots of character type things like breaks and apostrophes,
but nothing like a table or a div. What would approach be given that kind
of set up?
--Susan
 
Well, I'm not sure what a "simple note field" is, but if you can identify
all the HTML markup that can be in it, you can use Regular Expressions to
replace these with the appropriate characters.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
I have never used access but I think that you can scrub the data on it's way
in using VBA. VBA has built in functions to decode html.
 
Back
Top