User-defined functions are one of the more welcome new features in SQL Server 2000. 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 allow you to include them inline in your queries just like a table or view. User-defined functions allow you to create reusable routines that can help to make your SQL code more straightforward and efficient. In this chapter, you have seen how to create and modify scalar functions and inline and multistatement table-valued functions and how they can be invoked and used within your queries. If you are considering converting any existing stored procedures to functions, the guidelines and example presented should offer some help.