I am trying to figure out how I could breakup my datatable and send that (as UDT) down to sql server). So if I have 100,000 in my datatable I would like to be able to break it up into 10,000 chunks to send down to my sql server. I am just not sure about how I would take the datatable with 100,000 and break it up into those 10,000k blocks?
Any suggestions would be greatly appreciated.
So if I used something like this:
var results = (from myRow in myDataTable.AsEnumerable()
select myRow).take(10000);
Not sure how I could ensure I grabbed the next set of 10,000 rows from the datatable and ensure I don’t send duplicates and get all of the rows?
Just write yourself a simple method to turn any collection into chunks of a specified size:
And then you can trivially use this, for example: