---
title: "How to show SQL Server XML format  Data"  
description: "How to show SQL Server XML format  Data"  
author: "Anonymous User"  
published: 2015-11-30  
updated: 2015-11-30  
canonical: https://www.mindstick.com/forum/33664/how-to-show-sql-server-xml-format-data  
category: "database"  
tags: ["xml", "sql server", "sql"]  
reading_time: 2 minutes  

---

# How to show SQL Server XML format  Data

I want to show [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) [XML](https://www.mindstick.com/blog/203/working-with-xml-data-in-sql-server) [format](https://www.mindstick.com/forum/162083/how-to-convert-ost-files-into-pst-format) in [sql server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) please help me.

## Replies

### Reply by Anonymous User

[SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over) lets you retrieve data as XML by supporting the FOR XML clause, which can be included as part of your query. You can use the FOR XML clause in the main (outer) query as well as in subqueries. The clause supports numerous options that let you define the format of the XML data.\
The AUTO mode in a FOR XML clause is slightly different from the RAW mode in the way that it generates the XML result set. The AUTO mode generates the XML by using heuristics based on how the SELECT statement is defined.

```
select * from Employee SELECT Emp_ID, Emp_Name,Emp_SalFROM Employee   FOR XML AUTO;
```

```
<Employee Emp_ID="1" Emp_Name="Amit" Emp_Sal="100000.00"/> <Employee Emp_ID="2" Emp_Name="Mohan" Emp_Sal="1200.00"/> <Employee Emp_ID="3" Emp_Name="Avin" Emp_Sal="1100.00"/> <Employee Emp_ID="4" Emp_Name="Manoj" Emp_Sal="1300.00"/> <Employee Emp_ID="5" Emp_Name="Riyaz" Emp_Sal="1400.00"/> <Employee Emp_ID="7" Emp_Name="Shukla" Emp_Sal="9200.00"/> <Employee Emp_ID="8" Emp_Name="Shailu" Emp_Sal="900.00"/> <Employee Emp_ID="9" Emp_Name="Shailu" Emp_Sal="900.00"/> <Employee Emp_ID="10" Emp_Name="Vivek" Emp_Sal="5000.00"/> <Employee Emp_ID="11" Emp_Name="Manoj" Emp_Sal="5000.00"/> <Employee Emp_ID="12" Emp_Name="Suraj" Emp_Sal="51200.00"/> <Employee Emp_ID="13" Emp_Name="vrijesh" Emp_Sal="544200.00"/> <Employee Emp_ID="14" Emp_Name="rakesh" Emp_Sal="879252.00"/> <Employee Emp_ID="15" Emp_Name="avishek" Emp_Sal="45000.00"/> <Employee Emp_ID="16" Emp_Name="manish" Emp_Sal="10000.00"/> <Employee Emp_ID="17" Emp_Name="suresh" Emp_Sal="5000.00"/> <Employee Emp_ID="18" Emp_Name="pradeep" Emp_Sal="45000.00"/> <Employee Emp_ID="19" Emp_Name="kamlesh" Emp_Sal="45000.00"/> <Employee Emp_ID="20" Emp_Name="arun" Emp_Sal="45000.00"/> <Employee Emp_ID="21" Emp_Name="ahiv" Emp_Sal="78210.00"/> <Employee Emp_ID="22" Emp_Name="vimal" Emp_Sal="9411.00"/> <Employee Emp_ID="23" Emp_Name="vijay" Emp_Sal="15452.00"/> <Employee Emp_ID="24" Emp_Name="rajeev" Emp_Sal="78900.00"/>
```


---

Original Source: https://www.mindstick.com/forum/33664/how-to-show-sql-server-xml-format-data

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
