简体   繁体   中英

"Unhandled expression type" in SQL subquery

I am using XrmToolBox with SQL 4 CDS to make some edits to a user in MS Dynamics. I don't quite know where the error lies-- in the SQL expression? In the FetchXML that it gets converted to? 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:

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. I can take its results and make it a static (non-subquery) expression with no problem. 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.

The SQL 4 CDS tool attempts to provide as much a SQL implementation for CDS/Dataverse as possible but it's not perfect. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM