Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: Break Up Large Table Query Into Results of N Rows Date: Tue, 31 Jan 2012 23:03:05 +0100 Organization: Erland Sommarskog Lines: 37 Message-ID: References: <5609f740-b8b5-4876-8a4a-5633aa91a3a8@eb6g2000vbb.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="nBFDv6s1VJQDuF1w6hpX2A"; logging-data="22209"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19r0tevu3rnDXUyLFCas6+q" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:LRiyUzTz/S2VVIY636qs9Yr7iKw= Xref: x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:917 pbd22 (dushkin@gmail.com) writes: > On Jan 31, 9:57 am, pbd22 wrote: >> I am working in SQL Server 2005 and want to break up a table of 1M >> rows into distinct results of 80,0000. >> >> I feel like this is basically >> >> use [database] >> >> select * from [table] >> where email_address like '%gmail.com' >> group by ???? >> >> I am messing up with the group by (if this is the right way to go). >> How do achieve this? >> > > Anybody? To people use this group any more? I am here! However, I only look in here about once a day. The traffic does not really warrant anymore. If you want speedy answers to your questioms, this is a busy place: http://social.msdn.microsoft.com/Forums/en-US/transactsql/threads Although, a bit too many people answers questions that goes outside what they really know. Anyway, your problem is a little vague. What is the purpose with this division? And must the batches be exactly 80000 rows in size or can the number vary? -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx