无法在连接到 Dataverse table 的 SQL 查询中使用 CTE(在 SSMS 中)
Cannot use CTE in SQL query connected to an Dataverse table (in SSMS)
我已经连接到 SSMS 中的 Dataverse 环境。
我可以运行这个简单的查询:
SELECT cr6e4_customeruseradfunction, cr6e4_customeruser, count(cr6e4_assettag) as AssetCount
FROM [dbo].[cr6e4_itassets]
WHERE cr6e4_customeruseradfunction Is Not Null
GROUP BY cr6e4_customeruseradfunction, cr6e4_customeruser
) srcass
但是如果我将子查询移动到 CTE,它会失败:
WITH srcass as
(
SELECT cr6e4_customeruseradfunction, cr6e4_customeruser, count(cr6e4_assettag) as AssetCount
FROM [dbo].[cr6e4_itassets]
WHERE cr6e4_customeruseradfunction Is Not Null
GROUP BY cr6e4_customeruseradfunction, cr6e4_customeruser
)
SELECT * FROM srcass
出现此错误消息:
Msg 40000, Level 16, State 1, Line 13
'WITH' statement is not supported. Line:2, Position:1
RequestId: TDS;475faaf3-0fe3-4366-9c6d-f21db0350fbf;9
Time: 2022-02-01T13:03:02.5657490Z
有谁知道这是 Dataverse 中的设置,还是只是一个限制?
根据此处的 Microsoft 文档:https://docs.microsoft.com/en-us/power-apps/developer/data-platform/how-dataverse-sql-differs-from-transact-sql?tabs=not-supported#:~:text=WITH%20common_table_expression,针对 Dataverse TDS 端点的 SQL 查询不支持 WITH 常见 table 表达式。
我已经连接到 SSMS 中的 Dataverse 环境。
我可以运行这个简单的查询:
SELECT cr6e4_customeruseradfunction, cr6e4_customeruser, count(cr6e4_assettag) as AssetCount
FROM [dbo].[cr6e4_itassets]
WHERE cr6e4_customeruseradfunction Is Not Null
GROUP BY cr6e4_customeruseradfunction, cr6e4_customeruser
) srcass
但是如果我将子查询移动到 CTE,它会失败:
WITH srcass as
(
SELECT cr6e4_customeruseradfunction, cr6e4_customeruser, count(cr6e4_assettag) as AssetCount
FROM [dbo].[cr6e4_itassets]
WHERE cr6e4_customeruseradfunction Is Not Null
GROUP BY cr6e4_customeruseradfunction, cr6e4_customeruser
)
SELECT * FROM srcass
出现此错误消息:
Msg 40000, Level 16, State 1, Line 13
'WITH' statement is not supported. Line:2, Position:1
RequestId: TDS;475faaf3-0fe3-4366-9c6d-f21db0350fbf;9
Time: 2022-02-01T13:03:02.5657490Z
有谁知道这是 Dataverse 中的设置,还是只是一个限制?
根据此处的 Microsoft 文档:https://docs.microsoft.com/en-us/power-apps/developer/data-platform/how-dataverse-sql-differs-from-transact-sql?tabs=not-supported#:~:text=WITH%20common_table_expression,针对 Dataverse TDS 端点的 SQL 查询不支持 WITH 常见 table 表达式。