Export huge MS sql table to csv without fetching all records together

The example attached uses ROWIDs from SQLite. You could see if you either have a ROWIDs present or you could create one yourself. You can choose the size of the chunk/batch yourself (I use integers you might have to see if with very large numbers you might need big integers or something. Even a workaround with using strings might be possible).

This is a companion discussion topic for the original entry at https://kni.me/w/6w83L6Tbsr33lHF9