Setting Parameter Type/Cause of Error 335
Hello,
often i got Errors on Parameter Types. How can i set the Type of an Parameter?
I am Using the lastest Versions of FlySpeedSQL (with MS-SQL Server V2017 and V2019)
See Sample (Paramters = :DateFrom and :DateTo)
Example:
Error executing query:
[FireDAC][Phys][MSSQL]-335. Parameter [DATEFROM] data type is unknown. Hint: specify TFDParam.DataType or assign TFDParam value before Prepare/Execute call
SQL:
SELECT DISTINCT
Results.TestID As TestID
,CAST (Results.MeasuredDateTime as Date) AS MeasuredDate
,mainTests.Shortname
,Results.AnalyserID as AnalyserID
,mainAnalysers.Shortname
,PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY Results.ValueNum) OVER (PARTITION BY CAST (Results.MeasuredDateTime as Date),Results.AnalyserID,Results.TestID ) as MeanCONT_50
,PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY Results.ValueNum) OVER (PARTITION BY CAST (Results.MeasuredDateTime as Date), Results.AnalyserID,Results.TestID ) as MeanDISC_50
,PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY Results.ValueNum) OVER (PARTITION BY CAST (Results.MeasuredDateTime as Date),Results.AnalyserID,Results.TestID ) as MeanCONT_75
,PERCENTILE_DISC (0.75) WITHIN GROUP (ORDER BY Results.ValueNum) OVER (PARTITION BY CAST (Results.MeasuredDateTime as Date), Results.AnalyserID,Results.TestID ) as MeanDISC_75
,AVG (Results.ValueNum) OVER (PARTITION BY CAST (Results.MeasuredDateTime as Date),Results.AnalyserID,Results.TestID ) as AvgOfValues
,STDEV (Results.ValueNum) OVER (PARTITION BY CAST (Results.MeasuredDateTime as Date),Results.AnalyserID,Results.TestID ) as StDevOfValues
,VAR (Results.ValueNum) OVER (PARTITION BY CAST (Results.MeasuredDateTime as Date),Results.AnalyserID,Results.TestID ) as VarianceOfValues
,(COUNT (Results.ValueNum) OVER (PARTITION BY CAST (Results.MeasuredDateTime as Date),Results.AnalyserID,Results.TestID )) as CountOfValues
FROM Results
INNER JOIN mainTests ON Results.TestID = mainTests.TestID
Inner Join mainAnalysers on Results.AnalyserID = mainAnalysers.AnalyserID
WHERE
CAST (Results.MeasuredDateTime as Date) >= :DateFrom
AND
CAST (Results.MeasuredDateTime as Date) <= :DateTo
AND Results.TestID in (782)
AND Results.Resulttype <> 'Q' /* keine QK */
AND Results.ValueType = 1
AND Results.AnalyserID in (51,200,205,210)
ORDER BY CAST (Results.MeasuredDateTime as Date), AnalyserID, TestID
Regards
Andreas
Hello Andrey,
i do not unterstand.
Can you please support me by an Sample with Date?
Thanks
Andreas