batch processing
Use this script to split a batch up into chunks using a cursor. This method can be used for most any large table with some modifications. It could also be refined further with an @Day variable (for example). This is for the case where you already have the data in a table and are ready to process it. Obviously, if you have a large flat file, you can just use BULK INSERT.
To use this script.
Replace SomeDateField with the date you want to partition on.
Replace SomeTable with the table you are pulling data from.
The transaction is optional. It may or may not speed up processing. You just have to experiment.
All logic for the load goes in between the transaction statements, or between the BEGIN and the FETCH NEXT statement.
Last updated