为什么SQL Azure中不支持SQL OpenXML?以及我们可以在SQL Azure中使用哪些替代方法?最后,SQL OpenXML在即将到来的SQL版本中会被弃用吗?为什么SQL Azure中不支持SQL OpenXML?
回答
两种选择是:
1)节点()和Value()函数
参见Restrictions of Stored Procedures in SQL AzureValue(), Nodes(), and OpenXML()和。
2)的XQuery
参见Introduction to XQuery in SQL Server 2005和SQL Server 2005 XQuery and XML-DML - Part 1。
“SQL Azure中的存储过程限制”链接令人惊叹。 –
@ fernando-correia我很感激你看看我的答案(https://stackoverflow.com/a/46413643/908677),并分享你的想法是否OPENXML现在应该在Azure中。谢谢! –
这一定是在某些时候发生了变化。它看起来是9.25.2017 openxml在SQL Azure中工作正常。我只是跑下面的例子从https://docs.microsoft.com/en-us/sql/relational-databases/xml/examples-using-openxml在SQL Azure的DB和它产生所示的结果:
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
- 1. 为什么Azure SQL DW不支持Error_Line()函数?
- 2. 为什么Microsoft不支持到SQL Azure的OLE DB连接?
- 3. SQL Azure TEXTPTR不受支持
- 4. 支持SQL Azure中的nolock
- 5. SQL Azure不支持SqlCacheDependency?有什么替代
- 6. Azure SQL是否支持Kerberos?
- 7. SQL Azure HierarchyId支持吗?
- 8. Azure SQL不支持弹性事务
- 9. Azure SQL sp_execute_remote不支持输出参数
- 10. 为什么Microsoft在Silverlight中不包含SQL Server支持?
- 11. 为什么SQL Server中不支持LIMIT子句?
- 12. 不支持转换为SQL
- 13. Azure SQL Server中的UTF8支持
- 14. 此版本的SQL Server不支持“CREATE CREDENTIAL” - Azure SQL数据库
- 15. 什么是SQL Azure?
- 16. 什么ORMs支持SQL Server 2012
- 17. 什么SQL AlwaysOn选项支持DTC
- 18. 未来SQL Azure中是否支持SQL Server Service Broker?
- 19. SQL Azure支持关系数据库吗?
- 20. SQL Azure并支持CTE语法?
- 21. SQL Azure支持'FOR XML'(RAW,AUTO,PATH)
- 22. SQL Azure是否支持CLR程序集?
- 23. 阿拉伯语支持SQL Azure
- 24. 无法从SQL Azure导出BACPAC - Microsoft Azure SQL数据库不支持ExtAuth_Key10 v12
- 25. Phonegap不支持sql Rand(),该怎么办?
- 26. 为什么Ruby中不支持工作?
- 27. 为什么.htaccess在Windows中不支持?
- 28. 为什么Azure表存储不支持DateTimeOffset?
- 29. 成员'Player.GameID'不支持转换为SQL
- 30. LINQ的不支持转换为SQL
使用而是使用SQL Server 2005+本机XML/XQuery方法 - 它们更易于使用并且工作得更好。请参阅[SQL Server中的XQuery简介](http://msdn.microsoft.com/zh-cn/library/ms345122%28v=sql.90%29.aspx)或[SQL Server 2005 XQuery和XML-DML - 部分1](http://www.15seconds.com/issue/050803.htm) –