Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Practicality of Tally Tables

Author  Topic 

Lavos
Posting Yak Master

200 Posts

Posted - 2002-11-06 : 22:31:24
Ever since I saw tally/sequence tables in Celko's book (well, I saw it in the Guru's Guide first I think, but anyway) I've always loved some of the neat operations that could be done with them. There are quite a few operations that can be elegantly reduced down to a few joins instead of using a loop.

My problem, is that I don't have any real experience with heavy usage of a tally table (ie. I used one once in a function that wasn't called that often). How practical are they in normal usage? Has anyone ever used one in a production environment? This is more of an academic question than anything else.


----------------------
"O Theos mou! Echo ten labrida en te mou kephale!"

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-11-06 : 22:38:00
Hi

I use them all the time. They are fantastic for web app work where you often have a multi select list that passes through a comma separated list of ids. You can send that directly to your proc and not have to worry.

The only downside is that normal string parsing methods can be faster, particularly for smaller sets. But that is a tradeoff I am happy to live with.

Damian
Go to Top of Page

r937
Posting Yak Master

112 Posts

Posted - 2002-11-06 : 23:04:50
there are probably more elegant ways in sql/server, where you have the ridiculously powerful (and i say that with immense respect) transact-sql language, but i use an integers table all the time, especially in databases where there's no scripting

example:

Finding all the dates between two dates
[url]http://searchdatabase.techtarget.com/ateQuestionNResponse/0,289625,sid13_cid474893_tax285649,00.html[/url]

rudy
Go to Top of Page
   

- Advertisement -