last day (14 days later) » 

2:31 PM
0
Q: How do I query a DB2 timestamp value from MS Access?

Jeff BradyI have a linked DB2 table in Access 2007. The field "ROW_INSERT_TS" is shown as a Date/Time value, and some values look like this (in Access) 7/7/2014 2:39:25 PM 7/7/2014 2:36:04 PM 7/3/2014 12:18:25 PM I'm trying to find all values >= 7/3/2014, which should include all 3 of the above. I've t...

 
@mustaccio That gave me a Data type mismatch in criteria expression error.
 
The date delimiter in MS Access is hash (#) #2014-07-03 00.00.00# I am not sure of your locale, but you may need #2014/07/03 00:00:00# time may not be important.
Whatever your case, you will never have a dash between date and time. If your tableas are linked, it should be easy enough to get MS Access to build the query for you.
 
@Remou if I try WHERE (((MY_TABLE.ROW_INSERT_TS) >= #2014-07-03 00.00.00#)) I get [IBM][CLI Driver][DB2/AIX64] SQL0180N The syntax of teh string representation of a datetime value is incorrect. SQLSTATE=22007
 
See comment above, are your tables linked? Also which version of MS Access?
 
Yes, the table is linked. I also tried #2014/07/03 00:00:00# and got the same syntax error. Locale is US.
 
2:32 PM
Hello
 
hi, and thanks for the help
tables are linked, and it's Access 2007
 
np. Have you tried the query design window?
 
yes .. if I enter #2014/07/03 00:00:00# it converts it to #7/3/2014#
that gives the same invalid syntax error
 
That should work. Are you sure of your data type?
 
Not 100% sure .. I don't know much about DB2 and this is the only access I have to it
 
2:35 PM
Okay, just a minute.
 
I was going based upon the way the date looked in the table, and the "TS" in the field name I assumed to mean it was a TIMESTAMP type
 
It could be text.
 
when i look at the table properties in Access, it says the field is Date/Time
 
What happens if you try Date() or Now() in the criteria?
 
Those seem to work. They return 0 results. If I do <Date() or <Now() it returns pretty much all rows, which would be correct.
That might be the answer .. I can do >=Date()-15 and it returns results
I should be able to make this work then
 
2:40 PM
Great!, are you happy?
 
yes! Thank you so much!! Can you add this as an answer to my post so I can mark it as correct/accepted?
 
Sure. np.
bye then
 
have a great day!
 
You too.
 

last day (14 days later) »