In this post, we will check one user-defined function in SQL Server 2008.
You can also check some useful posts like:
User-defined functions can be created by users.
Below is a function that will take one input parameter and also returns one integer value.
Here it will take the empid and returns the contact number for the particular empid.
Create function EmployeeContact(@Empid int)
declare @result int
select @result=EmloyeeDetail.ContactNo from EmloyeeDetail where employee detail.Empid=@Empid
You can call the function like below
Select dbo.EmployeeContact(1) as ContactNumber from EmloyeeDetail
This will return the contact number of empid =1.
Here are some points to remember about functions:
– The function returns only a single value.
– The function accepts only input parameters.
– The function can not be used to Insert, Update, Delete data in database table.
– The function doesn’t support Exception handling.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.
You May Also like the Following SharePoint Online Tutorials: