Using Table Variables and Temporary Tables with Procedures
You have seen how to use both table variables and temporary tables earlier in this book on Day 10, "Views and Temporary Tables." When you begin using them in stored procedures, you need to understand how they affect the performance of the stored procedure when executed. Temporary tables provide you with the ability to store data from a table in a temporary area to allow access to the data during the stored procedure. Then, when the procedure is finished, the table variable or temporary table is deleted.
In the next few sections, you will see how each of these features is used in a stored procedure and what to watch for in optimization and performance.
Using Table Variables in a Stored ...
Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition 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.