sql server - How do i export Huge Bulk of data in c# -
i using sql server database. selecting data 4 tables, data rows of sql result comes approx 9 million rows. how export data in c#?
the key thing when dealing large data volumes use streaming apis. in case of ado.net, mean executereader()
method on dbcommand
; that, have row-based streaming api can work with:
using(var reader = cmd.executereader()) { { while(reader.read()) { // write current row via reader api } // next row } while(reader.nextresult()); // <== successive grids, 1 }
if you're exporting accepts idatareader
(such sqlbulkcopy
), can give open reader:
using(var reader = cmd.executereader()) { doyourthing(reader); }
note can configure reader stream columns - useful large text columns etc - see overload of executereader
accepts commandbehavior
- sequentialaccess
column-streaming (you can access columns in left-to-right order if this).
Comments
Post a Comment