单一对象JSON数组?

时间:2018-11-29 10:15:24

标签: c# sql .net json xml

我正在这样使用我的Employee表,

+-------+---------+--------+----------+
| Empid | Empname | Salary | Location |
+-------+---------+--------+----------+
|     1 | Arul    |    100 | Chennai  |
+-------+---------+--------+----------+

XML生成SQl查询:

select * from employee for xml path, root('root')

从此Sql查询中,我正在获取如下所示的XML文件

<root>
  <employee>
    <Empid>1</Empid>
    <Empname>Arul</Empname>
    <Salary>100</Salary>
    <Location>Chennai</Location>
  </employee>
</root>

但是我期望SQL查询的XML输出为

<root>
<column>Empid</column>
<value>1</value>
<column>Empname</column>
<value>Arul</value>
</root>

0 个答案:

没有答案