Temp table scope decides what dynamic SQL and stored procedures can read. Tested demos show a child reading a parent table, a procedure that fails without it, a dynamic table shape and the error a typo causes. A card lists the rules.
Dynamic SQL Temp Table: Why It Disappears and How to Keep It
A dynamic SQL temp table is dropped when its dynamic batch ends, so the main code cannot read it. A global temp table keeps the data, and a per session name keeps it safe. Every step is tested, including the second session clash.
Disk Space Needed to Build a Clustered Index on a Big Table
A clustered index build holds the old table and the new index at the same time. Here is a small demo of that peak, and what to check first.
Renaming a Table With Almost No Downtime Using sp_rename
A rename swaps names in a blink, yet the foreign key and permissions stay with the old table. Here is a short demo and a safer swap.
How Many Temporary Tables are Created So Far in SQL Server? – Interview Question of the Week #149
How many temporary tables are created so far in SQL Server? No DMV gives this directly, but here is an easy workaround to find the answer.
Create a Global Temporary Table in SQL Server
A global temporary table starts with two # signs, lives in tempdb, and any session can read it. This post creates one, reads it from a second window, and shows when SQL Server drops it. It also covers name collisions and the cases where a different table type is the better choice.
SQL SERVER – How to Create Table Variable and Temporary Table?
A Temporary table uses CREATE TABLE, while a table variable uses DECLARE. I use one row in each beginner example.







