If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to check a timestamp field with ODBC connection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-16-03, 06:57
itfabbste0 itfabbste0 is offline
Registered User
 
Join Date: Oct 2003
Posts: 5
Red face How to check a timestamp field with ODBC connection

I have a table on DB2 (AS400) with a Timestamp Column. I'd like the select all the field from that table where the timestamp column is greter than a specific time.

From AS400 console a can use this syntax without error:
SELECT * FROM srossi/andip00f WHERE TMSVAR <= '2003-07-20-18.00.00.000000'

But unfortunately on Access it is not the same. Do you know how to solve the problem?

Many Thanks, Ciao, Stefano
Reply With Quote
  #2 (permalink)  
Old 10-16-03, 07:06
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
I don't know the answer, but I would be interested in knowing how Access displays a timestamp selected from DB2. That might help you figure out how Access handles that data type.
Reply With Quote
  #3 (permalink)  
Old 10-16-03, 07:13
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
One more thing. Try the same SQL statement from a command prompt on your Windows machine. That way you can tell if it is the ODBC driver or just Access. I assume you are using the IBM ODBC driver that gets installed with the Runtime Client (or any other DB2 client).
Reply With Quote
  #4 (permalink)  
Old 10-16-03, 07:19
itfabbste0 itfabbste0 is offline
Registered User
 
Join Date: Oct 2003
Posts: 5
Red face

I have already verified how Access displays timestamp

16/10/2003 12:51:23
( As400 shows '2003-07-20-18.00.00.000000'

I have tried with:

1) SELECT SROSSI_ANDIP00F.* FROM SROSSI_ANDIP00F WHERE SROSSI_ANDIP00F.TMSVAR<="01/01/2003 17:00:00";
2) ......TMSVAR<="01-01-2003-17:00:00.000000";
3) ......TMSVAR<="2003-01-01-17.00.00.000000";(like As400 syntax)
4) ......TMSVAR<="01-01-2003 17:00:00";

but unfortunately access shows me "Data Tyme mismatch in criteria expression" each time.

Thanks a lot, Ciao, S.

N.B. I'm using the ODBC driver of DB2 Connection versione 8.1 of IBM, in order to create a ODBC connection with the AS400. Now I'm trying to select via MS Access with that ODBC.

Last edited by itfabbste0; 10-16-03 at 07:24.
Reply With Quote
  #5 (permalink)  
Old 10-16-03, 08:58
itfabbste0 itfabbste0 is offline
Registered User
 
Join Date: Oct 2003
Posts: 5
Talking

I found one Access function that solve my problem, it trasforms a string into a date. The function is DATEVALUE

Unfortunately it seems that Access does not consider the expression about the Hour, infact the two statemets here attached, extract the same data

SELECT SROSSI_ANDIP00F.* FROM SROSSI_ANDIP00F WHERE (((SROSSI_ANDIP00F.TMSVAR) >= DateValue("2003-06-05 13.37.54")));

SELECT SROSSI_ANDIP00F.* FROM SROSSI_ANDIP00F WHERE (((SROSSI_ANDIP00F.TMSVAR) >= DateValue("2003-06-05 13.37.53")));

Ciao, S.
Reply With Quote
  #6 (permalink)  
Old 10-16-03, 09:05
itfabbste0 itfabbste0 is offline
Registered User
 
Join Date: Oct 2003
Posts: 5
Angry

Marcus

How can I execute the same statement from the command prompt of windows?

Thanks, S.

Quote:
Originally posted by Marcus_A
One more thing. Try the same SQL statement from a command prompt on your Windows machine. That way you can tell if it is the ODBC driver or just Access. I assume you are using the IBM ODBC driver that gets installed with the Runtime Client (or any other DB2 client).
Reply With Quote
  #7 (permalink)  
Old 10-16-03, 09:11
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
The easiest way is to install the runtime client (or any client) and run the client configuration assistant to catalog the remote database on the local machine. Then you can issue db2 commands like:

db2 connect to database-name ......
db2 SELECT * FROM ...

You might have already installed a client, so try running the db2 commands.

However I am not really certain what is needed when talking to DB2/400 from Windows client.
Reply With Quote
  #8 (permalink)  
Old 10-16-03, 09:17
itfabbste0 itfabbste0 is offline
Registered User
 
Join Date: Oct 2003
Posts: 5
Talking

Grazie 1000
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On