views:

318

answers:

2

how to remove html elements in a text field from sql server

+2  A: 

I assume you mean removing html tags from a field stored in a database. If so, and if you can code the solution in .NET, I would have used the HTML agility pack to traverse the html contents, and save the InnerText (i think that's the property name) of the elements in which you are interested to a variable. Then replace the contents of the field with the contents of the variable.

Eyvind
+1  A: 

You could use a CLR Procedure (SQL Server 2005 and above) to decode the HTML , stripping out the tags.

This looks like an example of what you want to achieve.

SQL Server CLR Procedure

Coolcoder