DECLARE @v_xml XML
SET @v_xml =(SELECT * FROM DELETED Where ID=@PKValue
FOR xml AUTO, root('Record'),elements XSINIL)
和我得到的xml如下
<Record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DELETED>
<ID>1</ID>
<SpecialistID>52</SpecialistID>
<EntryDate>2011-02-01T00:00:00</EntryDate>
<HoursData>32.00</HoursData>
<Row>6</Row>
<Col>3</Col>
<Options>rdSalvage</Options>
<Comments>test2</Comments>
<UpdatedBy>Tridip</UpdatedBy>
<ModDate>2014-03-21T19:03:22.403</ModDate>
</DELETED>
</Record>
我想删除Record opening & closing tag
我知道该怎么做
DECLARE @v_xml XML
SET @v_xml =(SELECT * FROM DELETED Where ID=@PKValue
FOR xml AUTO, elements XSINIL)
但我不知道如何用Log替换DELETED opening & closing tag
所以新的xml看起来像
<Log>
<ID>1</ID>
<SpecialistID>52</SpecialistID>
<EntryDate>2011-02-01T00:00:00</EntryDate>
<HoursData>32.00</HoursData>
<Row>6</Row>
<Col>3</Col>
<Options>rdSalvage</Options>
<Comments>test2</Comments>
<UpdatedBy>Tridip</UpdatedBy>
<ModDate>2014-03-21T19:03:22.403</ModDate>
</Log>
所以请指导我以及在哪里做更改。感谢
答案 0 :(得分:0)
DECLARE @v_xml XML
SET @v_xml =(SELECT * FROM DELETED AS [Log] Where ID=@PKValue
FOR xml AUTO, elements XSINIL)