Decode html in SQL Server

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
 
K

Kevin Spencer

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.
 
S

Susan Geller

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
 
K

Kevin Spencer

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top