Monday, March 12, 2012

Import data from excel into tables

hi
I want to import data from excel into table in sql server
while execution this statement
select *
into SQLServerTable FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\testing.xls;HDR=YES',
'SELECT * FROM [Sheet1$]')
i got this error
[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB provider
'Microsoft.Jet.OLEDB.4.0' reported an error. ERROR [01000]
[Microsoft][ODBC SQL Server Driver][SQL Server][OLE/DB provi
der returned
message:
Could not find installable ISAM.
Any one find me solution and reply where it went wrongHi
It is better practice to create the table and then using INSERT...SELECT
rather than SELECT.. INTO.
I think you should be using datasource and not database therefore (this is
untested!) try:
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'DataSource=D:\testing.xls;Extended Properties=Excel 8.0;HDR=YES', Sheet1$)
John
"Chinnappa" <Chinnappa@.discussions.microsoft.com> wrote in message
news:99E608C6-BBBF-43A4-B7AE-DF2D0318C79D@.microsoft.com...
> hi
>
> I want to import data from excel into table in sql server
> while execution this statement
> select *
> into SQLServerTable FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
> 'Excel 8.0;Database=D:\testing.xls;HDR=YES',
> 'SELECT * FROM [Sheet1$]')
> i got this error
>
> [Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB provider
> 'Microsoft.Jet.OLEDB.4.0' reported an error. ERROR [01000]
> [Microsoft][ODBC SQL Server Driver][SQL Server][OLE/DB pro
vider returned
> message:
> Could not find installable ISAM.
> Any one find me solution and reply where it went wrong
>

No comments:

Post a Comment