Want to preserve leading zero values when you paste SSMS results into Excel? The fix is in Excel: format the cells as Text first, and the zeros stay.
Why CAST to a Short VARCHAR Returns a Star Instead of an Error
Understand why a short VARCHAR returns a star for an integer, compare Unicode errors and string truncation, and size conversions safely.
SQL SERVER – Difference Between ORIGINAL_LOGIN() and SUSER_SNAME()
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.
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.






