【发布时间】:2011-12-08 22:15:34
【问题描述】:
我在表中有 xml 列,我想解析 xml 并将值插入新表中
如何将xml值插入到表中?
CREATE TABLE [dbo].[PubmedMeshDescriptors](
[ID] [int] IDENTITY(1,1) NOT NULL,
[PMID] [int] NULL,
[Descriptor] [nvarchar](400) NULL,
[DescriptorIsMajor] [char](1) NULL,
[Qualifier] [nvarchar](400) NULL,
[QualifierIsMajor] [char](1) NULL
)
另一个表中的xml列是这样的
<MedlineCitation Owner="NLM" Status="MEDLINE">
<PMID Version="1">1</PMID>
<MeshHeadingList>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Aldehyde Oxidoreductases</DescriptorName>
<QualifierName MajorTopicYN="N">metabolism</QualifierName>
</MeshHeading>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Animals</DescriptorName>
</MeshHeading>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Carbon Dioxide</DescriptorName>
<QualifierName MajorTopicYN="N">blood</QualifierName>
</MeshHeading>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Formates</DescriptorName>
<QualifierName MajorTopicYN="N">blood</QualifierName>
<QualifierName MajorTopicYN="Y">poisoning</QualifierName>
</MeshHeading>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Haplorhini</DescriptorName>
</MeshHeading>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Hydrogen-Ion Concentration</DescriptorName>
</MeshHeading>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Methanol</DescriptorName>
<QualifierName MajorTopicYN="N">blood</QualifierName>
</MeshHeading>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Methods</DescriptorName>
</MeshHeading>
<MeshHeading>
<DescriptorName MajorTopicYN="N">Pseudomonas</DescriptorName>
<QualifierName MajorTopicYN="N">enzymology</QualifierName>
</MeshHeading>
</MeshHeadingList>
</MedlineCitation>
如何使用 sql 查询来做到这一点?
【问题讨论】:
标签: sql-server xml sql-server-2008