开发者

How do I Insert a node into sql xml column using Sql Server 2008?

Hi All I have a document with this structure.

   <Employee>
      <Group Id="1">
         <Employee Id="2" />
         <Employee Id="3" />
         <Employee Id="4" />
         <Employee Id="5" />
         <Group Id="2">
            <Employee Id="6" />
            <Employee Id="7" />
            <Employee Id="8" />
            <Employee Id="9" />
         </Group>
      </Group>
      <Group Id="3">
        <Employee Id="10" />
        <Employee Id="11" />
        <Employee Id="12" />
        <Employee Id="13" />
        <Employee Id="14" />
     </Group>
  </Employee>

As you can see Group 1 has a "SubGroup" if you like called Group id 2 I need to 开发者_如何学Pythoninsert another subgroup into Group Id 1 AS follows

       <Group Id="4">
          <Employee Id="15" />
          <Employee Id="16" />
          <Employee Id="17" />
          <Employee Id="18" />
          <Employee Id="19" />
        </Group>

The result will be that GROUP 1 will have 2 subgroups .

How can do it?

Any suggestions? Never used sql xml. thanks!


Read XML data, change XML, store XML.

Insert / Update is not supported by SQL Server. XML data type is not a replacement for using the relational engine. It is for storing YXML Structured document data (and supports query based on it).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜