Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    2

    Unanswered: Using CURRENT_DATE() is NOT working :(

    Let me give you a little background on my project:

    I'm connecting to a Sybase (version unknown) DB via ODBC in a Windows environment. I am writing PHP scripts to pull back certain information from the DB. Everything has been working GREAT.... until now.

    There is a field called Start_Date_and_Time that is a Date/Time type. Let's say I run a simple query...something like:

    Code:
    SELECT Start_Date_and_Time FROM Change_Management;
    I get TONS of results in the format of YYYY-MM-DD HH:MM:SS.SSS (for example 2001-12-05 20:00:00.000)


    Everything is good so far. But, if I change the query to show only results from TODAY by using:

    Code:
    SELECT Start_Date_and_Time FROM Change_Management WHERE (Start_Date_and_Time = current_date());
    I get an error:

    Warning: odbc_exec() [function.odbc-exec]: SQL error: Driver]Expected lexical element not found: ), SQL state 370 in SQLExecDirect
    It's basically telling me that it needs a ) but it's there! Furthermore, if I try to just pull back one of the results that I already know exists:

    Code:
    SELECT Start_Date_and_Time FROM Change_Management WHERE (Start_Date_and_Time='2001-12-05 20:00:00.000');
    I GET NO RESULTS! How can this be? I just saw that as a result when running SELECT Start_Date_and_Time FROM Change_Management.

    Someone please help... I'm pulling my hair out. :( Thanks for you time.

  2. #2
    Join Date
    Jun 2007
    Posts
    2
    Upon closer inspection, I am unable to filter results by ANY data type other than Text. For example, I cannot do ANY WHERE statements if they're number or date/time values. Does anyone know a way around this??

  3. #3
    Join Date
    Jun 2007
    Posts
    7

    try to use now(*)

    I had this problem a couple of days ago...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •