我有一个生成xml文档的查询。我已经完成了所有工作,除了一行在xml标签之外。知道为什么会这样吗?我错过了什么吗?编辑 - 我还注意到最后一个变量一起丢失。
这是生成xml ...
的查询 select
1 as tag,null as parent,'' as 'labels!1',
'SPICE ZEBRA LPN' as 'labels!1!_FORMAT',
'ProductionLabel' as 'labels!1!_JOBNAME',
1 as 'labels!1!_QUANTITY',
@printer as'labels!1!_PRINTERNUMBER',
'' as 'label!2',
null as 'variable!3','seq' as 'variable!3!name',
null as 'variable!4','day_n' as 'variable!4!name',
null as 'variable!5','bottom' as 'variable!5!name',
null as 'variable!6','JOB_NUMBER' as 'variable!6!name',
null as 'variable!7','desc2' as 'variable!7!name',
null as 'variable!8','part' as 'variable!8!name',
null as 'variable!9','DESCRIPTION' as 'variable!9!name',
null as 'variable!10','INPUT_QTY' as 'variable!10!name',
null as 'variable!11','QTY_LABELS_TO_PRINT' as 'variable!11!name'
union all
select
2 as tag,1 as parent,'','1','','','','',
seq ,'seq',
day_n ,'day_n',
bottom,'bottom',
JOB_NUMBER,'JOB_NUMBER',
desc2,'desc2',
part, 'part',
DESCRIPTION,'DESCRIPTION',
INPUT_QTY,'INPUT_QTY',
QTY_LABELS_TO_PRINT, 'QTY_LABELS_TO_PRINT'
from cte
union all
这就是输出的样子......
<labels _FORMAT="SPICE ZEBRA LPN" _JOBNAME="ProductionLabel" _QUANTITY="1" _PRINTERNUMBER="4">
<label>
<variable name="seq">1</variable>
<variable name="day_n">Tuesday</variable>
<variable name="bottom">Date:Oct 27 2015, Factory:88, Area:1DRY</variable>
<variable name="JOB_NUMBER">433112</variable>
<variable name="desc2">500425 (Frz Cosi Turkey Chili Soup - Bulk) </variable>
<variable name="part">Order:*, Part:100699, Name:Base, Turkey (JMH) </variable>
<variable name="DESCRIPTION">Mix With Bean Water</variable>
</label>
<variable name="INPUT_QTY">52.199994000000</variable>
<label>
任何人都可以告诉我为什么INPUT_QTY在标签标签之外吗?
提前致谢!