SELECT ~ 1 returns -2 because the tilde is the bitwise NOT operator and flips all 32 bits of an int. This post keeps the puzzle, tests the answer on SQL Server 2025 with five data types and shows where the tilde is useful.
NOT IN With a NULL in the List Returns No Rows
See why NOT IN with a NULL returns no customers, then compare five sample rows, NOT EXISTS, an IS NOT NULL filter, and query plans.
USE HINT: Switching Off One Optimizer Rule Without Trace Flags
Apply USE HINT to one query, inspect supported names, compare optimizer behavior, and manage Query Store hints with a clear removal plan.
When Did SQL Server Last Restart? Four Ways to Check
Find SQL Server’s last restart using startup metadata, tempdb, logs, and sessions, then interpret reset counters correctly.
Cached Data Per Object in Memory: Read the Buffer Pool
Cached data per object tells you which tables and indexes fill the buffer pool. This post builds two demo tables, empties their cache and reads part of the data. A query then lists the pages, megabytes and share of each index in memory. It also explains why the view is costly on a big server.
Disable Adaptive Join for One Query or a Whole Database
To disable adaptive join for one query, add a USE HINT to it. This post also shows a Query Store hint for code you cannot edit and the database setting that switches the feature off for everything. Each switch is tested on a small demo database and checked in the plan.
Job Steps That Fail While the Agent Job Reports Success
A green job history does not mean every step worked. Decode the failure routing and pair failed steps with their outcomes.







