Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

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

By Bernabe Diaz,

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.

We create a loop based on the bundle size required.

Try it.

Total article views: 1797 | Views in the last 30 days: 84
 
Related Articles
FORUM

Copy query result issue

Copy query result issue

FORUM

Problem with query result

Query result out of......

FORUM

Two query results mixed together

Two query results mixed together

FORUM

Copying Headers from SQL Query Window results in SQL 2005

SQL Query results Headers

FORUM

Incorrect MDX query results

Results are incorrect when Customer dimension is not in Query

Tags
t-sql    
 
Contribute

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.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones