Relative Content

Tag Archive for c#sql-serverssissqlbulkcopy

reading and writing large csv file with custom row terminator in C#

I need to read in various large .csv files of differing schema into SQL Server using SqlBulkCopy class. Initially, I used a DataTable to load the data and convert the data types to the target data types, but this failed due to an OutOfMemoryException. Instead, I want to solve the problem using streaming.
I came up with this working code so far: