This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting of an open wooden puzzle box with a small vermilion paper boat inside.

Asterisk Instead of a Number: A SQL Server Puzzle

March 6, 2018
Pinal Dave
SQL Puzzle
SQL Datatype, SQL Scripts, SQL Stored Procedure, SQL Variable

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.

Read More
Incorrect alias in INSERT statement.

SQL SERVER – Puzzle – How Does Table Qualifier Work in INSERT Statement?

March 2, 2018
Pinal Dave
SQL Puzzle
SQL Scripts, SQL Server, SQL Table Operation

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.

Read More
Four bead strands show distinct leading beads in widened receiving recesses.

SQL SERVER – Puzzle – Get the First Name From Full Name Without CHARINDEX

February 21, 2018
Pinal Dave
SQL Puzzle
SQL Function, SQL Scripts, SQL Server, SQL String

This First Name From Full Name puzzle excludes CHARINDEX and SUBSTRING. It came from a customer query during a performance health check.

Read More
Error dialog of query execution.

SQL SERVER – Puzzle – Strange Behavior With Extra Comma in Create Table Statement

January 30, 2018
Pinal Dave
SQL Puzzle
SQL Command, SQL Scripts, SQL Server, SQL Table Operation

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?

Read More
SQL Server UNION vs UNION ALL Error.

SQL SERVER – Puzzle – Solution – Why Does UNION ALL Work but UNION Produces Error?

January 8, 2018
Pinal Dave
SQL Puzzle
SQL Scripts, SQL Server, SQL Union clause

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.

Read More
SQL Server UNION vs UNION ALL Error.

SQL SERVER – Puzzle – Why Does UNION ALL Work but UNION Produces Error?

January 4, 2018
Pinal Dave
SQL Puzzle
SQL Scripts, SQL Server, SQL Union clause

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.

Read More
A clay blank and two differently shaped molds sit beside a fitted sample.

SQL SERVER – Puzzle – Brain Teaser – Changing Data Type is Changing the Default Value

December 8, 2017
Pinal Dave
SQL Puzzle
SQL Column, SQL Datatype, SQL NULL, SQL Server

Changing the Default Value is the question behind this data-type puzzle. I keep the expression, data type and nullability separate.

Read More
Previous 1 2 3 4 5 6 7 … 22 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com