Create a Tally or Numbers Table

• I didn't think of them but now that you pointed them out, you are right on both observations.

1. A single table starting at zero and a pass-through view with a >0 critiera.

2. Number1 and Number0 would be easier for casual user.

>if the use of BETWEEN is a pain

I'm curious how you would use BETWEEN when you need a zero-based number table.

• What I meant by the BETWEEN was, if you have a zero-based table and need a unit-based solution, then the WHERE clause would need to include WHERE N BETWEEN 1 AND @DesiredInt. That would also allow you to use just a single table.

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

Change is inevitable... Change for the better is not.

How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)

• Jeez Jeff, I knew you'd been doing Tally tables for a long time, but you wrote the article THAT long ago ?

• ben.mcintyre (11/24/2011)

Jeez Jeff, I knew you'd been doing Tally tables for a long time, but you wrote the article THAT long ago ?

😀

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

Change is inevitable... Change for the better is not.

How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)

• RBarryYoung (5/1/2008)

Just google "tally table". The procedural (manual) form is used by schools a lot.

After 6 years, it would appear that Google has finally caught up with what is meant by a "Tally Table". 😛 At least insofar as how we use it.

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

Change is inevitable... Change for the better is not.