Written By:- Isha Malhotra
Our Website:-Tech Altum
Type of User defined function in SQL Server
Our Website:-Tech Altum
User
defined function in SQL Server
Functions
are basically a separate area where we write our code and according to the need
we can call it.
SQL
Server allows you to create functions, as we create functions in programming
language. We can pass parameter to function and function can also return the
output. These are fast as these are precompiled.
Consider the following table prod_rep
as an example:-
Figure
1
Type of User defined function in SQL Server
According
to its return type we categorized the user defined function into following two
parts
Scalar function
In
scalar function, we can return a single value from the function.
For example:-
Suppose
I have to create function which will return the dept according to id.







