【问题标题】:"Load xml" is filling null values in mysql“加载 xml”正在填充 mysql 中的空值
【发布时间】:2013-08-14 01:29:16
【问题描述】:

我正在运行 load xml 命令来将 xml 文件中的值填充到 mysql 表中,但它总是填充空值。

我正在运行以下命令:

mysql> 将 xml 本地 infile 'E:\Badges.xml' 加载到由 '<row>' 标识的表元行中

以下是我的文件内容:

<badges>
  <row Id="1" UserId="2" Name="Autobiographer" Date="2010-08-25T19:26:49.550" />
  <row Id="2" UserId="3" Name="Autobiographer" Date="2010-08-25T19:26:49.580" />
  <row Id="3" UserId="6" Name="Autobiographer" Date="2010-08-25T19:46:49.197" />
  <row Id="4" UserId="15" Name="Autobiographer" Date="2010-08-25T19:46:49.197" />
  <row Id="5" UserId="18" Name="Autobiographer" Date="2010-08-25T19:46:49.197" />
  <row Id="6" UserId="21" Name="Autobiographer" Date="2010-08-25T19:46:49.197" />
  <row Id="7" UserId="27" Name="Autobiographer" Date="2010-08-25T19:46:49.213" />
  <row Id="8" UserId="7" Name="Autobiographer" Date="2010-08-25T19:51:49.327" />
 </badges> 

如果有人知道解决方案,请告诉我?

谢谢!提前 桑吉塔

【问题讨论】:

    标签: mysql xml


    【解决方案1】:

    以下文件 badges.xml 适合我(注意区分大小写):

    <badges>
      <row id="1" userid="2" name="Autobiographer" date="2010-08-25T19:26:49.550" />
      <row id="2" userid="3" name="Autobiographer" date="2010-08-25T19:26:49.580" />
      <row id="3" userid="6" name="Autobiographer" date="2010-08-25T19:46:49.197" />
      <row id="4" userid="15" name="Autobiographer" date="2010-08-25T19:46:49.197" />
      <row id="5" userid="18" name="Autobiographer" date="2010-08-25T19:46:49.197" />
      <row id="6" userid="21" name="Autobiographer" date="2010-08-25T19:46:49.197" />
      <row id="7" userid="27" name="Autobiographer" date="2010-08-25T19:46:49.213" />
      <row id="8" userid="7" name="Autobiographer" date="2010-08-25T19:51:49.327" />
    </badges>
    
    LOAD XML INFILE '/path/badges.xml' INTO TABLE meta ROWS IDENTIFIED BY '<row>';
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-18
      • 2022-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-07
      • 1970-01-01
      相关资源
      最近更新 更多