SQL Server - Remove XML tags from XML document and combine values of XML nodes into single paragraph

Example -  Remove XML tags from XML document and convert values of XML nodes into single paragraph  


USE AdventureWorks2012

WITH XMLNAMESPACES( 'http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/Resume' AS  "RES")
UPDATE [AdventureWorks2012].[HumanResources].[JobCandidate]
SET Resume.modify('
  insert(<?xml-stylesheet href="Resume.xsl" type="text/xsl"?>)
  before(/RES:Resume)[1]')
WHERE JobcandidateID  IS NOT NULL;

Try the below query,copy the XML document and paste it into notepad and save it as .xhtml as shown in below image:

SELECT Resume FROM [AdventureWorks2012].[HumanResources].[JobCandidate]



Now open the saved file ,you will notice as shown in below image :


No comments: