Gianni
asked on
SQL query current date retreiving wrong data
Hi,
I want to execute a query on a Sybase ASA database to evaluate the status of a contract.
I'm using current date, but this function is retreiving 2003-02-09 even if today is 24/05/2012.
The date and time of the server is correct, but I retreive this strange currenbt date.
G
I want to execute a query on a Sybase ASA database to evaluate the status of a contract.
I'm using current date, but this function is retreiving 2003-02-09 even if today is 24/05/2012.
The date and time of the server is correct, but I retreive this strange currenbt date.
G
Show us the SQL please?
ASKER
1st query to check CURRENT DATE, it returns 2003-02-19 instead of 2012-05-25
SELECT vencontline.eq_id, vencontline.vencont_id, vn.company, vencontline.date_start, vencontline.date_exp,CURRE NT DATE from afm.vencontline join afm.vencont on vencontline.vencont_id=ven cont.venco nt_id join afm.vn on vencont.vn_id=vn.vn_id vencontline.eq_id='0065004 7918'
2nd query that shows that CURRENT DATE returns a value < 2012-01-01
SELECT vencontline.eq_id, vencontline.vencont_id, vn.company, vencontline.date_start, vencontline.date_exp,CURRE NT DATE from afm.vencontline join afm.vencont on vencontline.vencont_id=ven cont.venco nt_id join afm.vn on vencont.vn_id=vn.vn_id where CURRENT DATE < vencontline.date_start and vencontline.eq_id='0065004 7918'
Regards, Gianni
Query-1-result.JPG
Query-2-result.JPG
SELECT vencontline.eq_id, vencontline.vencont_id, vn.company, vencontline.date_start, vencontline.date_exp,CURRE
2nd query that shows that CURRENT DATE returns a value < 2012-01-01
SELECT vencontline.eq_id, vencontline.vencont_id, vn.company, vencontline.date_start, vencontline.date_exp,CURRE
Regards, Gianni
Query-1-result.JPG
Query-2-result.JPG
Check the date on the box is correct?
Try rewriting 2nd query to replace
CURRENT DATE < vencontline.date_start
with
vencontline.date_start > CURRENT DATE
?
Try rewriting 2nd query to replace
CURRENT DATE < vencontline.date_start
with
vencontline.date_start > CURRENT DATE
?
ASKER
Hi,
what did you mean with "check the date on the box?"
If I change the query as suggested, the problem is still there, Current Date returns 2003-02-19 instead of the today date 2012-05-25.
what did you mean with "check the date on the box?"
If I change the query as suggested, the problem is still there, Current Date returns 2003-02-19 instead of the today date 2012-05-25.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oops, date and time incorrect on the server!
Thanks.
Thanks.
:) Always pays to check the obvious things first.