I have a table structure like below :
SELECT
[EmpID], [EmpName],
[DeptName],
[BirthDate]
FROM
[dbo].[Employees]
I want to convert this table data into XML and the final output will be like below:
<Employees DeptName="ABC">
<Employee EmpID="1">
<EmpName>Davolio</EmpName>
<BirthDate>10/12/1989</BirthDate>
</Employee>
<Employee EmpID="2">
<EmpName>Andrew</EmpName>
<BirthDate>05/02/1985</BirthDate>
</Employee>
<Employee EmpID="3">
<EmpName>David</EmpName>
<BirthDate>11/09/1982</BirthDate>
</Employee>
</Employees>