ODBC: filter by date

Martin

Lifer
Jan 15, 2000
29,178
1
81
assume the table has two columns
buildNumber
dateBuilt

what I want to do is very very simple: I want to select all builds between two dates.

I can do this easily enough on our MSSQL database - you can just say dateBuild BETWEEN '1/12/2006' AND '1/16/2006'. However I am using another database and I am connecting to it using an ODBC link (the database itself is Oracle). dateBuilt is a DATE type and I don't know how to filter by dates using ODBC. Amazingly, I can't find this info on google either.

I tried CONVERT (<timestamp>, SQL_Date), but that doesn't work.
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Did you try: SELECT... where dateBuilt >= '1/12/2006' and dateBuilt <= '1/16/2006' ?
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Try this:
SELECT ... where dateBuilt BETWEEN to_date(2006-01-12, 'yyyy-mm-dd') and to_date(2006-01-16, 'yyyy-mm-dd')

If it still doesn't work, then try the >= syntax.