STRING_SPLIT ordinals preserve a token position for SQL Server 2022 and later. This example keeps duplicate tokens, exposes an empty token and orders the returned rows explicitly.
SQL SERVER – Good, Better and Best Programming Techniques
My notes for a programmers meeting on Good, Better and Best Programming Techniques in SQL Server, plus a funny bug ticket about a client who got no email.
SQL SERVER – Query to Retrieve the Nth Maximum Value
Finding the nth Maximum Value means deciding how ties should count. Here, I rank distinct known salaries.
Bitwise Flags: Test, Add and Toggle Individual Bits
Bitwise flags use AND to test, OR to add and XOR to toggle a mask. Keep flag meanings explicit and preserve missing values in read-only examples.
SQL SERVER – TRIM() Function – UDF TRIM()
SQL Server 2005 has LTRIM() and RTRIM() but no TRIM() function, so I wrote a simple UDF for SQL Server 2000 and 2005 that trims both sides. Video included.
IIF and CASE: Control Return Types and Use Typed NULL Values
IIF and CASE choose result values, but their branches also define a shared return type. I make that type explicit when mixed inputs could surprise the reader. Typed NULL values help describe the same output contract.
SQL SERVER – Query to Find Seed Values, Increment Values and Current Identity Column value of the table
A query to list every identity column with its seed, increment and current value, plus what those numbers mean and how to reseed a table safely.







