How to Bulk Insert from XLSX file extension?

前端 未结 4 1342
余生分开走
余生分开走 2020-12-04 01:52

Can anyone advise how to bulk insert from .xlsx file?

I tried the below query already:

BULK INSERT #EVB FROM \'C:\\Users\\summer\\Deskto         


        
相关标签:
4条回答
  • 2020-12-04 02:18

    You need to use OPENROWSET

    Check this question: import-excel-spreadsheet-columns-into-sql-server-database

    0 讨论(0)
  • 2020-12-04 02:24

    It can be done using SQL Server Import and Export Wizard. But if you're familiar with SSIS and don't want to run the SQL Server Import and Export Wizard, create an SSIS package that uses the Excel Source and the SQL Server Destination in the data flow.

    0 讨论(0)
  • 2020-12-04 02:40

    you can save the xlsx file as a tab-delimited text file and do

    BULK INSERT TableName
            FROM 'C:\SomeDirectory\my table.txt'
                WITH
        (
                    FIELDTERMINATOR = '\t',
                    ROWTERMINATOR = '\n'
        )
    GO
    
    0 讨论(0)
  • 2020-12-04 02:41

    Create a linked server to your document

    http://www.excel-sql-server.com/excel-import-to-sql-server-using-linked-servers.htm

    Then use ordinary INSERT or SELECT INTO. If you want to get fancy, you can use ADO.NET's SqlBulkCopy, which takes just about any data source that you can get a DataReader from and is pretty quick on insert, although the reading of the data won't be esp fast.

    You could also take the time to transform an excel spreadsheet into a text delimited file or other bcp supported format and then use BCP.

    0 讨论(0)
提交回复
热议问题