Chapter 10. User-Defined Functions

Great designers have a relentless desire to create—to make things.

Steve McConnell[1]

[1] McConnell, Steve. After the Gold Rush. Redmond, WA:Microsoft Press, 1999.

A UDF is a special type of subroutine that can be used in expressions. UDFs are very much like Transact-SQL's built-in functions—you pass them the parameters they require and they return a result of some type.

UDFs come in three varieties: scalar functions, multistatement table-valued functions, and inline table-valued functions. A scalar function is one that returns a single value. It can be used in expressions just like regular system functions. A multistatement table-valued function (what I'll usually just refer to as a table-valued function ...

Get Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The 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.