I found a function on the internet which works really fast and doesn't require an UDF or CLR that removes the tags in an XML field. The problem I have with the function I've found is that it concatinates the values with no spaces or characters in between. I'm not very good with XML and especially not good with XML and SQL server, so can some-one help me out (I have literly tried for hours on my own) adjusting this so that it out puts the text with an space between values?
ALTER function [dbo].[StripTags]( @text varchar(max) ) returns varchar(max) asbegin
declare @textXML xml
declare @result varchar(max)
set @textXML = REPLACE( @text, '&', '' );
with doc(contents) as
(
select chunks.chunk.query('.') from @textXML.nodes('/') as chunks(chunk)
)
select @result = contents.value('.', 'varchar(max)') from doc
return @result
end
GO
George P Botuwell, Programmer