sql - Problems With FOR XML AUTO -
i have following query:
select questionid_pk , questiontitle , ( select dbo.tags.tagid_pk , dbo.tags.tagtitle , dbo.tags.tagtitle_en dbo.question_tag_rel inner join dbo.questions on dbo.question_tag_rel.questionid_fk = dbo.questions.questionid_pk inner join dbo.tags on dbo.question_tag_rel.tagid_fk = dbo.tags.tagid_pk , dbo.questions.questionid_pk = '2116' xml path('') , type , elements ) tags questions questionid_pk = '2116' xml auto , elements;
which produces xml:
<questions> <questionid_pk>2116</questionid_pk> <questiontitle>trying find execution time of code using this</questiontitle> <tags> <tagid_pk>3</tagid_pk> <tagtitle>جافا</tagtitle> <tagtitle_en>java</tagtitle_en> <tagid_pk>8</tagid_pk> <tagtitle>بايثون</tagtitle> <tagtitle_en>python</tagtitle_en> <tagid_pk>9</tagid_pk> <tagtitle>أندرويد</tagtitle> <tagtitle_en>android</tagtitle_en> </tags> </questions>
as can see, want (tagid_pk,tagtitle,tagtitle_en)tags inside parent xml tag ,here sample of query should output:
<questions> <questionid_pk>2116</questionid_pk> <questiontitle>trying find execution time of code using this</questiontitle> <tags> <tag> <tagid_pk>3</tagid_pk> <tagtitle>جافا</tagtitle> <tagtitle_en>java</tagtitle_en> </tag> <tag> <tagid_pk>8</tagid_pk> <tagtitle>بايثون</tagtitle> <tagtitle_en>python</tagtitle_en> </tag> <tag> <tagid_pk>9</tagid_pk> <tagtitle>أندرويد</tagtitle> <tagtitle_en>android</tagtitle_en> </tag> </tags> </questions>
in order bind repeater in asp.net application,
can please me ?
change xml path('')
xml path('tag')
Comments
Post a Comment