为什么SQL Azure不支持SQL OpenXML?

时间:2011-12-11 08:24:03

标签: sql azure-sql-database

为什么SQL Azure不支持SQL OpenXML?我们可以在SQL Azure中使用哪些替代方案?最后,在即将推出的SQL版本中是否会弃用SQL OpenXML?

2 个答案:

答案 0 :(得分:4)

答案 1 :(得分:2)

这一定在某些时候发生了变化。它出现在9.25.2017,openxml在SQL Azure中运行良好。我刚刚在SQL Azure DB上从https://docs.microsoft.com/en-us/sql/relational-databases/xml/examples-using-openxml运行了以下示例,它生成了显示的结果:

DECLARE @DocHandle int  
DECLARE @XmlDocument nvarchar(1000)  
SET @XmlDocument = N'<ROOT>  
<Customer CustomerID="VINET" ContactName="Paul Henriot">  
   <Order OrderID="10248" CustomerID="VINET" EmployeeID="5"   
          OrderDate="1996-07-04T00:00:00">  
      <OrderDetail ProductID="11" Quantity="12"/>  
      <OrderDetail ProductID="42" Quantity="10"/>  
   </Order>  
</Customer>  
<Customer CustomerID="LILAS" ContactName="Carlos Gonzlez">  
   <Order OrderID="10283" CustomerID="LILAS" EmployeeID="3"   
          OrderDate="1996-08-16T00:00:00">  
      <OrderDetail ProductID="72" Quantity="3"/>  
   </Order>  
</Customer>  
</ROOT>'  
-- Create an internal representation of the XML document.  
EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument  
-- Execute a SELECT statement using OPENXML rowset provider.  
SELECT *  
FROM OPENXML (@DocHandle, '/ROOT/Customer',1)  
      WITH (CustomerID  varchar(10),  
            ContactName varchar(20))  
EXEC sp_xml_removedocument @DocHandle  

输出:

CustomerID  ContactName
VINET   Paul Henriot
LILAS   Carlos Gonzlez

我没有看到此处列出的OPENXML:https://docs.microsoft.com/en-us/azure/sql-database/sql-database-transact-sql-information#transact-sql-syntax-not-supported-in-sql-database