Chapter 7. Temporary Tables and Table Variables
Itzik Ben-Gan
T-SQL programming often involves the need to materialize data temporarily. Temporary tables are just one solution; other ways for handling an independent physical or logical materialization of a set include table variables and table expressions such as views, inline user-defined functions (UDFs), derived tables, and common table expressions (CTEs).
You might need to physically persist interim states of your data for performance reasons, or just as a staging area. Examples of such scenarios include:
Materializing aggregated data to some level of granularity (for example, employee and month), and issuing running, sliding, and other statistical reports against that data
Materializing a result ...
Get Inside Microsoft® SQL Server® 2008: T-SQL Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.