Link to home
Start Free TrialLog in
Avatar of Gianni
GianniFlag for Italy

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
Avatar of Joe Woodhouse
Joe Woodhouse

Show us the SQL please?
Avatar of Gianni

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,CURRENT DATE from afm.vencontline join afm.vencont on vencontline.vencont_id=vencont.vencont_id join afm.vn on vencont.vn_id=vn.vn_id  vencontline.eq_id='00650047918'

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,CURRENT DATE from afm.vencontline join afm.vencont on vencontline.vencont_id=vencont.vencont_id join afm.vn on vencont.vn_id=vn.vn_id where CURRENT DATE < vencontline.date_start and vencontline.eq_id='00650047918'


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

?
Avatar of Gianni

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.
ASKER CERTIFIED SOLUTION
Avatar of Joe Woodhouse
Joe Woodhouse

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gianni

ASKER

Oops, date and time incorrect on the server!
Thanks.
:) Always pays to check the obvious things first.