Abstract
Because SQL Server is designed to operate with set-based queries efficiently, it does not perform as well with loops and cursors. However, there are situations where you need some type of a loop. Tally tables give you the best of both worlds by allowing you to effectively “loop” through records in a set-based manner. We’ll explore what tally tables are, how they work, and, more importantly, review how to use them to turn your loops and cursors into efficient set-based operations.
Presented at:
- SQL Saturday #1021, Orlando, FL on Oct 30, 2021
- IndyData (formerly IndyPASS), Indianapolis, IN on Jan 19, 2021 (virtual)
- SQL Saturday #951, Tampa, FL on Feb 29, 2020
- SQL Saturday #908, Denver, CO on Oct 12, 2019
- Salt Lake City SQL Server User’s Group, Murray, UT on May 8, 2019 (video)
- SQL Saturday #801, Orlando, FL on Oct 6, 2018