Avatar of Gianni
Gianni
Flag 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
Sybase Database

Avatar of undefined
Last Comment
Joe Woodhouse

8/22/2022 - Mon
Joe Woodhouse

Show us the SQL please?
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
Joe Woodhouse

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

?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
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
Joe Woodhouse

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Gianni

ASKER
Oops, date and time incorrect on the server!
Thanks.
Joe Woodhouse

:) Always pays to check the obvious things first.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.