Use CURRENT_DATE, string concatenation, optional SUBSTRING length and bigint DATEADD in SQL Server 2025 with clear examples and checks.
A Bill of Materials With a Recursive CTE
Expand a bill of materials with a recursive CTE, multiply quantities across levels, trace component paths, and guard against cycles.
Leap Years in T-SQL: February 29 and Date Math
Handle leap years in T-SQL with date functions, test February boundaries, and choose a clear anniversary rule for February 29 births.
SQL SERVER – Finding Last Backup Time for All Database
Last Backup Time comes from recorded history, which I check by backup type. Recovery still needs the files and a tested chain.
COUNT OVER: Show the Filtered Total Beside Page Rows
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.







