the error message seems to be in line with what is explain in the documentation:

> Automatic data type conversion is implemented between numeric types.
> A string that represents a number is not converted to a corresponding number. 
> There are special CAST functions that will convert values from one type to 
> another.

http://doc.4d.com/4Dv16R6/4D/16-R6/4D-SQL-engine-implementation.300-3628406.en.html

in other words, you can't expect 4D to implicitly convert numeric 2 to 
TIMESTAMP.

besides, with an expression such as
Select someDate - 2
it is unclear whether you want to subtract 2 years, months, days, hours, 
minutes, second or milliseconds.

in addition to that, there is no way to express 2 days as TIMESTAMP.
this is mentioned in the same URL, that 4D SQL does not support date constants 
where the month or day is 0.
in other words, you can't use { d '0000-00-02' } to specify 2 days.
and in case you are wondering, you can't use {t '48:00:00'} either,
because a time constant that exceeds 24 hours throws a parser error.

even if you find a way to specify 2 days in a way that the parser can 
understand,
there is the fundamental problem that arithmetic expressions between VK_TIME 
(TIMESTAMP) values are type unsafe in 4D SQL.

so I think the best option is to use {FN () } with an "Add to date" wrapper

http://doc.4d.com/4Dv16R6/4D/16-R6/4d-function-call.300-3628422.en.html



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to