|
Creates a user-defined function in SQL Server 2008 R2. A user-defined function is a Transact-SQL or common language runtime (CLR) routine that accepts parameters, performs an action, such as a complex calculation, and returns the result of that action as a value. The return value can either be a scalar (single) value or a table. Use this statement to create a reusable routine that can be used in these ways:
*
In Transact-SQL statements such as SELECT
*
In applications calling the function
*
In the definition of another user-defined function
*
To parameterize a view or improve the functionality of an indexed view
*
To define a column in a table
*
To define a CHECK constraint on a column
*
To replace a stored procedure
|