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.
Stored Procedure Execution Count and Average Elapsed Time
To find a stored procedure execution count, query sys.dm_exec_procedure_stats and divide the total elapsed time by the count. This post builds a demo, shows the query, and explains why the numbers start again when a plan leaves the cache. It also fixes the object name lookup that returns NULL for other databases.
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.
Adding Two Dates in SQL Server: Why the Year Is 2126
Adding two dates in SQL Server does not raise an error. It returns a date in the year 2126. This puzzle explains how datetime counts days from 1900, why the plus sign accepts a second date, and what to write instead.
Run a Stored Procedure at Startup in SQL Server
To run a stored procedure at startup, create it in the master database and mark it with sp_procoption. This post builds a demo that writes one row every time the instance starts. It also covers the rules, how to check the setting, and how to turn it off again.
Can You DROP Offline Database? – Interview Question of the Week #144
Can you drop offline database in SQL Server? Yes, you can. Many DBAs I interviewed thought otherwise, so here is the full answer.







