在Azure SQL数据仓库中聚合字符串 [英] Aggregate strings in Azure SQL Data Warehouse
问题描述
是否有一种类似于SQL Server中string_agg
函数的方法在Azure SQL数据仓库中聚合字符串?
Is there a way to aggregate strings in Azure SQL Data Warehouse similar to the string_agg
function in SQL Server?
我有一些记录,这些记录包含要合并为单个字符串的字符串.
I have records with strings that I want to concatenate into a single string.
SELECT string_agg(string_col, ',') FROM table1
https://docs .microsoft.com/en-us/sql/t-sql/functions/string-agg-transact-sql
推荐答案
Update Jan 2019: As at Jan 2019 STRING_SPLIT
is available in SQL Data Warehouse as per here.
Update Jul 2019: As at Jul 2019 STRING_AGG
is available in SQL Data Warehouse as per here.
Azure SQL数据仓库是一个MPP系统,旨在保存数十亿条记录和TB级数据,因此,作为第一个调用端口,您应该强烈考虑它是否适合进行字符串处理.根据您正在运行的DWU,它也很昂贵.通读这篇反模式文章.
Azure SQL Data Warehouse is an MPP system designed to hold billions of records and terabytes of data, so as a first port of call you should strongly consider if it's the right place to do string manipulation. It's also kind of expensive depending on what DWU you are running at. Have a read through this anti-patterns article.
Azure SQL数据仓库工作负载模式和反模式 https://blogs.msdn.microsoft.com/sqlcat/2017/09/05/azure-sql-data-warehouse-workload-patterns-and-anti-patterns/
如果您确实需要在仓库中执行此操作,那么我确实使用程序方法针对Azure SQL数据仓库做了一个最近的示例:
If you really need to do this in your warehouse then I did do a recent example specifically for Azure SQL Data Warehouse using a procedural approach:
是否执行Azure SQL数据仓库有一种拆分字符串的方法吗?
这篇关于在Azure SQL数据仓库中聚合字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!