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.
SQL Agent Job Backslash Puzzle: Why Both Rows Were Deleted
A SQL Agent job backslash at the end of a comment line can turn a one row delete into a delete of the whole table. This puzzle sets up the job, explains the cause and tests the effect in T-SQL. It ends with a safe way to write the step.
Disable Resource Governor: Why RECONFIGURE Turns It On
To disable Resource Governor, run ALTER RESOURCE GOVERNOR DISABLE. The post shows why RECONFIGURE enables the feature, with a tested script that restores the state it finds. It also explains how saved pool limits come back to life.
SQL SERVER – Swap Column Values In Table
Here is a question asked to me during Comprehensive Database Performance Health Check. The question was about how to swap column values in a table.
Delete Qualified Rows From Multiple Tables: A SQL Puzzle
Delete qualified rows from multiple tables with as few logical reads as you can. This puzzle gives a setup script for three small tables, the two rules for the delete and a starting script that costs 19 logical reads. Your task is to beat that number and stay correct.
DBCC DROPCLEANBUFFERS Impact on Memory: See a Cold Cache in Action
DBCC DROPCLEANBUFFERS removes every clean page from memory, so the next query reads from disk. This post counts the pages of one database before and after, shows why a CHECKPOINT comes first, and compares a cold read with a warm read.
What is Source_Database_ID in Sys.Databases?- Interview Question of the Week #232
Question: What is Source_Database_ID in Sys.Databases and why it is mostly NULL? Very interesting question, I received indeed.







