Describe the bug
This query worked previous versions of SQL4CDS
To Reproduce
Query to reproduce the behavior:
select
activitytypecode, activitytypecodename,
year(createdon) as year,
count(activityid) as count
from activitypointer
group by activitytypecode,activitytypecodename, year(createdon)
order by 3,4
Expected behavior
Prior version: was 2023 version prior to upgrade . using XRM toolbox

Screenshots
If applicable, add screenshots to help explain your problem.
Current version with error:: 9.6.0 XRMToolbox
Msg 10337, Level 16, State 1, Line 1
Unable to cast object of type 'System.Data.SqlTypes.SqlString' to type 'System.String'.
See the Execution Plan tab for details of where this error occurred


Environment (please complete the following information):
- SQL 4 CDS edition: [e.g. XrmToolBox, SSMS, Azure Data Studio, ADO.NET provider]
- Results of
SELECT @@VERSION:
Microsoft Dataverse - 9.2.25032.228
SQL 4 CDS - 9.6.0.0
Apr 15 2025 07:17:06
Copyright © 2020 - 2024 Mark Carrington
Additional context
Add any other context about the problem here.
Describe the bug
This query worked previous versions of SQL4CDS
To Reproduce
Query to reproduce the behavior:
Expected behavior

Prior version: was 2023 version prior to upgrade . using XRM toolbox
Screenshots
If applicable, add screenshots to help explain your problem.
Current version with error:: 9.6.0 XRMToolbox
Msg 10337, Level 16, State 1, Line 1
Unable to cast object of type 'System.Data.SqlTypes.SqlString' to type 'System.String'.
See the Execution Plan tab for details of where this error occurred
Environment (please complete the following information):
SELECT @@VERSION:Microsoft Dataverse - 9.2.25032.228
SQL 4 CDS - 9.6.0.0
Apr 15 2025 07:17:06
Copyright © 2020 - 2024 Mark Carrington
Additional context
Add any other context about the problem here.