I want table output as XML. My table result is
I need result like
Query
Declare @colorTable table (Category varchar(100),Attribute varchar(100))
insert into @colorTable values ('Color','Red')
insert into @colorTable values ('Color','Blue')
insert into @colorTable values ('Color','Green')
insert into @colorTable values ('Transport','Bus')
insert into @colorTable values ('Transport','Car')
insert into @colorTable values ('Transport','Twoweeler')
select * from @colorTable
FOR XML PAth(''), ROOT ('xml'), ELEMENTS;
Thanks,
S.Sundar


select ... for xml.Declare @colorTable table (Category varchar(100),Attribute varchar(100)) insert into @colorTable values ('Color','Red') insert into @colorTable values ('Color','Blue') insert into @colorTable values ('Color','Green') insert into @colorTable values ('Transport','Bus') insert into @colorTable values ('Transport','Car') insert into @colorTable values ('Transport','Twoweeler') select * from @colorTable FOR XML PAth(''), ROOT ('xml'), ELEMENTS;