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
 General SQL Server Forums
 New to SQL Server Programming
 Insert into table on local sqlserver from excel

Author  Topic 

andibakker
Starting Member

4 Posts

Posted - 2008-11-19 : 02:30:02
Hello All

I am very new to sqlserver. I am using SQLServer 2005 express edition on my pc and have created a test database with a table that I am trying to load from excel.

I am running a sql query from within visual studio (in the add query under server explorer)

INSERT INTO TestExcel
SELECT *
FROM OPENROWSET('SQLOLEDB', 'Excel 8.0; Database=C:\Documents and Settings\Andrea\My Documents\TestExcel.xls;
HDR=YES', 'Select * from [SheetNames$]') AS derivedtbl_1

When I run this I get the error message
"Cannot initialize the datasource object of OLE DB provider 'SQLNCLI' for linked server "(null)"

Do I have to open a connection somewhere? I thought it was open. I have no problem viewing the data with a select statement

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-19 : 03:12:47
shouldnt provider be microsoft.jet.oledb

http://support.microsoft.com/kb/321686
Go to Top of Page

andibakker
Starting Member

4 Posts

Posted - 2008-11-19 : 07:01:38
If I use microsoft.jet.oledb.4.0 I get an error The OLE DB Provider ‘'Microsoft.Jet.OLEDB.40'’ has not been registered.

What is Microsoft.jet. Is this something I need to download from microsoft. Do I need it ?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-19 : 07:05:54
quote:
Originally posted by andibakker

If I use microsoft.jet.oledb.4.0 I get an error The OLE DB Provider ‘'Microsoft.Jet.OLEDB.40'’ has not been registered.

What is Microsoft.jet. Is this something I need to download from microsoft. Do I need it ?


its the provider used for Excel
Go to Top of Page

andibakker
Starting Member

4 Posts

Posted - 2008-11-19 : 07:46:37
quote:
Originally posted by visakh16

quote:
Originally posted by andibakker

If I use microsoft.jet.oledb.4.0 I get an error The OLE DB Provider ‘'Microsoft.Jet.OLEDB.40'’ has not been registered.

What is Microsoft.jet. Is this something I need to download from microsoft. Do I need it ?


its the provider used for Excel



Where and how do I register this ? Is this something I can do from within Microsoft SQL Server Management Studio Express
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-19 : 07:50:04
You will have to install JET provider at SQL Server.
JET is found here http://support.microsoft.com/kb/239114


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

andibakker
Starting Member

4 Posts

Posted - 2008-11-19 : 08:36:24
quote:
Originally posted by Peso

You will have to install JET provider at SQL Server.
JET is found here http://support.microsoft.com/kb/239114


E 12°55'05.63"
N 56°04'39.26"




I do have the Jet provider installed. I found it when I searched on it. How do I reference this so that when I run the query in Microsoft Sql Server Management Express studio it does not give me an error that the 'Microsoft.Jet.OLEDB.40' is not registered. Is there somewhere I need to go to reference this ?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-19 : 08:40:25
'Microsoft.Jet.OLEDB.40' ??
'Microsoft.Jet.OLEDB.4.0'

See www.connectionstrings.com


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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-19 : 08:45:18
quote:
Originally posted by andibakker

quote:
Originally posted by Peso

You will have to install JET provider at SQL Server.
JET is found here http://support.microsoft.com/kb/239114


E 12°55'05.63"
N 56°04'39.26"




I do have the Jet provider installed. I found it when I searched on it. How do I reference this so that when I run the query in Microsoft Sql Server Management Express studio it does not give me an error that the 'Microsoft.Jet.OLEDB.40' is not registered. Is there somewhere I need to go to reference this ?


seems like you're using conection string wrongly
Go to Top of Page
   

- Advertisement -