I was thinking years, but you could do days as well. It depends on
what you want to group on in the output.

To save you some searching, below is SQL to fill a numbers table for
SQL Server, if you go that route. As I said earlier, the other methods
work fine also. I tend to prefer doing as much as possible on the
database server, since databases are optimized for handling data.

CREATE TABLE [dbo].[numbers](
[number] [int] NOT NULL,
CONSTRAINT [PK_numbers] PRIMARY KEY CLUSTERED
(
[number] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY
= OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR =
100) ON [PRIMARY]
) ON [PRIMARY]


declare @counter int
set @counter = 0
begin tran
while @counter < 8000
begin
set @counter = @counter + 1
INSERT INTO numbers (number)
VALUES (@counter)
print 'The counter is ' + cast(@counter as char)
end
commit

-Mike Chabot

http://www.linkedin.com/in/chabot/

On Sun, Sep 26, 2010 at 2:50 PM, GLM <g...@glmdesigns.com> wrote:
>
> Maybe I don't have a clear concept of a numbers table (I'll be reading up on
> them tomorrow.) but wouldn't I need a "number" to correspond to the units in
> question (in this case days.)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337567
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to