:

-- Store JSON, query it, and update it without parsing entire document DECLARE @json NVARCHAR(MAX) = N'"customer": "name":"John", "orders":["id":1]'; SELECT JSON_VALUE(@json, '$.customer.name') AS CustomerName;

Happy coding. May your seeks be narrow and your scans be none. About the author: 15+ years of SQL Server experience across financial, retail, and logistics sectors. Microsoft Data Platform MVP.

-- Running total per customer, ordered by date SELECT OrderId, CustomerId, OrderDate, Amount, SUM(Amount) OVER (PARTITION BY CustomerId ORDER BY OrderDate ROWS UNBOUNDED PRECEDING) AS RunningTotal, LAG(Amount, 1, 0) OVER (PARTITION BY CustomerId ORDER BY OrderDate) AS PreviousOrderAmount FROM Orders; Simplify date grouping.

EXEC dbo.sp_WhoIsActive @get_plans = 1, @get_outer_command = 1; It shows: blocking chains, query text, plan, tempdb usage, and more. Your flight recorder. Force good plans, revert bad ones.

: Enable RCSI on your OLTP databases (unless legacy code depends on locking). It eliminates most deadlocks. 4.2 Deadlock Analysis Pattern When a deadlock occurs, capture it using: