Article 3MVCT CodeSOD: All the Things!

CodeSOD: All the Things!

by
Remy Porter
from The Daily WTF on (#3MVCT)

Yasmin needed to fetch some data from a database for a report. Specifically, she needed to get all the order data. All of it. No matter how much there was.

The required query might be long running, but it wouldn't be complicated. By policy, every query needed to be implemented as a stored procedure. Yasmin, being a smart prograammer, decided to check and see if anybody had already implemented a stored procedure which did what she needed. She found one called GetAllOrders. Perfect! She tested it in her report.

Yasmin expected 250,000 rows. She got 10.

She checked the implementation.

CREATE PROCEDURE initech.GetAllOrdersASBEGIN SELECT TOP 10 orderId, orderNo, orderCode, " FROM initech.orders INNER JOIN"END

In the original developer's defense, at one point, when the company was very young, that might have returned all of the orders. And no, I didn't elide the ORDER BY. There wasn't one.

proget-icon.png [Advertisement] ProGet can centralize your organization's software applications and components to provide uniform access to developers and servers. Check it out! TheDailyWtf?d=yIl2AUoC8zABFuBHL31PXo
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments