Import EXCEL file (xlsl) to Table

0

What I need is to be able to load the data of an Excel sheet to a table. I already tried with bcp. Also with Bulk Insert and finally enabled:

sp_configure 'show advanced options', 1;  
RECONFIGURE;
GO 
sp_configure 'Ad Hoc Distributed Queries', 1;  
RECONFIGURE;  
GO  

And I tried to do it with: OPENROWSET

In no way I managed to do it, I only managed to insert a single record with special characters.

Before sending the query, visit many pages and nobody has an adequate solution for this.

I need to do it from a procedure and then automate it, so I do not use the wizard that I could surely do it in a few seconds.

    
asked by Oscar 17.10.2017 в 18:19
source

1 answer

0

I had to do something similar a few days ago. First I converted the xls to txt. Then create the table with the fields according to the data that will happen to you. And then I did it with Bulk, with sql server 2012.

BULK INSERT mitabla FROM 'c: \ temp \ listing.txt' - File path

WITH

(FIELDTERMINATOR = ';', - separates fields   ROWTERMINATOR = '\ r') - sets rows GO

So I pass all the records. They were more than 100000 Good luck

    
answered by 17.10.2017 в 19:48