Instead of NTILE you could also apply a ROW_NUMBER. Add logic to your query to calculate the required rownumbers depending on your input variable (like: 1 = row 1 - 10000, 2 = row 10001 - 20000, 3 = row 20001 - 30000, etc). This will give you the exact number ow rows for each resultset.