CONSTRUCT - on datetime vars
Posted in 1993
How does one take a nice simple date from a form in a construct and query
against a datetime field?
I've tried using a date in the form - but get a conversion error when it
hits SQL. (using datetime now). This keeps 'erroring' me unless the
format is "YYYY-MM-DD HH:MM:SS". Not very nice.
I can easily ask the user to type in ">1993-08-24 12:00:00" - right. This
works, but I want the user to just ask for a date or range or GT/LT.
I've tried (in SQL) doing:
select * from table where datetime_fld > "1993-05-05"
but it doesn't like that - or any form of it.
I've tried (again in SQL):
select * from table where datetime_fld > extend("1993-05-05", year to second)
but it doesn't appear to like having extend() in the condition - not too
surprising.
The only way I can make the SQL statement work is to fully specify the
datetime value in the condition:
select * from table where datetime_fld > "1993-05-05 00:00:00"
That is not very nice.
Of course - getting the SQL to work properly is a moot point because the
form only allows the proper format.
Suggestions?
(P.S. 4.10 frontend (4gl, sql), 5.0 backend (online))
cheers
j.
_____________________________________________________________________________
Jack Parker - Contractor |"Is it weakness of intellect birdie"
Hewlett Packard, BSMC Boise, Idaho, USA|I cried, "or a tough little worm in
jparker@hpbs2561.boi.hp.com |your little inside", with a shake of
(208) 396-5388 (W) (208) 384-1623 (H) |his head he sadly replied:
| "Oh willow, Oh willow, tit willow".
_____________________________________________________________________________
Any opinions expressed herein are my own and not those of my employers.
_____________________________________________________________________________