Upload CSV file to SQL server

前端 未结 8 2069
悲哀的现实
悲哀的现实 2020-12-02 09:29

What is the best way to upload a large csv data file into SQL server using C# ? The file contains about 30,000 rows and 25 columns.

8条回答
  •  隐瞒了意图╮
    2020-12-02 09:53

    This technique uses the SQLBulkCopy() facility, but does not read the entire file into memory.

    The trick is that it implements a IDataReader class to read the .csv file.

    https://www.codeproject.com/Tips/1029831/Fast-and-Simple-IDataReader-Implementation-to-Read

提交回复
热议问题