MarkMpn / Sql4Cds

SQL 4 CDS core engine and XrmToolbox tool
MIT License
74 stars 22 forks source link

[Bug](v9.2.0) Cannot use DBNull.Value on column 'solutionidname' #524

Closed hiroyuki0415 closed 2 months ago

hiroyuki0415 commented 3 months ago
SELECT sc.solutionidname,
       sc.objectid
FROM   solutioncomponent AS sc
WHERE  sc.solutionidname IN ('msdyn_PowerAppsChecker');

When I run this SQL I get the below error:

Cannot use DBNull.Value on column 'solutionidname'.
Failed to enable constraint. A row can only contain a non-null value, a unique value, or a foreign key, but one or more rows violates this constraint.
MarkMpn commented 2 months ago

There seems to be something strange about the solutioncomponent entity which means it doesn't return the expected names for the related solutionid. I'll address this in the next update by hiding the virtual ___name attributes from this entity, so you'll need to change the query to:

SELECT s.uniquename,
       sc.objectid
FROM   solutioncomponent AS sc
       INNER JOIN solution AS s
       ON sc.solutionid = s.solutionid
WHERE  s.uniquename IN ('msdyn_PowerAppsChecker');