I have an sql query, selects some data from a table.
ID Name Number Email 1 a 123 a@a.com 2 b 321 b@b.com 3
Try this:
SELECT * FROM dbo.YourStudentTable FOR XML PATH('Student'), ROOT ('Students')
This should return exactly the XML you're looking for (assuming you have SQL Server 2005 or newer)
Read more about how to use FOR XML PATH and its capabilities on TechNet