由买买提看人间百态

topics

全部话题 - 话题: messageno
(共0页)
d*******n
发帖数: 109
1
来自主题: Database版 - XML format
我希望XML里面出现这样的格式:

1
XX

2107


但是我按如下方式写Code的时候出现的不对,请问有什么方法达到上面的格式。
select
'1' AS "MessageNo",
'XX' AS "MessageID"
(select a AS 'No'
from b where c = 1 for XML path('Load'),ELEMENTS)
for XML path('Message'),ELEMENTS
XML实在是把我搞糊涂了,
谢谢指教。
d*******n
发帖数: 109
2
来自主题: Database版 - XML format
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,
(共0页)