Building and Working with User-Defined Functions
SQL 2000 introduced user-defined functions. User-defined functions add power and flexibility that was previously unavailable with views and stored procedures. Three types of user-defined functions exist: scalar, inline table-valued, and multistatement table-valued. The sections that follow cover each of these types of user-defined functions in detail.
Scalar Functions
Scalar functions return a single value of the type defined in the RETURNS clause. The body of the function is between a BEGIN and an END block. Scalar functions can return any data type except text, ntext, image, cursor, or timestamp. Here's an example of a scalar function:
CREATE FUNCTION dbo.FullName (@FirstName nVarChar(10), @LastName ...
Get Alison Balter's Mastering Access 2002 Enterprise Development 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.