sqlserver导入xml文件并解析

sqlserver导入xml文件并解析,第1张

概述create table #txml(incol int, xmlcol xml)   insert into #txml(xmlcol)   select * from openrowset(     bulk 'D:\wltp\vtls0609.xml',     single_blob) as x;   declare @xml xml        select @xml = xmlcol create table #txml(incol int,xmlcol xml)


  insert into #txml(xmlcol)
  select * from openrowset(
    bulk 'D:\wltp\vtls0609.xml',
    single_blob) as x;


  declare @xml xml
    
  select @xml = xmlcol from #txml




  declare @hdoc int
  exec sp_xml_preparedocument @hdoc output,@xml
  
  
  select meetingseq as dhbm,
         vID as yabh,
         vinfo as yamc,
         vtype as yalx,
         vleijino as ljtpyxs,
         vrole as gdsf,
         vrelation as yagx,
         stype as gflb,
         sabbr as gpjc
  from openxml(@hdoc,'/rootVote/company/voList/Vote',2)
  with 
  (
    meetingseq      varchar(10)     '../../meetingseq',                    -- 股东大会编码
    vID             varchar(10)     '@vID',                                -- 议案编号
    vinfo           varchar(100)    '@vinfo',                              -- 议案名称
    vtype           varchar(4)      '@vtype',                              -- 议案类型
    vleijino        int             '@vleijino',                           -- 累计投票应选数
    vrole           varchar(50)     './vroleList/vrole',                   -- 股东身份
    vrelation       varchar(100)    '@vrelation',                          -- 议案关系
    stype           varchar(20)     '../../VotecodeList/Votecode/@stype',  -- 股份类别
    sabbr           varchar(10)     '../../VotecodeList/Votecode/@sabbr'    -- 股票简称

  )

exec sp_xml_removedocument @hdoc

vtls0609.xml内容

<?xml version="1.0" enCoding="UTF-8"?>
<rootVote streamID="R0109">
  <company>
    <companycode>600722</companycode>
    <companyinfo>*ST金化</companyinfo>
    <meetingseq>201530107</meetingseq>
    <VotecodeList>
      <Votecode lastTradedate="" regdate="20150603" stype="A股" sabbr="*ST金化">600722</Votecode>
    </VotecodeList>
    <meetingdatebegin>20150608</meetingdatebegin>
    <meetingdateend>20150608</meetingdateend>
    <meetingdesc>河北金牛化工股份有限公司2014年年度股东大会</meetingdesc>
    <meetingtype>年度</meetingtype>
    <voList>
      <Vote vID="1" vinfo="关于公司2014年度董事会工作报告的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="2" vinfo="关于公司2014年度监事会工作报告的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="3" vinfo="关于公司2014年年度报告全文及摘要的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="4" vinfo="关于公司2014年度财务决算报告的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="5" vinfo="关于公司2014年度利润分配预案的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="6" vinfo="关于公司2015年日常关联交易的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="7" vinfo="关于公司续聘审计机构的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="8" vinfo="关于公司2014年度募集资金存放与实际使用情况专项报告的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="9" vinfo="关于设立全资子公司的议案;" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
      <Vote vID="10" vinfo="关于终止募集资金投资项目并将剩余募集资金永久补充流动资金的议案" vtype="P" vrelation="" vleijino="">
        <vroleList>
          <vrole refcode="600722">A股股东</vrole>
        </vroleList>
      </Vote>
    </voList>
  </company>

</rootVote>

总结

以上是内存溢出为你收集整理的sqlserver导入xml文件解析全部内容,希望文章能够帮你解决sqlserver导入xml文件并解析所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/1166070.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-01
下一篇2022-06-01

发表评论

登录后才能评论

评论列表(0条)

    保存