A transaction table stores movements, not balances. Collapse each day, run a total, fill the quiet days and dodge the midnight trap.
Value Histograms: Counting Rows per Range Bucket in T-SQL
Turn a column of amounts into a clear shape. Three small traps decide whether your bucket counts are true: empty buckets, uneven ranges and BETWEEN.
Assigning Rows Round-Robin to Workers With ROW_NUMBER
Number the tasks, number the workers, match them with a remainder. A fair queue in one query, and the two shortcuts that quietly break it.
Splitting a Big Table Into Equal Key Ranges for Batch Work
Equal-width key ranges fail when ids have gaps. NTILE cuts by row count instead, so every worker gets a fair share of the table.
SQL SERVER – SQL SERVER – Comparison : Similarity and Difference #TempTable vs @TempVariable – Part 2
Can a temp table have indexes? Yes. In Part 2 of #TempTable vs @TempVariable, I explain how temporary table indexes live in TempDB and when they help.
Porting Stored Procedures Between Platforms
Porting stored procedures means preserving error, transaction, temporary-table, sequence, and date behavior instead of translating tokens.
Weighted Scores: Ranking Products by Several Columns at Once
Adding rating to units sold ranks by whichever column is biggest. Scale first, weigh second, and keep the weights in a table anyone can read.







