简体   繁体   English

SQL 子查询中的“未处理的表达式类型”

[英]"Unhandled expression type" in SQL subquery

I am using XrmToolBox with SQL 4 CDS to make some edits to a user in MS Dynamics.我正在使用带有 SQL 4 CDS 的 XrmToolBox 对 MS Dynamics 中的用户进行一些编辑。 I don't quite know where the error lies-- in the SQL expression?我不太清楚错误出在哪里——在 SQL 表达式中? In the FetchXML that it gets converted to?在它转换成的 FetchXML 中? Anyway, here's my expression:无论如何,这是我的表达方式:

INSERT INTO systemuser (
  firstname,
  lastname,
  internalemailaddress,
  departmentid,
  internalspecialtyid)
VALUES (
  'John',
  'Smith',
  'john.smith@example.com',
  (SELECT TOP 1 departmentid FROM department WHERE name = 'Commercial'),
  (SELECT TOP 1 internalspecialtyid FROM internal_specialties WHERE name = 'B2B Comms'));

When I run this, I get this message from XrmToolBox:当我运行它时,我从 XrmToolBox 收到这条消息:

Unhandled expression type: (SELECT TOP 1 departmentid FROM department WHERE name = 'Commercial')

I really don't understand this.我真的不明白这一点。 I can select the subquery and execute it to get one response back.我可以 select 子查询并执行它以获得一个响应。 I can take its results and make it a static (non-subquery) expression with no problem.我可以把它的结果变成 static(非子查询)表达式,没有问题。 But why isn't this working?但为什么这不起作用? I'm pretty new to SQL, assuming that's where the problem is, so I could easily misunderstand the subquery syntax.我是 SQL 的新手,假设这就是问题所在,所以我很容易误解子查询语法。

The SQL 4 CDS tool attempts to provide as much a SQL implementation for CDS/Dataverse as possible but it's not perfect. SQL 4 CDS 工具试图为 CDS/Dataverse 提供尽可能多的 SQL 实现,但它并不完美。 Reach out to the tool author directly by opening an issue on the the SQL 4 CDS's GitHub page: https://github.com/MarkMpn/Sql4Cds/issues通过在 SQL 4 CDS 的 GitHub 页面上打开问题直接联系工具作者: https://github.com/MarkMpn/Sql4Cds/issues

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

相关问题 SQL子查询缺少表达式 - SQL missing expression on subquery SQL 子查询作为表达式 - SQL Subquery as expression SQL子查询表达式 - SQL subquery expression 在Access 2010中执行SQL子查询时,“条件表达式中的数据类型不匹配” - “Data type mismatch in criteria expression” when doing SQL subquery in Access 2010 MS Access SQL&#39;条件表达式中的数据类型不匹配&#39;,因为在子查询中滤除了空值 - MS Access SQL 'Data type mismatch in criteria expression' due to null value filtered out in subquery SQL错误-子查询后跟=,!=,&lt;,&lt;=,&gt;,&gt; =或将子查询用作表达式时,不允许这样做 - Error in SQL - This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression SQL错误:当子查询遵循=,!=,&lt;,&lt;=,&gt;,&gt; =或将子查询用作表达式时,不允许这样做 - SQL ERROR: This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression 将SQL CTE表达式转换为普通子查询 - Convert SQL CTE expression to normal subquery Oracle 中使用子查询和文字表达式的 SQL 性能 - SQl performance with subquery and literal expression in Oracle 如何避免将多个子查询作为表达式(SQL优化) - How to avoid multiple subquery as expression (SQL optimization)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM