When this blog reached 300 posts, a reader emailed me an error message picture that made me laugh out loud. Funny SQL Server error messages are real, and each one hides a useful lesson once you stop laughing.

Why Funny SQL Server Error Messages Are Worth Reading
Error messages are written by engineers who have to fit a hard problem into one sentence. Sometimes that sentence comes out sounding like a movie line. The trick is to enjoy the line and then read it properly, because it almost always tells you exactly what went wrong.
Chosen as the Deadlock Victim
Msg 1205 says your transaction was deadlocked with another process and has been chosen as the deadlock victim, and politely asks you to rerun the transaction. It sounds like a reality show elimination.
What it means: two sessions were each waiting for something the other one held. Neither could move, so SQL Server picked one to cancel. The fix is to touch tables in the same order everywhere, keep transactions short, and let the application retry once.
The Query Processor Ran Out of Internal Resources
Msg 8623 says the query processor ran out of internal resources and could not produce a query plan. I picture a waiter who fainted while reading your order.
What it means: the query is too complex to plan. The usual cause is an IN list with many thousands of values, or a very long chain of joins or unions. Load the values into a temporary table and join to it instead.
Null Value Is Eliminated by an Aggregate
Warning 8153 says a null value is eliminated by an aggregate or other SET operation. It sounds like a spy movie, but it is quietly important.
SELECT AVG(Score) AS AvgIgnoringNulls,
AVG(COALESCE(Score, 0)) AS AvgNullsAsZero
FROM (VALUES (10), (NULL), (20)) AS t(Score);The first column returns 15, because AVG skips the NULL. The second returns 10, because it counts the NULL as zero. Both are correct. Only one is the answer your report wants, so decide on purpose.
String or Binary Data Would Be Truncated
For years, Msg 8152 told you a value was too long for its column, and then refused to say which column. It was a mystery novel with the last page torn out.
SQL Server 2019 added Msg 2628, which names the table, the column and the value that did not fit. It is on by default at database compatibility level 150 and above. Few error message changes have made DBAs this happy.
Reading Funny SQL Server Error Messages Without Panic
Read the message number, the severity and the line number first. Search the number, not your own summary of the text. Funny SQL Server error messages stop being scary the moment you read them slowly, all the way to the end.
Related reading on this blog: Reading SQL Server Error Messages Carefully and Writing Clear Error Messages in Procedures.
Laugh first, then read the whole message. The fix is usually in the sentence you skipped.
An error message is not an insult, it’s the most honest note SQL Server will ever write you.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.




