Source Table
Result : XML Generation using Sql query and Formatting
Format Tips using 'for xml auto'
1.This will take table name as node name.
2.Create nodes as much table you joined in the query.
3.Columns of the table you mention in query will come as attribute.
simple example query is below for above out put
Select
Students.[Student] as Name
,Exams.[Exams] as Exam
,Scores.Subject as Subject
,Scores.Marks as Marks
from
StudentDetails as Students
join
StudentDetails as Exams
on
Exams.Id = Students.Id
join
StudentDetails as Scores
on
Scores.Id = Students.Id
for xml auto



No comments:
Post a Comment