In this post, I have created one user defined function to remove all HTML tags from the string data of SQL Server.
There are certain requirements like, store HTML document into the text column, but unfortunately it also contains HTML tags which required to remove.
I have found one user defined function to remove all HTML Tags from the given string.
CREATE FUNCTION dbo.RemoveHTML (@HTMLData VARCHAR(MAX))
RETURNS VARCHAR(MAX) AS
DECLARE @HTMLDataXML XML
DECLARE @ResultData VARCHAR(MAX)
SET @HTMLDataXML = REPLACE( @HTMLData, '&', '' );
WITH HTMLDoc(texts) AS
SELECT chunks.chunk.query('.') FROM @HTMLDataXML.nodes('/') AS chunks(chunk)
SELECT @ResultData = texts.value('.', 'varchar(max)') FROM HTMLDoc
SELECT dbo.RemoveHTML('<html><body> This <i> is </i> a <b>Database</b> Research and <u>Development </u> </body></html>')
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.