Convert SQL Server Table to XML

Hi Friends , This post to let you know, How to Convert SQL Server Database Table into XML. Let’s see following steps —–

Step 1 . Execute ” Select * From DEPT ” Query to check the Records inside the Table.

step 1
  • Step 2 : To convert Sql Server data into xml , We must use ” FOR XML PATH ” and ” ROOT ” . using ” FOR XML PATH ” , It returns result set as the XML element. using ROOT directive , it provides the root element name.
step 2

step 3 : click xml link to show XML editor.

step 3

step 4 : Right click on ” XML_F52E2B61 -18A ” and go to “Save Results As…” after that give meaning file name.

step 4
  • Step 5 : A file created on Desktop with Name ” XmlExample ” .
step 5

step 6 : Right click on file and you can check the extension of file .

Happy Query , Thanks….

Post Author: adama

Leave a Reply

Your email address will not be published. Required fields are marked *