Reputation: 5159
I tried to verify whether my code using FOR XML
clause will run on Azure SQL Database. So I looked to Microsoft online documents (FOR XML (SQL Server))
where I found that it is not supported
While I was looking for a solution I found: Is 'FOR XML' (RAW, AUTO, PATH) supported in SQL Azure which states that it is supported. So I made an experiment
print @@VERSION
select (select 'aa' FOR XML PATH('tag'),TYPE)
with result
Microsoft SQL Azure (RTM) - 12.0.2000.8
Mar 19 2019 04:06:22
Copyright (C) 2019 Microsoft Corporation
----------------------------------------------
<tag>aa</tag>
(1 row affected)
So the question is: Is there an error in documents or do I read it wrong way or is it supported now and will not be in future?
Edit (September 2022)
The page FOR XML (SQL Server) now states that 'FOR XML' is supported in SQL Azure and so the question is no longer relevant.
Upvotes: 0
Views: 1411
Reputation: 16431
I opened the document FOR XML (SQL Server), it shows that it's supported in Azure SQL Database.
Azure SQL Database supports FOR JSON and FOR XML. You can get this from many other blogs.
David Browne has created a Pull Request to update the docs page.
Hope this helps.
Upvotes: 1
Reputation: 239734
I'd always trust the language reference over the fluffier "how to do things" documentation. The latter seem to fall out of date more regularly and not be revisited in a timely fashion.
On the FOR Clause
page (linked above) it says it is supported in Azure SQL Database.
APPLIES TO: ✓ SQL Server (starting with 2008) ✓ Azure SQL Database ✗ Azure SQL Data Warehouse ✗ Parallel Data Warehouse
There are no mentions within the page of any Azure specific limitations either.
Upvotes: 2