Chapter 37. Strategies for unraveling tangled code

Jennifer McCown

When you inherit an application or a database, you often become the proud owner of overly complex, poorly performing T-SQL code. These queries rarely come equipped with meaningful documentation or with system architects who are willing and able to explain the code.

This chapter covers several methods to make sense of the mess. The overall approach is to organize, break down, and then streamline the code to identify and remove some of the nastier coding mistakes and inefficiencies.

The sample database is a small model of a vending machine business, called VendCo. Tables in the VendUnit schema store data about each vending machine (including model and location information) and ...

Get SQL Server MVP Deep Dives, Volume 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.