How to call a SQL Server user defined function? The SQL syntax to call a function is different from the call to a stored procedure. Use SQL Server function the same way you select data from a table.
How to call a SQL Server function?
A SQL Server user-defined function is usually returning data, it can an empty result set, one line or multiple columns. For example, let’s call the function from this article on how to create a SQL Server function. The function displays the name of a customer based on the customer number.
With this second call example, we can also rename the result column to personalize the output.
SELECT dbo.ufnDisplayCustomers(1) AS [Customer Name];