• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Designing SQL Server Stored P... > Building and Working with User-Defin...

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:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint