Home Forums SQL Server 2005 T-SQL (SS2K5) Is this a "gaps and islands" problem? Finding gaps in overlapping times. RE: Is this a "gaps and islands" problem? Finding gaps in overlapping times.

  • Awesome to have the heavy hitters on the case! Jeff, where you say:

    You're not actually supposed to use any data from that. You're only supposed to use the presence of rows instead of writing a loop

    I understand that, but if you run that it returns 5 columns of zeros. All called [n]. And I can't work out why that's necessary. Surely one column of zeros would be enough.

    Edit: I think I get it now! The cross joins mean that 10^5 rows are generated, and you're saying it's irrelevant that 5 meaningless columns just happen to be generated. Doing an extra CROSS JOIN would presumably result in 6 meaningless columns and a million rows. Does that sound right?

    Edit 2:

    a readless Tally Table

    So that means a tally table that doesn't have to be read from the disk, and is presumably therefore faster than the permanent tally table I usually use. How am I going so far?

    ...One of the symptoms of an approaching nervous breakdown is the belief that ones work is terribly important.... Bertrand Russell