DECLARE @xml xml
SET @xml = ' <Root> <Item1 /> <Item2 /> <Item3 /> <Item4 /> <Item5 /> </Root> '
SET @xml.modify (' insert element Item6 {} as last into (/Root)[1] ')
SELECT @xml
/* This projection produces (note the empty brackets above, {}, indicating a nil value for Item6):
<Root>
<Item1 />
<Item2 />
<Item3 />
<Item4 />
<Item5 />
<Item6 />
</Root>
Note that the modify() method
uses Microsoft-specific XML DML.
This is not part of the XQuery standard.
For general information, see
“Introduction to XQuery in SQL Server 2005”
http://technet.microsoft.com/en-us/library/ms345122.aspx
*/