Count partitions in SQL Server by reading the fanout of a partition function. This post reads fanout and modify_date from sys.partition_functions, watches SPLIT RANGE and MERGE RANGE change them, and finds functions that no table uses.
Scalar Function Statistics With sys.dm_exec_function_stats
Read dm_exec_function_stats to rank scalar UDF activity, inspect callers, verify collection settings, and recognize inlined work.
SQL SERVER – Validating Positive Integer Strings with Explicit Boundaries
To Validate Natural integer strings, I define a nonempty positive ASCII-digit contract. A customer wanted a simpler validator.
HAS_DBACCESS Function: List the Databases You Can Open
The HAS_DBACCESS function tells you whether the current login can open a database. One query over sys.databases turns it into a list, and this post tests six databases to show what each zero means: no user, offline, restricted or a busy single user slot.
Schema Discovery for JSON Columns: Listing Every Key With OPENJSON
Use schema discovery on JSON columns to count keys and types, inspect nested objects, and find missing required paths with guarded input.
Weighted Averages in T-SQL
Calculate weighted averages with matching numerator and denominator populations, decimal arithmetic, NULL rules, and calendar windows.
Count NULLs in a Column in SQL Server: Five Ways Compared
To count NULLs in a column, filter with IS NULL and count the rows, or subtract COUNT(column) from COUNT(*). This post tests five ways on 100,000 rows and compares their page reads. It also counts NULLs in several columns at once and shows the NULL group in GROUP BY.







