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 2000 Forums
 SQL Server Development (2000)
 Import Excel Data to a sql server table

Author  Topic 

vimalraj
Starting Member

5 Posts

Posted - 2007-09-11 : 01:39:02
Hi,

I need to import data from more than 10 excels having the same format in to a single sql server table.

I tried to use

INSERT INTO MyTempTable
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 11.0;Database=C:\Book1.xls', [Sheet1$])

but got the below error
Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a linked server.

If DTS package is used then I am not sure how I can place 10 excels at a time so that they can be picked one by one and data is imported in to table.

Please help.

Thanks,
Vimalraj

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-09-11 : 05:42:39
you need to create a linked server
or
via dts, you can pick the xls worksheet one by one and choose which tables they are to be inserted into... try it out first and see if it doesn't answer your requirements

--------------------
keeping it simple...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-09-11 : 05:43:25
Do you have access to that EXCEL file?
As specified make use of Linked Server and try
For more informations refer http://sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

vimalraj
Starting Member

5 Posts

Posted - 2007-09-11 : 06:40:54


Please tell me

How can I create a linked server?


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-09-11 : 06:43:28
quote:
Originally posted by vimalraj



Please tell me

How can I create a linked server?





Read about Sp_addLinkedServer in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-09-11 : 06:52:26
if it's just one time.. just use import via DTS wizard

otherwise you need to research and figure out if linkedserver is your solution... read more on it before deciding you need linkedservers...also you should really consult your DBA

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -