1

我正在运行 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> 

请让我知道是否有人知道解决方案?

谢谢!提前桑吉塔

4

1 回答 1

0

以下文件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>';
于 2013-08-12T17:05:16.273 回答