Home > Humor, Technology > Be careful of what you ask for… sometimes you might get it

Be careful of what you ask for… sometimes you might get it

This is an example of why sometimes you should be careful of what you ask for when it comes to developers. You will get exactly what you asked for.

While working through a query that had been built by a third-party organization (whose name is being withheld to prevent snickering and embarrassment) when I noticed that some of the columns in the query were returning NULL. Ok, this happens, not a big deal. It just means the data for that piece of data is missing. Not unheard of and fully expected in this case. Usually to combat this, you use the ISNULL function to return a default value if the column contains NULL. So I made the appropriate changes and re-run the query.

What in the world? The NULLS continued to show. Needless to say, it required some investigation. The “problem” was buried in a custom SQL function that was designed to take a string, break it down on a delimiter, then return the specified element. There is was, in a case statement…. the else clause… where it returned ‘NULL’ … the literal. The literal text value ‘NULL’ … and not the NULL value as expected. I’m sure someone told them that if the element isn’t found, to return NULL. So that’s exactly what they did. It’s probably a good thing we didn’t ask them to return a blank value. We’d have gotten ‘A BLANK VALUE’.

Categories: Humor, Technology
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: