DB2 导入(原始)XML 数据
DB2 Import (Raw) XML Data
有没有办法将原始 xml 数据导入(或加载)到具有 xml.
类型列的 table 中
<customerinfo Cid="1000"><name>Kathy Smith</name><addr country="Canada"><street>5 Rosewood</street><city>Toronto</city><prov-state>Ontario</prov-state><pcode-zip>M6W 1E6</pcode-zip></addr><phone type="work">416-555-1358</phone></customerinfo>
<customerinfo Cid="1001"><name>Kathy Smith</name><addr country="Canada"><street>25 EastCreek</street><city>Markham</city><prov-state>Ontario</prov-state><pcode-zip>N9C 3T6</pcode-zip></addr><phone type="work">905-555-7258</phone></customerinfo>
...
xml 文档的每一行应排成一行。
import from C:\temp\test.xml OF DEL INSERT INTO XMLCOLUMN
DB2 正确读取 XML 文件但未能将其导入行...
Number of rows read = 6
Number of rows skipped = 0
Number of rows inserted = 0
Number of rows updated = 0
Number of rows rejected = 6
Number of rows = 6
有什么想法吗?
您需要一个 DEL 文件,其中包含对在哪里可以找到 XML 文件的描述。尝试类似的东西:
test.del:
<XDS FIL='test.xml' />
如果您有其他列,上述 XDS 将是其他值旁边的常规列值。
test.xml:您的 XML 文件
然后
import from test.del OF DEL INSERT INTO MyTable
"MyTable" 是您的 table 和 XML 列。有关更多示例,请参阅 DB2 docs。
有没有办法将原始 xml 数据导入(或加载)到具有 xml.
类型列的 table 中<customerinfo Cid="1000"><name>Kathy Smith</name><addr country="Canada"><street>5 Rosewood</street><city>Toronto</city><prov-state>Ontario</prov-state><pcode-zip>M6W 1E6</pcode-zip></addr><phone type="work">416-555-1358</phone></customerinfo>
<customerinfo Cid="1001"><name>Kathy Smith</name><addr country="Canada"><street>25 EastCreek</street><city>Markham</city><prov-state>Ontario</prov-state><pcode-zip>N9C 3T6</pcode-zip></addr><phone type="work">905-555-7258</phone></customerinfo>
...
xml 文档的每一行应排成一行。
import from C:\temp\test.xml OF DEL INSERT INTO XMLCOLUMN
DB2 正确读取 XML 文件但未能将其导入行...
Number of rows read = 6
Number of rows skipped = 0
Number of rows inserted = 0
Number of rows updated = 0
Number of rows rejected = 6
Number of rows = 6
有什么想法吗?
您需要一个 DEL 文件,其中包含对在哪里可以找到 XML 文件的描述。尝试类似的东西:
test.del:
<XDS FIL='test.xml' />
如果您有其他列,上述 XDS 将是其他值旁边的常规列值。
test.xml:您的 XML 文件
然后
import from test.del OF DEL INSERT INTO MyTable
"MyTable" 是您的 table 和 XML 列。有关更多示例,请参阅 DB2 docs。