Readers found five ways to simulate LEAD() and LAG() without the SQL Server 2012 analytic functions. This post shows each solution with its author, runs all five on SQL Server 2025 and compares the rows with the real functions. Four return the same ten rows and one adds a rule of its own.
SQL SERVER – Puzzle to Win Print Book – Explain Value of PERCENTILE_CONT() Using Simple Example
Win a print book: explain the value of PERCENTILE_CONT with a simple example, and learn this SQL Server 2012 function even on an earlier version.
SQL SERVER – Puzzle to Win Print Book – Write T-SQL Self Join Without Using LEAD and LAG
Win a print book: write a T-SQL self join that simulates LEAD and LAG, so you can learn a SQL Server 2012 feature even on an earlier version.
SQL SERVER – A Simple Quiz – T-SQL Brain Trick
A T-SQL brain trick: three SELECT statements are separated by lines of underscores, and running one of those lines alone gives Msg 2812. Can you explain why?
Puzzle – Usage of New Index Hints – ForceSeek and ForceScan
SQL Server Denali adds the FORCESCAN hint next to FORCESEEK. A weekend puzzle on these Index Hints: write a query where each one improves performance.
SQL SERVER – DBA Quiz 2011 – All was well few moments before all went wrong – Reasons and Resolutions
My question in DBA Quiz 2011 comes from a real incident: a query that always worked fine suddenly did not. Share your reasons and resolutions.
SQL SERVER – Puzzle Involving NULL – Resolve – Error – Operand data type void type is invalid for sum operator
SELECT SUM over a lone NULL throws Msg 8117: Operand data type void type is invalid for sum operator. Here is why it happens and how ISNULL fixes it.






