简体   繁体   English

Azure 数据仓库中的“游标”和“FOR XML”子句

[英]"Cursor" and "FOR XML" clause in Azure data warehouse

While creating stored procedures in Azure data warehouse, I have got some error on "Cursor" and "FOR XML".在 Azure 数据仓库中创建存储过程时,“光标”和“FOR XML”出现错误。 So wanted to know if they are supported by Azure data warehouse or not.所以想知道Azure数据仓库是否支持它们。 If not then what are the alternatives.如果没有,那么有什么替代方案。

sample code with error msg pictures are attached herein.此处附有带有错误消息图片的示例代码。

在此处输入图像描述

在此处输入图像描述

Neither FOR XML or cursors are supported in Azure Synapse dedicated SQL pools (formerly known as Azure SQL Data Warehouse) as per the documentation . Neither FOR XML or cursors are supported in Azure Synapse dedicated SQL pools (formerly known as Azure SQL Data Warehouse) as per the documentation . For cursors, either convert them to use a WHILE loop which is supported or refactor the code to use a set-based approach.对于游标,要么将它们转换为使用受支持的WHILE循环,要么重构代码以使用基于集合的方法。 Another alternative is to use something external, like Azure Data Factory or Synapse Pipelines and use a For Each loop.另一种选择是使用外部的东西,比如 Azure 数据工厂或 Synapse 管道,并使用 For Each 循环。 Another alternative is to use a nearby Azure SQL DB to do some pre-processing.另一种选择是使用附近的 Azure SQL DB 进行一些预处理。 You should be aware the the MPP architecture of Azure Synapse Analytics does not lend itself well to this kind of row-based processing and you should remember it's a big data platform meant for large volumes of data, millions, billions of rows and set-based approaches should be preferred.您应该知道 Azure Synapse Analytics 的 MPP 架构不适合这种基于行的处理,您应该记住它是一个大数据平台,适用于大量数据、数百万、数十亿行和基于集合的数据方法应该是首选。

If you are just using FOR XML to do that sleazy string concatenation trick then you should use STRING_AGG instead which is fully supported in Synapse.如果您只是使用FOR XML来执行那种低俗的字符串连接技巧,那么您应该使用STRING_AGG来代替,它在 Synapse 中完全受支持。 See this answer for a recent example.有关最近的示例,请参见此答案 If you are actually producing XML then you will need to find an alternative method, eg a nearby Azure SQL DB.如果您实际生产的是 XML,那么您将需要找到一种替代方法,例如附近的 Azure SQL DB。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Synapse Link 是将数据加载到数据仓库中的好方法吗? - Is Azure Synapse Link a good way of loading the data in a Data Warehouse? DROP TABLE IF EXISTS 不适用于 Azure SQL 数据仓库 - DROP TABLE IF EXISTS not working on Azure SQL Data Warehouse Azure SQL 数据仓库(突触分析)Polybase 性能与 ORC 表 - Azure SQL Data Warehouse (Synapse Analytics) Polybase performances with ORC table 如何在 Azure 数据仓库(突触)中授予架构级别权限? - How to give Schema Level permission in Azure Data Warehouse (Synapse)? Azure SQL 数据仓库(Synapse Analytics)可以安装在本地吗? - Can Azure SQL data warehouse (Synapse Analytics) be installed in on-premise? 如何使用 parquet 文件增量创建 azure 数据仓库 - how to create a azure data warehouse using parquet files incrementally 从本地 MySQL 提取和转换数据到 Azure Synapse 数据仓库 - Extracting and Transforming Data from local MySQL to Azure Synapse Data Warehouse 在 Azure SQL 数据仓库(突触)中指定 datetime2 格式 - Specify datetime2 format in Azure SQL data warehouse (synapse) 在 Azure 数据仓库 SQL 错误中创建物化视图 - Creating Materialized View in Azure Data Warehouse SQL error 是否可以在日志分析中查询 Azure 数据仓库 - Is it possible to query Azure data warehouse within log analytics
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM