One of the senior programmers on Steve's team is responsible for approving requests by their clients to add functionality to their project. Unfortunately, he's not very strong at estimating the technical challenges of the request or determining who on the team has the time to implement the requirements.

Given that, no one was surprised that he agreed to add a last-minute feature to email customers and give them a "happy birthday" coupon. The real surprise came when he learned that he'd have to actually implement the change. You see, as it turns out, programming wasn't this programmer's strong point either ...

SELECT CustomerId, EmailAddress
  FROM Customers
 WHERE Birthdate = Today() + 1

He showed Steve the above code, unsure of why it didn't return any customers. Steve explained that his query will only find customers who have not been born yet, so he went back to the drawing board ...

SELECT CustomerId, EmailAddress
  FROM Customers
 WHERE DATEPART(day, Birthdate) = DATEPART(day, Today() + 1)
   AND DATEPART(month, Birthdate) = DATEPART(month, Today() + 1)

Steve looked over the code and was impressed: this time the query only ignores those born on the 29th in a non-leap year. His coworker went back and forth between the drawing board and Steve a few more times, until he finally gave up and told the clients that implementing such a feature was technically not feasible.

(Update: Fixed code typo)

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!