September 2010
Intermediate to advanced
1704 pages
111h 8m
English
Temporary tables are commonly used in stored procedures when intermediate results need to be stored in a work table for additional processing. Local temporary tables created in a stored procedure are automatically dropped when the stored procedure exits. Global temporary tables created in a stored procedure still exist after the stored procedure exits until they are explicitly dropped (see Listing 44.12) or the user session in which they were created disconnects from SQL Server.
Listing 44.12 Using Local and Global Temporary Tables in Stored Procedures

Note what happens if you try to run the stored ...