Transfer large amounts of Data to an mdf

  • I have a large Excel database.

    I can extract it in ASP.net.

    I have over 150 columns with 100000 rows of Data.

    I would normally use an INSERT INTO statement but is about impossible with the number of columns.

    Is there another SQL command that would transfer the Data to an mdf?

  • See if this article helps you:

    https://www.simple-talk.com/sql/t-sql-programming/questions-about-using-tsql-to-import-excel-data-you-were-too-shy-to-ask/[/url]


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Import/Export Wizard ?

    I use it for basic spreadsheet imports. I have never tried 150 columns, so don't know if there are limits.

  • Is this a one-shot import or something that will be recurring? Some people would argue that 150 columns is awfully wide and could benefit from normalization.

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

  • You can always import it in batches

    1 - Insert a new column before "A". Add a UniqueKey to this column. It could be as simple as an incrementing number.

    2 - Copy the worksheet twice

    3 - On sheet_original, delete all data from column 52 to the end

    On sheet_Copy1, delete all data from column 2 to 51, and from 101 to the end

    On sheet_Copy2, delete all data from column 2 to 101

    4 - Import the 3 worksheets into separate tables

    5 - Select all the data from the 3 tables, with a join on the UniqueKey that you created, into your destination table.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply