This statement is used to register or define a user-defined function or function template with an application server.
There are five different types of functions that can be created using this statement. Each of these is described separately.
The function is written in a programming language and returns a scalar value. The external executable is registered in the database along with various attributes of the function. See CREATE FUNCTION (External Scalar).
The function is written in a programming language and returns a complete table. The external executable is registered in the database along with various attributes of the function. See CREATE FUNCTION (External Table).
A user-defined OLE DB external table function is registered in the database to access data from an OLE DB provider. See CREATE FUNCTION (OLE DB External Table).
A source function is implemented by invoking another function (either built-in, external, SQL, or source) that is already registered in the database. See CREATE FUNCTION (Source or Template).
It is possible to create a partial function, called a function template, that defines what types of values are to be returned but contains no executable code. The user maps it to a data source function within a federated system, so that the data source function can be invoked from a federated database. A function template can be registered only with an application server that is designated as a federated server.
The function body is written in SQL and defined together with the registration in the database. It returns a scalar value, a table, or a single row. See CREATE FUNCTION (SQL Scalar, Table or Row).