Aaron Goldenthal

Sometimes ASP.NET is Rocket Science

Using a Counter Table to Get a Series of Dates

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]