User Defined Functions in SQLServer

<< Click to Display Table of Contents >>

Navigation:  Other Topics > Smart Access 1996-2006 > Mar-2003 >

User Defined Functions in SQLServer

Russell Sinclair


In this month’s installment of “Working T-SQL,” Russell Sinclair

introduces SQL Server user-defined functions and shows

how you can put these new SQL Server objects to work in

your Access application.


STARTING with SQL Server 2000, Microsoft

introduced us to a brand-new object designed to

address some of the deficiencies in views and stored

procedures—the user-defined function. This new type of

object is designed to allow you to return a result set or a

single value based on zero or more parameter values.

User-defined functions can be similar to views or stored

procedures, but the functionality they provide is slightly

different for both cases.


Types of user-defined functions


There are three different types of user-defined functions,

and each one provides different functionality from

the others:

In-line functions: This type of function is designed to

return the result from a single select query. There’s

only one statement in this type of function, and that

statement is a SQL SELECT statement. No other

action can be performed within this type of function.

Scalar functions: This type of function is designed to

return a single value to the caller. There can be any

code within this function that evaluates parameters ....


read more in the pdf article User-Defined Functions