Subject | DATE Comparision Problem |
---|---|
Author | jyotindra_bhoyania@yahoo.com |
Post date | 2001-10-09T05:29:03Z |
Hi All,
I am using Firebird version 1.0.0.338 and I have a very strange
problem. I have a table in which I have got a field having TIMESTAMP
datatype.
Now when I query that table from ISQL as follows, It does not return
ANYTHING. But the fact is there is a record having that value.
SELECT * FROM BANK_HOLIDAY
WHERE BANK_HO_DTE = '12/10/2001 18:46:12';
That table is having that value and I am able to see it if I look at
the data of the table.
I, then tried few other combination also but have not been able to
get result.
Like:
(1) SELECT * FROM BANK_HOLIDAY WHERE CAST (BANK_HO_DTE AS DATE )
= '12/10/2001';
(2) SELECT * FROM BANK_HOLIDAY WHERE CAST (BANK_HO_DTE AS CHAR )
= '12/10/2001';
(3) SELECT * FROM BANK_HOLIDAY WHERE BANK_HO_DTE = CAST( '12/10/2001'
AS DATE);
(4) SELECT * FROM BANK_HOLIDAY WHERE BANK_HO_DTE = CAST( '12/10/2001
18:46:12' AS TIMESTAMP );
(5)SELECT * FROM BANK_HOLIDAY WHERE CAST (BANK_HO_DTE AS DATE )= CAST
( '12/10/2001' AS DATE );
All failed to give me result. I am very much frustated due to this.
Can anybody guide me on this.
TIA,
Jyotindra.
I am using Firebird version 1.0.0.338 and I have a very strange
problem. I have a table in which I have got a field having TIMESTAMP
datatype.
Now when I query that table from ISQL as follows, It does not return
ANYTHING. But the fact is there is a record having that value.
SELECT * FROM BANK_HOLIDAY
WHERE BANK_HO_DTE = '12/10/2001 18:46:12';
That table is having that value and I am able to see it if I look at
the data of the table.
I, then tried few other combination also but have not been able to
get result.
Like:
(1) SELECT * FROM BANK_HOLIDAY WHERE CAST (BANK_HO_DTE AS DATE )
= '12/10/2001';
(2) SELECT * FROM BANK_HOLIDAY WHERE CAST (BANK_HO_DTE AS CHAR )
= '12/10/2001';
(3) SELECT * FROM BANK_HOLIDAY WHERE BANK_HO_DTE = CAST( '12/10/2001'
AS DATE);
(4) SELECT * FROM BANK_HOLIDAY WHERE BANK_HO_DTE = CAST( '12/10/2001
18:46:12' AS TIMESTAMP );
(5)SELECT * FROM BANK_HOLIDAY WHERE CAST (BANK_HO_DTE AS DATE )= CAST
( '12/10/2001' AS DATE );
All failed to give me result. I am very much frustated due to this.
Can anybody guide me on this.
TIA,
Jyotindra.