int mssql_fetch_batch ( int result)
Returns: The number of rows for this batch
This works with the php.ini option 'mssql.batchsize' to limit the number of rows that are buffered in memory.
i.e.
// Batch 10000 records in the buffer at a time
ini_set('mssql.batchsize', 10000);
$resDb = mssql_connect(...);
$result = mssql_query('SELECT * FROM MYTABLE', $resDb);
$intNumRows = mssql_num_rows($result);
while ($intNumRows > 0)
{
while ($arrRow = mssql_fetch_assoc($result))
{
// Do stuff ...
}
$intNumRows = mssql_fetch_batch($result);
}