I'm trying to import a excel table that has a column with dates. My query works without the column date. I'm using ODBC to import.
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ActiveWorkbook.FullName & ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"
cn.Open strCon
cn.Execute "INSERT INTO [ODBC;DRIVER=SQL Server;SERVER=MYSERVEREXPRESS;Trusted_Connection=Yes;DATABASE=TESTDB].[tbTableTest1] ([opDate], [columnFloat], [columnText]) SELECT t.MY_DATE, t.COL1, t.COL2 FROM [BD$] t"
My table:
MY_DATE COL1 COL2
11/26/2012 21,43 MAR
11/26/2012 21,45 GFM
What am i doing wrong?
SELECT CAST(T.MY_DATE AS DATETIME) AS MY_DATE
– Zane Nov 27 '12 at 19:24