d*******n 发帖数: 109 | 2 I figured it out myself,
the code should be something like this:
select
'1' AS "MessageNo",
'DLA' AS "MessageID" ,
(select a AS 'No'
from b where c = 1 for XML path('Load'),type, ELEMENTS)
for XML path('Message'),type,ELEMENTS
this key thing for me is to add 'type', so force the XML conversion, without
the 'type', some wrong codes will be generated.
Thanks, |
|