执行以下查询
SELECT AssessmentFileGUID as '@FileId',AssessmentFileTypeId as '@FileTypeId',AssessmentFileName
FROM rat.AssessmentFile where AssessmentId=17
for xml path('File'),root('Files')
给我以下结果:
<Files>
<File FileId="2A23D836-612F-418E-BDE8-F182C5432A0D" FileTypeId="1">
<AssessmentFileName>File-123213.pdf</AssessmentFileName>
</File>
<File FileId="CDA853B9-C587-4365-BAF5-972F8D217BAC" FileTypeId="2">
<AssessmentFileName>File-343455.png</AssessmentFileName>
</File>
</Files>
但是我需要以下格式:
<Files>
<File FileId="2A23D836-612F-418E-BDE8-F182C5432A0D" FileTypeId="1">File-123213.pdf</File>
<File FileId="CDA853B9-C587-4365-BAF5-972F8D217BAC" FileTypeId="2">File-343455.png</File>
</Files>