Oppenhiemer
Programmer
Hi..
I seem to be having odd recults when working with dates. I have a table with a field called "DATEENTERED" which is defined as a TimeStamp data type. When editing data, it accepts date values using the UK format, as in dd/mm/yyyy. But, when it somes to querying the date, if I try to use the same format - I get a conversion error.
So the following SQL statement :
select ORDER_NO,DATEENTERED FROM MEDIA_ORDERS WHERE DATEENTERED = '14/04/2003';
Generates the error :
Conversion error from string "14/04/2003"
However, if I change the format to read..
select ORDER_NO,DATEENTERED FROM MEDIA_ORDERS WHERE DATEENTERED = '04/14/2003';
There is no problem (no conversion error generated) just no result are shown. As you would expect, given that the only record on the table has the value 14/04/2003!
I have even tried casting the value, such as :
select ORDER_NO FROM MEDIA_ORDERS WHERE DATEENTERED = CAST ('14/04/2003' AS DATE);
But this only generates the same error. This problem is really driving me mad! Any help would be much appreciated.. I will add that I am using Borland's OpenSource version 1.0.0.326 and Windows XP (which has been configured correctly to use the UK date format.)
Many thanks..
Opp.
I seem to be having odd recults when working with dates. I have a table with a field called "DATEENTERED" which is defined as a TimeStamp data type. When editing data, it accepts date values using the UK format, as in dd/mm/yyyy. But, when it somes to querying the date, if I try to use the same format - I get a conversion error.
So the following SQL statement :
select ORDER_NO,DATEENTERED FROM MEDIA_ORDERS WHERE DATEENTERED = '14/04/2003';
Generates the error :
Conversion error from string "14/04/2003"
However, if I change the format to read..
select ORDER_NO,DATEENTERED FROM MEDIA_ORDERS WHERE DATEENTERED = '04/14/2003';
There is no problem (no conversion error generated) just no result are shown. As you would expect, given that the only record on the table has the value 14/04/2003!
I have even tried casting the value, such as :
select ORDER_NO FROM MEDIA_ORDERS WHERE DATEENTERED = CAST ('14/04/2003' AS DATE);
But this only generates the same error. This problem is really driving me mad! Any help would be much appreciated.. I will add that I am using Borland's OpenSource version 1.0.0.326 and Windows XP (which has been configured correctly to use the UK date format.)
Many thanks..
Opp.