nataliek92
New Member
- Joined
- Oct 29, 2014
- Messages
- 40
Hello
I would like to copy a recordset from a Oracle RDB Driver into Excel, however I am having problems with my DateTime variable. I would like to open an SQL string similar to the following :
This gives the following run-time error :
Run-time error '-2147467259 (80004005)':
[Oracle][ODBC][Rdb]%SQL-F-DATCONERR, Data conversion error for string '14/12/2014'
-COSI-F-AMBDATTIM, ambiguous date-time
I am aware that the issue is due to the format of "TRANSACTION_DATE", and that I must express '14/12/2014' in the same format as "TRANSACTION_DATE" for my code to work. However, I am unsure how to find the exact format of "TRANSACTION_DATE".
The following SQL string does work :
The output is automatically converted by Excel to a Date format. If I change excels format to "General", the output is "41988". Now, the following SQL string gives the below error :
Run-time error '-2147467259 (80004005)':
[Oracle][ODBC][Rdb]%RDB-E-CONVERT_ERROR, invalid or unsupported data conversion
-RDMS-F-INV_DATE_CHG, invalid field datatype change to/from datetime
If I add quotation marks around the number, I get the data conversion error message mentioned earlier.
I'm now at a loss and am not sure where else to go. Has anyone else encountered this problem? What did you do to resolve the issue? Could anyone give any advise on how to improve my SQL string (in red), or offer an alternative to try?
Any help whatsoever would be greatly appreciated!
Thanks so much in advance.
Natalie
I would like to copy a recordset from a Oracle RDB Driver into Excel, however I am having problems with my DateTime variable. I would like to open an SQL string similar to the following :
Code:
strSQL = "SELECT TRANSACTION_DATE FROM FINANCIAL_TRANSACTION WHERE TRANSACTION_DATE > '14/12/2014'"
This gives the following run-time error :
Run-time error '-2147467259 (80004005)':
[Oracle][ODBC][Rdb]%SQL-F-DATCONERR, Data conversion error for string '14/12/2014'
-COSI-F-AMBDATTIM, ambiguous date-time
I am aware that the issue is due to the format of "TRANSACTION_DATE", and that I must express '14/12/2014' in the same format as "TRANSACTION_DATE" for my code to work. However, I am unsure how to find the exact format of "TRANSACTION_DATE".
The following SQL string does work :
Code:
strSQL = "SELECT MAX(TRANSACTION_DATE) FROM FINANCIAL_TRANSACTION"
The output is automatically converted by Excel to a Date format. If I change excels format to "General", the output is "41988". Now, the following SQL string gives the below error :
Code:
strSQL = "SELECT TRANSACTION_DATE FROM FINANCIAL_TRANSACTION WHERE TRANSACTION_DATE = 41988"
Run-time error '-2147467259 (80004005)':
[Oracle][ODBC][Rdb]%RDB-E-CONVERT_ERROR, invalid or unsupported data conversion
-RDMS-F-INV_DATE_CHG, invalid field datatype change to/from datetime
If I add quotation marks around the number, I get the data conversion error message mentioned earlier.
I'm now at a loss and am not sure where else to go. Has anyone else encountered this problem? What did you do to resolve the issue? Could anyone give any advise on how to improve my SQL string (in red), or offer an alternative to try?
Any help whatsoever would be greatly appreciated!
Thanks so much in advance.
Natalie
Last edited: