0

我有类似于以下格式的 xml 数据:

<Orders>
  <Order>
    <OrderID>1</OrderID>
    <OrderInfo>mydetails</OrderInfo>
      <orderlines>
        <orderline>
          <orderlineref>1.1</orderlineref>
          <product>myproduct</product>
          <quantity>5</quantity>
        </orderline>
        <orderline>
          <orderlineref>1.2</orderlineref>
          <product>myproduct1</product>
          <quantity>7</quantity>
        </orderline>
      </orderlines>
  </Order>
</Orders>

我想使用 bcp (或任何其他方法)将它导入 SQL Server 2005,只要它运行得相当快。

如何为这种类型的 XML 创建格式文件?还是我看错了方向。

到目前为止,我设法导入这些数据的唯一方法是使用 openrowset,但它需要的时间太长。

请问有什么建议吗?

4

1 回答 1

0

为什么不将其转换为 xml,例如:

declare @x xml

set @x='<Orders>
  ...
</Orders>'

或者

declare @x nvarchar(max)

set @x='<Orders>
  ...
</Orders>'

接着 :

cast (@x as xml)...
于 2012-05-05T07:06:13.393 回答