Split by a row (count) number of a query results

Sometime you need to split the query results row in a raw way, for example split the query results in bundles of 65000 rows.In this utitlitary script is showed a way to do it.

We first create a temporary table to hold the query result, the table has an identity column that we will use to tract the spliting counting; the rest of the columns have to match the structure of the query result.

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands
of articles and SQL scripts, a library of free eBooks, a weekly database news roundup,
a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals
that makes it such a success.