Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   ASP (http://siteownersforums.com/forumdisplay.php?f=11)
-   -   What is an In Line Table User Defined Function in SQL Server? (http://siteownersforums.com/showthread.php?t=181552)

chinmay.sahoo 12-12-2016 11:47 PM

What is an In Line Table User Defined Function in SQL Server?
 
• Returns a row set of the SQL Server table data type.

• Takes the structure of the row set from the SELECT statement itself.

• It is an exceptional alternative to a view

• Can pass parameters and in essence provide us with a parameterized, non-updateable view



Fat Cutter | Hot Shaper | Asthijivak | Roop Amrit |

sonvi.belani 03-16-2017 12:28 AM

Hi,

User Defined Functions play an important role in SQL Server. User Defined functions can be used to perform a complex logic, can accept parameters and return data. Many a times we have to write complex logic which cannot be written using a single query. In such scenarios, UDFs play an important role. For example, we can call user defined function in a where clause or use a user defined function in a JOIN [Where UDF returns a result set].

SQL Server supports two types of User Defined Functions as mentioned below –

- Scalar Functions – The function which returns a Scalar/Single value.

- Table Valued Functions – The function which returns a row set of SQL server Table datatype. Table Valued Functions can be written as –
Inline Table

Multi-statement Table
We will explore these functions today. I am using SQL Server 2012 for this demonstration, although you can use SQL Server 2005, 2008, 2008 R2 as well.

I have preconfigured Northwind database on my SQL Server instance. We will be using the following tables for creating different User Defined Functions –
1) Customers
2) Employees
3) Orders
4) Order Details
5) Products

Thanks


All times are GMT -7. The time now is 12:06 PM.


Powered by vBulletin Copyright © 2013 vBulletin Solutions, Inc.