【发布时间】:2014-09-22 06:54:17
【问题描述】:
我想在 xml 中插入一个表格
select * from Student for xml auto
但我想这样做,所以在 xml 中创建以下行
<Files> <File FileName="Student.txt" NumberOfRows="44" /> </Files>
我该怎么做?
【问题讨论】:
标签: sql sql-server xml sql-server-2008
我想在 xml 中插入一个表格
select * from Student for xml auto
但我想这样做,所以在 xml 中创建以下行
<Files> <File FileName="Student.txt" NumberOfRows="44" /> </Files>
我该怎么做?
【问题讨论】:
标签: sql sql-server xml sql-server-2008
这样写你的查询会给你预期的输出。
select( '<Files>' +
(select 'Student.txt' as FileName,count(*) as NumberofRows from Student for xml auto) + '</Files>')
【讨论】: