Duration: 15:50 min
Summary: Few videos back, we talked about functions. We discussed the system functions and looked at examples. Today, we need to talk about creating our own functions. There are two types of functions: table-valued functions (return a table) and scalar-valued functions (return a single value). I am going to discuss scalar-valued functions today. We will use as an example a function that is part of the AdventureWorks 2012 database. The function name is dbo.ufnGetStock(). It takes the ProductID as a parameter and returns the sum of the quantity. After discussing the function and its structure, We will experiment with couple of ways of calling the function. Next time, we will talk about table-valued functions.