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 a brass scale with two dates on one pan and a tall heap of pears with a vermilion pomegranate on the other

Adding Two Dates in SQL Server: Why the Year Is 2126

October 17, 2017
Pinal Dave
SQL Puzzle
SQL DateTime, SQL Operator, SQL Scripts, SQL Server

Adding two dates in SQL Server does not raise an error. It returns a date in the year 2126. This puzzle explains how datetime counts days from 1900, why the plus sign accepts a second date, and what to write instead.

Read More
A compact folded fitting is compared with a larger assembly beside a constrained guide channel.

SQL SERVER – Puzzle – Shortest Code to Produce the Number 1000000000 (One Billion)

October 3, 2017
Pinal Dave
SQL Puzzle
SQL Function, SQL Scripts, SQL Server

This shortest code puzzle asks for 1000000000 without writing that literal or using arithmetic operators. The earlier zero puzzle brought roughly 700 valid answers.

Read More
SQL Server query with 2 tables.

SQL SERVER – Select Unique Data From a Column Exist in Two Different Table

September 26, 2017
Pinal Dave
SQL Puzzle
SQL Scripts, SQL Server, SQL Union clause

A reader wanted to Select Unique Data from a column in two tables, keeping only values found in just one of them. Here is the query that does it.

Read More
A compact fitting sits within two stops while a longer candidate remains outside the allowed gap.

SQL SERVER – Puzzle – Write a Shortest Code to Produce Zero

August 24, 2017
Pinal Dave
SQL Puzzle
SQL Function, SQL Scripts, SQL Server

This Zero puzzle asks for the shortest SQL Server code within three restrictions. I want the exact code and character count.

Read More
SQL SERVER - Puzzle - Incorrect Results with Decimal

SQL SERVER – Puzzle – Incorrect Results with Decimal

June 28, 2017
Pinal Dave
SQL Puzzle
SQL Datatype, SQL Function, SQL Scripts, SQL Server

A new puzzle: a simple table with price and discount returns Incorrect Results with DECIMAL. Can you work out why without running the code in SSMS?

Read More
SQL SERVER - Why We have Audit Trace in DATA Folder? What are These Files?

SQL SERVER – Why We have Audit Trace in DATA Folder? What are These Files?

May 15, 2017
Pinal Dave
SQL Puzzle
File format, SQL Audit, SQL Scripts, SQL Server

The DATA drive filled up with thousands of audittrace .trc files. Here is why SQL Server writes audit trace files there and how to stop them.

Read More
SQL Server sp_spaceused window.

SQL SERVER – Puzzle – Why does sp_spaceused Show No Values?

February 8, 2017
Pinal Dave
SQL Puzzle
SPARSE Columns, SQL Scripts, SQL Server

Why does sp_spaceused show no values for a table that clearly has rows? It stumped me for 10 minutes. Here is the puzzle, try it before reading on.

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

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