The Ultimate Excuse Database

Comments 3

Share to social media

Editor’s Note
This article, describing Phil’s “ultimate excuse generator”, was first published in December 2005. The plug-and-play version of the tool was recently removed from the Red-Gate.com website, but I couldn’t stand by and let it disappear for good, so it’s now hosted on Simple-Talk. This seemed like a good enough reason to give the article a polish and re-publish it. If you missed it the first time, you’re in for a treat!
End Editor’s Note

Failed Project? Need an excuse fast?

Recently, I received a desperate plea for help from a Simple-Talk reader, who cited the following dilemma:

Phil,

The project I’m working on is about to go belly-up. Can you come up with some plausible reasons for the failure that would not reflect poorly on my work?

Thanks in advance, Dave

This, of course, is not one of the classic SQL problems addressed in textbooks. It is quite difficult to give a solution that conforms to the SQL-92 standard.

There are many ways of approaching the problem, and I’ll go over one solution – my challenge to other readers to se if they can come up with something better! If you want to test drive the excuse generator now, simply click on the link below:

[Sadly the excuse generator finally broke down. We have no excuse for this.]

The versatility of T-SQL functions

Whatever its shortcomings my solution serves as a good way of highlighting the versatility of T-SQL functions. You just need to create a SQL Server database and into it load a few simple functions. These functions will provide facile and convincing arguments as to why a project has failed, thereby creating a smokescreen that will safely conceal the real culprits.

A T-SQL function for picking random data

We start with a function that will pick a random phrase or excuse from a list. This is a modification of a technique I use to populate a database with plausible data for checking indexing strategies, and for testing a fully populated database under load.

The first thing to remember about functions is that the use of the rand() operator is forbidden. This is for a very good reason: its use renders the function non-deterministic. We cheat by disguising it as a view.

NOTE:
This is not guaranteed to work in subsequent releases of SQL Server – though it works just fine on SQL 2000 and 2005.

Now we provide the key function that picks a phrase from a list. This, by itself, is sufficient for simple tasks such as giving a weather forecast, doing a psychic reading, or selecting an appropriate IT architecture:

Examples of use include this weather forecaster which seems to be at least as accurate as the Met Office or the National Weather Service:

Picking your excuse

Now we build this function into a collection of word banks and phrase banks that we can then use to provide the basis of an IT strategy document; in this case, plausible reasons for the failure of a project.

NOTE:
In order to control the length of the listing, some of the inputs, contraints etc were omitted. The full source code can be obtained from the code download bundle.

Random excuses become plausible waffle

Now all we need to do is have a function that substitutes phrases in the right place. Normally, this would have a mundane use such as coming up with customer addresses for dummy data, but here we give it a more dignified purpose:

So, invoking:

…repeatedly will supply as many plausible reasons as you wish.

A versatile bullshit generator

However, you will notice a certain repetitive sameness about the previous solution. A more subtle approach is to randomize the sentence structure.

So, at the click of a mouse we generate random, dignified excuses that spread the blame evenly and safely, and away from any particular individual.

Start generating excuses…

As with all code or prose, some editing and cleanup of the output is required, but it is easy to see how versatile and useful this tool can be.

The full source code is available from the CODE DOWNLOAD link (in the box below the star ratings at the top of this page).

Enjoy!