Main Board > ODBC

ODBC Date Issue

(1/3) > >>

Jeffrey Ferreira:
Hi All,

We are using ODBC Driver 7.00.
If we do the following in Excel

Select Order_Number, Order_Date from "Open Orders" WHERE  Order Date > "09/01/2022"

it returns every order up until 12/31/2022 and does not return anything from 2023

if  we do

Select Order_Number, Order_Date from "Open Orders" WHERE  Order Date > "01/01/2023"

then it returns the 2023 orders

has anyone ever seen this or know what i could be doing wrong?

thanks
jeff

Devon Austen:
I can see a few possible issues:

1. your WHERE clause is not using the correct field name. It should be Order_Date not Order Date. You need the underscore and not a space. Then again maybe that is just an issue with typing it out for the forum but it is in both your examples so it could be the issue.

2. Use single quote not double quote.

2. If Order_date is defined with a DATE class you may need to use the date format yyyy-mm-dd in your SQL query.

WHERE Order_Date > '2022-09-01'

Jeffrey Ferreira:
Devon,

i'm sorry i was just pseudo coding it quick to give you all an idea what i was trying to do

i'm not creating the SQL Select (Excel is).


jeff

Jeffrey Ferreira:
I just tried it with Excel Power Query and that failed too.  I tested it against another database we have (mysql) and that worked. Is it possible there is something wrong with the 7.00 ODBC Driver. This worked when we were using 4.21.

jeff

Devon Austen:
I am able to filter based on a date field in Excel just fine.

As I said earlier the issue may be the date format you are trying to use. The ODBC expects YYYY-MM-DD for date fields.

Navigation

[0] Message Index

[#] Next page

Go to full version