Summary

User-defined functions in SQL Server 2008 allow you to create reusable routines that can help make your SQL code more straightforward and efficient.

In this chapter, you saw how to create and modify scalar functions and inline and multistatement table-valued functions and how to invoke and use them in queries. Scalar functions can be used to perform more complex operations than those provided by the built-in scalar functions. Table-valued functions provide a way to create what are essentially parameterized views, and you can include them inline in your queries, just as you would in a table or view.

With the introduction of CLR-based functions, SQL Server 2008 greatly increases the power and capabilities of user-defined functions, and ...

Get Microsoft® SQL Server 2008 R2 Unleashed 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.