Import data from excel to sql server

2

I need to import the data that is in excel to a table in sql. I looked at several sites but nothing so far has worked out. Using sql server management studio I have done the following so far, following the step a step :

sp_configure
'show advanced options', 1
reconfigure
sp_configure
'Ad Hoc Distributed Queries', 1 
reconfigure

/ * Creating the table with my spreadsheet attributes * /

create table funcionario(
Código INT NOT NULL PRIMARY KEY,
Nome VARCHAR(100) NOT NULL,
Admissão SMALLDATETIME NULL,
Departamento VARCHAR(100) NULL )

/ * Command to import the worksheet into the table * /

INSERT INTO FUNCIONARIO SELECT
* FROM OPENROWSET ('Microsoft.Jet.OleDB.4.0',
'EXCEL 8.0;Database=F:departamento.XLS'
,Dados$)

It all happens well in this case until the last part, where I have the following error:

Cannot create an instance of OLE DB provider "Microsoft.Jet.OleDB.4.0" for linked server "(null)".

I really do not know what else to do.

    
asked by anonymous 26.08.2014 / 17:09

1 answer

5

The simplest way to do this is by using the SQL Server Import and Export Wizard , included in SQL Server.

Withit,youcanevencreatethetargettable,oruseanexistingtable.

Usingthe32-bitversion,choosetheMicrosoftExcelproviderforthedatasourceanddestinationSQLServerdriver.

    
26.08.2014 / 21:54