I have an application that uses MS SQL Server for which I\'ll need to do a bulk insert from a file. The sticking point is that the database and my application will be hoste
I'm still looking for a way to do this in MS SQL, but what I did in MySQL was to save the CSV as a BLOB in a temporary table, run SELECT ... INTO DUMPFILE in a directory local to the DB server, then run the regular LOAD DATA statement on that local file (EDIT: I feel I should point out, this was before LOAD DATA LOCAL was available).
I think spWriteStringToFile will do it.
EDIT: I'm on to something.
comm.CommandText = @"EXEC spWriteStringToFile @data, 'c:\datadumps', 'data.csv';
BULK INSERT my_table FROM 'c:\datadumps\data.csv';";
comm.Parameters.AddWithValue("data", File.ReadAllText(path));
comm.ExecuteNonQuery();