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.
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.
SQL SERVER – RETAINDAYS Does Not Delete Backup After x Days
RETAINDAYS sets backup expiration for overwrite checks, without deleting the file. I keep SQL expiration separate from Windows file cleanup.







