This puzzle assigns a nine digit number to a varchar(8) variable and gets an asterisk instead of a number. The answer is an implicit conversion that does not fit. The post tests which data types behave this way, which ones raise an error, and how to size the variable.
SQL SERVER – Puzzle – How Does Table Qualifier Work in INSERT Statement?
You can use a table alias in SELECT just fine, but how does a Table Qualifier work in the column list of an INSERT statement? Try this short puzzle.
SQL SERVER – Puzzle – Get the First Name From Full Name Without CHARINDEX
This First Name From Full Name puzzle excludes CHARINDEX and SUBSTRING. It came from a customer query during a performance health check.
SQL SERVER – Puzzle – Strange Behavior With Extra Comma in Create Table Statement
My favorite icebreaker puzzle: a strange behavior with an extra comma in CREATE TABLE statement. Why does SQL Server accept it for temp and regular tables?
SQL SERVER – Puzzle – Solution – Why Does UNION ALL Work but UNION Produces Error?
Here is the answer to my puzzle: why does UNION ALL work but UNION produces an error with a TEXT column? It comes down to how UNION removes duplicates.
SQL SERVER – Puzzle – Why Does UNION ALL Work but UNION Produces Error?
A puzzle with TEXT columns: UNION ALL works fine, but UNION produces error. Can you tell why? The hint is in how UNION removes duplicates.
SQL SERVER – Puzzle – Brain Teaser – Changing Data Type is Changing the Default Value
Changing the Default Value is the question behind this data-type puzzle. I keep the expression, data type and nullability separate.




