A quick script to split one column into two with LEFT, RIGHT and CHARINDEX, plus what to check when a value has no comma or has extra spaces.
SQL SERVER – SQL SERVER – UDF – Get the Day of the Week Function – Part 2
Mihir Popat improved my Day of the Week Function with @@DATEFIRST, so Sunday does not have to be the first day of the week. Here is his UDF.
SQL SERVER – PIVOT Table Example
A PIVOT Table example on AdventureWorks that counts addresses by state, plus why UNPIVOT cannot always give you back the original rows.
STRING_ESCAPE JSON Text: Escaping Is Not Serialization
STRING_ESCAPE JSON text is still text that belongs inside a JSON string. This example compares quotations, backslashes and a newline with complete FOR JSON PATH objects.
Least Privilege for Application Logins
Design least privilege for SQL Server application logins with roles, schema permissions, and stored procedures, then test real workflows.
Bit Shifts: Move Bits Without Rotating Them
Bit shifts fill vacant positions with zero and discard bits past the type width. Compare tinyint with int and a negative shift direction.
Untested Backup: The Joke That Ends With a Resignation Letter
An untested backup is the darkest joke in the DBA world. Here’s how the story usually ends, and the simple restore drill that keeps you out of it.







