LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help with MSQuery & CAST function

Guys,

Hi there. I am trying to query a text file (via MS Query) such that the
first field contains a date represented as a string (e.g. '2005-05-02
12:00:00'). I want this field to be represented in excel as datetime.

My MSQuery is like:

SELECT cast('2005-05-02 12:00:00' as date) as MyDatetime FROM
`C:\TEMP\PerfdataTest`\FspEbsApps1_AllWithHdr.csv FspEbsApps1_AllWithHdr
(via ODBC Text driver)

but returns the following error:

syntax error (missing operator) in query expression 'cast('2005-05-02
12:00:00' as date)'

I have tried replacing 'as date' with 'as sql_date'; 'as sql_c_date'; 'as
sql_timestamp'; etc, etc.

Help - please if anybody could offer some advice around MSQuery/ODBC
CAST/CONVERT function syntax I'd be immensly grateful.

--
Cheers,

Neil Evans-Mudie
-. . .. .-.. / .----. ... --- -. .. -.-. .----. / . ...- .- -.
.... -....- -- ..- -.. .. .

e: address is a spam sink
If you wish to email me, try neilevans underscore mudie at hotmail dot com
w:
http://groups.msn.com/TheEvansMudieF...ew.msnw?&pps=k


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to cast ..Excel.ApplicationClass to ..Excel._Application yh Excel Discussion (Misc queries) 0 April 27th 10 07:08 AM
Unable to cast com object (interop) yh Excel Discussion (Misc queries) 0 April 26th 10 09:16 AM
How do I cast time when the total exceeds 24 hours arm266 Excel Discussion (Misc queries) 11 September 26th 09 06:58 PM
CAST Function Matt S Excel Discussion (Misc queries) 1 February 19th 08 05:16 PM
Need to cast OleObject to CombBbox Liline Excel Programming 1 August 29th 03 03:32 PM


All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"