What are all types of user-defined functions? - www.studyandupdates.com

Monday

What are all types of user-defined functions?

Q 22. What are all types of user-defined functions ?

Ans : User-Defined Functions allow people to define their own T-SQL functions that can accept 0 or more parameters and return a single scalar data value or a table data type.


Different Kinds of User-Defined Functions created are:-


1. Scalar User-Defined Function  - A Scalar user-defined function returns one of the scalar data types. Text, image, and timestamp data types are not supported. These are the type of user-defined functions that most developers are used to in other programming languages. You pass in 0 to many parameters and you get a return value.


2. Inline Table-Value User- Defined Function   - An Inline Table-Value userdefined function returns a table data type and is an exceptional alternative to a view as the user-defined function can pass parameters into a T-SQL select command and, in essence, provide us with a parameterized, non-updateable view of the underlying tables.



3. Multi-statement Table-Value User-Defined Function   - A Multi-Statement Table-Value user-defined function returns a table and is also an exceptional alternative to a view, as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement.







No comments:

Post a Comment

Popular Posts