COUNT OVER helps me keep a page’s row count separate from the filtered total. Compare full and partial pages. An empty page needs an explicit total-count contract.
Find the Last Read and Write Time of Every Table in SQL Server
Find the last read and write time of every table in SQL Server with sys.dm_db_index_usage_stats. The tests show what counts as a read, why an insert counts as a write, what an index rebuild does to the numbers, and what wipes them.
SQL SERVER – List of all the Views from Database
Hundreds of Views and no idea which are indexed? A quick query on sys.views lists every view with its schema and whether it is indexed or indexable.
Resumable ADD CONSTRAINT in SQL Server 2022: Pausing a Primary Key Build
Use resumable ADD CONSTRAINT in SQL Server 2022 to pause a key build, inspect progress, resume safely, and understand abort behavior.
hierarchyid GetLevel: Count the Path Depth
hierarchyid GetLevel identifies depth within a logical path. The read-only example distinguishes the root, children, grandchildren and a fractional sibling label.
Stored Totals: Find Drift Before Repairing It
Stored totals can drift from their authoritative line amounts. This private demonstration finds two mismatches, retains empty orders and accepts valid credits. It checks decimal range before a private repair and explains why concurrency needs separate proof.
DATE_BUCKET: Align 15-Minute Windows With an Origin
DATE_BUCKET uses an origin to align reporting windows. Keep width, unit and origin explicit while checking timestamps around each boundary.







