Closed ntting closed 6 years ago
This error seems to be wide known with js developers. Also there are lots of recommend about NOT using FLOAT data type in SQL Server. But in order to workaround the issue, try convert it to a more general data type, example:
SELECT TOP(12)
'Time' = CREATE_DATE
, 'Metric' = 'MONTH'
, 'Value' = CAST(SUM(D_DAYS) AS DECIMAL(19,9))
FROM iFactoryPlatForm.MES.PRODUCTION_LT
GROUP BY MONTH, CREATE_DATE
ORDER BY CREATE_DATE DESC, MONTH DESC
The reason COUNT does not yield error is that COUNT returns INT data type. the others like SUM, AVG, MAX, MIN will base on the data type of the value inside them. In this case, D_DAYS has FLOAT data type, so SUM, AVG, MAX, MIN of D_DAYS column will have FLOAT data type.
@bily-gates thank you very much, I will have a try
Sorry, automatically closing old issues after several fixes. Please reopen if the problem persists.
when i use the function of sum, avg, max, min, it can not work, and show the error : cannot read property 'type' of null i try count() is support, is this funtion not supported? how can we modify to support it, please help me. D_DAYS is float type eg: select top 12 'Time'=CREATE_DATE,'Metric'='MONTH','Value'=sum(D_DAYS) from [iFactoryPlatForm].[MES].[PRODUCTION_LT] group by MONTH,CREATE_DATE order by CREATE_DATE desc, MONTH asc