Yesterday's anti-pattern (nested views) was part one of the "Do Repeat Yourself [Sometimes]" mini-series. Today, I'd like to get into part two of the series: user-defined functions. When Microsoft introduced user-defined functions in SQL Server 2000, it was an object-oriented developer's dream come true. It showed that Microsoft wanted to make true encapsulation---and not just…