Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save HTML data in Sql Server

I have feedback panel where user can write HTML formated feedback using AJAX HTMLEditor

I want to save this HTML DATA in SQL server

HTML SOURCE

This is <span style="font-weight: bold; ">nice</span> question

HTML OUTPUT

This is nice question

Now how can i search to my database if your find "is nice" then my query can not response is nice because database contains HTML tags too.

So what are best practices to save and retrieve HTML data using SQL Query & ASP.net.

like image 817
SOF User Avatar asked Aug 16 '10 04:08

SOF User


2 Answers

You might get some mileage out the SQL Server's full-text search capability. Here is a resource that describes strategies to apply full-text search to HTML text stored in SQL Server:

http://www.developmentnow.com/blog/SQL+Server+2005+Full+Text+Search+On+HTML+Documents.aspx

like image 113
kbrimington Avatar answered Oct 05 '22 23:10

kbrimington


If you're using SQL Server 2008 then full-text indexing is a good option. Store your HTML in a varbinary(max) column and set its associated file type to ".html" in a file type column. The full-text indexer will parse the data as HTML and search only the text content while ignoring the HTML tags.

like image 31
Chris Fulstow Avatar answered Oct 06 '22 00:10

Chris Fulstow