Thursday, April 14, 2016

Creating a Scalar-valued function in SQL Server 2014

First of all what is a Scalar-valued function?

A scalar function in SQL Server is similar to the generally accepted meaning function, a function is defined by the variables (parameters) with some operation on them and the resulting value is the return value of the function.

  • If x and y are the variables(parameters) than the
    function(x,y)=x+y defines a scalar function that returns a value which is the sum of x and y.
  • The scalar function is not limited to just two parameters and can have more.

Where do you find the Scalar-valued function in the Object Explorer?

You will find the Scalar-valued function node in all the databases in the Programmability node as shown here for AdventureWorks2012 database.

Sway5_01

How do you create a Scalar-Valued Function in SQL Server Management Studio?

Watch this Swaytorial.
https://docs.com/jayaram-krishnaswamy/9721/creating-a-scalar-valued-function-in-sql-server