Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    1

    Red face Unanswered: Datetime Character Comparison

    Hi,

    I am using a HP Tandem Non Stop SQL Database (... it's not my choice!!!) and whant to compare a field MUTDATZEIT of type DATETIME with an input specific value given in argument...

    select * from MYTABLE where MUTDATZEIT < '2000-01-01 00:00:00'

    of course writting this i get an error cannot compare DATETIME with CHARACTER,
    i already tried:

    < DATETIME '2000-01-01 00:00:00'
    < DATETIME '2000-01-01 00:00:00' year to day
    < TO_DATE('2000-01-01 00:00:00', 'YYYY-MM-DD HH:MMS')

    HELPPPPPPPPPP !

    I cannot find any documention on it on the web...

    i am really blocked,

    thanks for your help

  2. #2
    Join Date
    Jul 2003
    Posts
    1

    Re: Datetime Character Comparison

    Datetime format needs a colon ( : ) between the year and time. Also datetime string has to have same elements as field def.

    Examples:

    select * from MYTABLE where MUTDATZEIT < DATETIME '2000-01-01:00:00:00' YEAR TO SECOND;

    select * from MYTABLE where MUTDATZEIT < DATETIME '2000-01-01' YEAR TO DAY;

    You can type "help;" in SQLCI and get a fair amount of information on the command syntax.

    -Alan



    Originally posted by useANT
    Hi,

    I am using a HP Tandem Non Stop SQL Database (... it's not my choice!!!) and whant to compare a field MUTDATZEIT of type DATETIME with an input specific value given in argument...

    select * from MYTABLE where MUTDATZEIT < '2000-01-01 00:00:00'

    of course writting this i get an error cannot compare DATETIME with CHARACTER,
    i already tried:

    < DATETIME '2000-01-01 00:00:00'
    < DATETIME '2000-01-01 00:00:00' year to day
    < TO_DATE('2000-01-01 00:00:00', 'YYYY-MM-DD HH:MMS')

    HELPPPPPPPPPP !

    I cannot find any documention on it on the web...

    i am really blocked,

    thanks for your help

Posting Permissions

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