Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 24th, 2009, 08:08 PM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sequential Column With Millions of Rows

Hey,

I have a need to make a table with a single column where each row is simply an incremental count (not necessarily starting at 0/1). Something like this:

Index
N
N+1
N+2
…
N+1000000

I would prefer a solution that doesn’t involve a while loop, since I already know how to do that.

My end goal is to join this column against static data in a view in order to get a bunch of rows like this:

Index Some Other Columns…
N Some Static Data
N+1 Some Static Data
N+2 Some Static Data
…
N+1000000 Some Static Data

The combination of Index, and the static data will then be used to create computed columns.

If anyone has a good answer to either of these issues I’d like to hear it J

Thanks!
 
Old February 24th, 2009, 08:18 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Well, a recursive function could be a nice idea, but you will end up with a stack overflow. in any point somebody will have to loop.
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending millions of mail ash141vsp2003 ASP.NET 2.0 Professional 0 May 29th, 2007 12:21 AM
column to rows mitasid Beginning VB 6 1 June 12th, 2006 01:37 PM
Adding rows, AND column(s) to existing datatable cliffd64 VB.NET 2002/2003 Basics 1 August 18th, 2005 06:50 AM
convert long column into rows bdmoody Classic ASP Basics 2 August 7th, 2004 01:11 AM
process millions of rows maratg SQL Server 2000 4 September 18th, 2003 12:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.