Using a Counter Table to Get a Series of Dates

Posted by: Aaron Goldenthal 4/18/2010 9:28 PM

There are cases where having a table of sequential integers in your database can greatly simplify certain types of queries.  One common example is to get a series of dates. To illustrate how this can be used, first we’ll create a table.  In this case there’s only one column which contains the integers, and we’ll set that as the clustered primary key. 1: CREATE TABLE [dbo].[Counters] 2: ( 3: [CounterID] [int] NOT NULL, 4: CONSTRAINT [PK_Cou... [More]
Tags:
Categories: SQL
E-mail | Kick it! | DZone it! | del.icio.us Permalink | Comments (1) | Post RSSRSS comment feed