I am working in an environment where some users need to have American dates (mm/dd/yyyy), other european dates (dd/mm/yyyy).
The day is not important here (always first day of the month).
To compare two dates, I decided to get the year part, and the month mart - put them together : YYYYMM.
Now, I have a date field Date1, that I like to compare with the other "date" put in a long variable :
Select * from Table1 WHERE clng(format([date1],'yyyymm')) > 200512;
I get the error : Data mismatch in the criteria expression.
(For info if I do Select clng(format([date1],'yyyymm')) from Table1 it works just fine
Or Select * from Table1 WHERE format([date1],'yyyymm') > '200512' (but I need a number comparison, not string).
The day is not important here (always first day of the month).
To compare two dates, I decided to get the year part, and the month mart - put them together : YYYYMM.
Now, I have a date field Date1, that I like to compare with the other "date" put in a long variable :
Select * from Table1 WHERE clng(format([date1],'yyyymm')) > 200512;
I get the error : Data mismatch in the criteria expression.
(For info if I do Select clng(format([date1],'yyyymm')) from Table1 it works just fine
Or Select * from Table1 WHERE format([date1],'yyyymm') > '200512' (but I need a number comparison, not string).