If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Datetime Character Comparison

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-11-03, 03:49
useANT useANT is offline
Registered User
 
Join Date: Jul 2003
Posts: 1
Red face 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
Reply With Quote
  #2 (permalink)  
Old 07-16-03, 21:05
AlanI AlanI is offline
Registered User
 
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



Quote:
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On