Scalar UDFs
Scalar UDFs return a single (scalar) value. They can be specified where scalar expressions are allowed–for example, in a query, constraint, computed column, and so on. Scalar UDFs have several syntactical requirements. Scalar UDFs:
Must have a BEGIN/END block defining their body.
Must be schema qualified when invoked (unless invoked as stored procedures with EXEC, as in EXEC myFunction 3, 4).
Do not allow omitting optional parameters (ones that have default values) when invoked; rather, you must at least specify the DEFAULT keyword for those.
The following sections explore both T-SQL and CLR UDFs.
T-SQL Scalar UDFs
T-SQL UDFs are typically faster than CLR UDFs when the main cost of their activity pertains to set-based data manipulation, ...
Get Inside Microsoft® SQL Server™ 2005 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.