Found this code for removing HTML tags from my data, but I am ashamed to say, I have no clue how it works. Could someone point me in the right direction so I can understand what it is doing?
create function dbo.StripHTML( @text varchar(max) ) returns varchar(max) as
declare @textXML xml
declare @result varchar(max)
set @textXML = @text;
with doc(contents) as
select chunks.chunk.query('.') from @textXML.nodes('/') as chunks(chunk)
select @result = contents.value('.', 'varchar(max)') from doc
What the heck is chunks.chunk.query?? I consider myself to be a Sr. DBA but this has me stumped. I figure it is a xml function of some type but can't seem to find any information on it. Any help greatly appreicated!!!