What is Function? A user-defined function is a Transact- SQL or common language runtime (CLR) routine that accepts parameters, performs an action, such as a complex calculation, and returns the result of that action as a value. The return value can either be a scalar (single) value or a table. Types of User Defined Function Scalar User Defined Function Table User Defined Function
Scalar User Defined Function The simplest database object for which you can make use of SQL Script are Scalar User- Defined Functions (Scalar UDFs) Scalar UDFs allow you to the define functions which take a number of input parameters and return scalar values. Only expressions are allowed in the body of the UDF, so no table operations, CE functions or array operations.
Table User Defined Function Table User Define Function always returns a table and its parameter may also be off table type. Table UDFs are read-only user-defined functions which accept multiple input parameters and return exactly one results table. SQL Script is the only language which is supported for table UDFs. Since these functions are ready-only, only read-only statements can be used within the function. So, you may not use statements like INSERT, UPDATE or DELETE. Also, any procedure calls within the function must also be read-only. Currently, you can only create these functions in the catalog via the SQL Editor.
For More Details Visit: http://kabilsapworld.blogspot.com/ THANK YOU!