What is the difference between ORIGINAL_LOGIN() and SUSER_SNAME()? A quick script with context switching shows when the two return different logins.
SQL SERVER – Answer – How to Convert Hex to Decimal or INT
Readers sent great answers on how to convert Hex to Decimal or INT in SQL Server. Here are their solutions, with due credit, using 0x00000100 as the example.
DATEDIFF Counts Boundaries, Not Time: Getting Durations Right
A report can say one year of service after a single day. Here is why DATEDIFF does that, and what to use instead.
SQL SERVER – Validating Spatial Object as NULL using IsNULL
How do spatial functions handle NULL? I show two ways of validating a spatial object as NULL: the IsNULL method, which returns 0 or NULL, and IsValidDetailed.
SQL SERVER – Introduction to Function SIGN
The SIGN function returns 1, -1 or 0 depending on whether a value is positive, negative or zero. A simple example with INT and DECIMAL values.
SQL SERVER – Solution of Puzzle – Swap Value of Column Without Case Statement
Readers sent more than 50 answers to my swap puzzle. Here are 5 different ones that swap a column value without CASE statement, plus my own three.
XML modify(): Inserting, Replacing and Deleting Nodes
The modify() method edits XML in place, but a path that matches nothing changes nothing and says nothing. Here is how to stay in control.






