Batch with intermediate SQL preparation.