Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Migrating Excel Table to SQL Server 2005

Author  Topic 

OrlaLynch
Starting Member

1 Post

Posted - 2009-02-16 : 11:33:37
Hi,

I am having a lot difficulty trying to get an Excel 2007 table import into a
SQL Server 2005 table. I have looked through the internet and cannot find any
help other than download software. The main problem is that I want the user
to be in the Excel and click a macro button to import the data.

My connection string seems to be working but I am getting an error on the
Select statement, I'm not sure what I am doing wrong. The error I am getting
is : "OLE DB provider "Microsoft.JET.OLEDB.4.0" for linked server "(null)"
returned message "Unspecified error". The code I am using is:

Dim con As Object

Set con = CreateObject("ADODB.Connection")
con.Open _
("Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=ORLA-PCSQLEXPRESS;Initial Catalog=ExcelTest")
con.Execute _
"SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;IMEX=1;HDR=YES;Database=C:\Users\Orla\AppData\Local\Temp\Book1.xls;','select * from [Sheet1$]')"

Any help would be great, Thank you,
Orla

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-16 : 11:50:49
The c: drive is located on the sql server machine?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-16 : 13:04:02
Use simple export/import wizard.
Go to Top of Page
   

- Advertisement -