You can use a BULK INSERT
statement that should cope with extremely large datasets.
The data will need to be in a CSV, and you'll have to create a variable to the file location.
<cfquery datasource="cse">
BULK INSERT Names
FROM '#variables.sCSVLocation#'
</cfquery>
If you have a reason not to use BULK INSERT and want to break it down into loops of 999, then you would have to work out how many 'records' are in the dataset, divide it by 999 to get the amount of times you'd have to loop over it.