Inside Microsoft® SQL Server® 2008: T-SQL Programming
by Dejan Sarka Itzik Ben-Gan Greg Low, Roger Wolter, Ed Katibah, and Isaac Kunen
Chapter 2. User-Defined Functions
Itzik Ben-Gan and Dejan Sarka
User-defined functions (UDFs) are routines that perform calculations/computations and return a value—scalar (singular) or a table. Microsoft SQL Server 2008 allows you to develop UDFs using either T-SQL or a .NET language of your choice based on the common language runtime (CLR) integration in the product. You can incorporate UDFs in queries, computed columns, and constraints.
This chapter explores the types of UDFs that are supported by SQL Server: scalar-valued UDFs, which return a single value, and table-valued UDFs (inline and multiple-statement), which return a table. I’ll provide sample code for CLR UDFs in both C# and Microsoft Visual Basic.
Most of the .NET routines in this book ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access