I have the following situation, I need to check if the time of a certain task is not already filled in the system and for this by performing a SQL command in SQL Server 2014 works, as in the example
Select (cast((convert(datetime,hora,108)) +'00:01:00.000' as time(7))) as tempo from MIGRACOES_INTE_HORA
NOTE: I convert to transform time from Varchar
to time ...
However in the system I use the filter property of a TFDQuery
to perform the query, but to optimize it.
no filter add
(CAST((convert(datetime,'+TimeToStr(dtpInteHora.Time)+',108)) + '00:01:00.000', as time(7)) = '+DateToStr(qryInteHora.FieldByName('Hora').AsDateTime)+') or
(CAST((convert(datetime,'+TimeToStr(dtpInteHora.Time)+',108)) - '00:01:00.000', as time(7)) = '+DateToStr(qryInteHora.FieldByName('Hora').AsDateTime)+')
But when you activate the filter comes the following error
[FireDAC][Stan][Eval]-100. Column or function [CAST] is not found. Hint: if the name is a function name, then add FireDAC.Stan.ExprFuncs to uses clause.
Would anyone know how to do this filter?