若要避免内存不足,请运行 sp_xml_removedocument 以释放内存。
所有用到openxml函数的地方都出这个错
请问一下我如何找到出错的地方
如何找到句柄进行删除

解决方案 »

  1.   

    句柄是由sp_xml_preparedocument 过程返回的DECLARE @hdoc int
    DECLARE @doc varchar(1000)
    SET @doc ='
    <ROOT>
    <Product ProductID="0001" ContactName="Con001">
       <Order ProductID="0001" EmployeeID="5" OrderDate="2006-04-01 00:00:00">
          <OrderDetail OrderID="10248" ProductID="11" Quantity="12"/>
          <OrderDetail OrderID="10248" ProductID="42" Quantity="10"/>
       </Order>
    </Product>
    <Product ProductID="0002" ContactName="Con002">
       <Order ProductID="LILAS" EmployeeID="3" OrderDate="1996-08-16T00:00:00">
          <OrderDetail OrderID="10283" ProductID="72" Quantity="3"/>
       </Order>
    </Product>
    </ROOT>'
    --Create an internal representation of the XML document.
    EXEC sp_xml_preparedocument @hdoc OUTPUT, @doc