Recently, while doing some data scrubbing for a customer I got an interesting error in SSMS with one of my CASE statements. The error received was:
None of the result expressions in a CASE specification can be NULL.
It was a long T-SQL script (and a long night) and could not understand the error message. After a couple minutes BinGling (Google +Bing) around the web, I still could not find the root cause, so I decided to comment out every single CASE statement and run one by one until I pinpointed the offending syntax.
To my surprise, the issue was very simple, yet undocumented. The T-SQL syntax I was writing was somewhat as follows:
CASE WHEN SerialNumber like â€˜X%â€™ THEN NULL
WHEN SerialNumber = â€˜0â€™ THEN NULL
WHEN SerialNumber = â€˜-â€˜ THEN ...
Content suppressed by ://URLFAN, for full article visit source