Create stored functions
Functions are reusable queries or query parts. Real-Time Intelligence supports two kinds of functions:
Built-in functions, which are hard-coded functions that can't be modified by users.
User-defined functions, which are divided into two types:
- Stored functions: are user-defined functions that are stored and managed database schema entities (such as tables). For more information on how to create and manage stored functions, see Stored functions management overview.
- Query-defined functions: are user-defined functions that are defined and used within the scope of a single query. The definition of such functions is done through a let statement. For more information on how to create query-defined functions, see Create a user defined function.
In this article, you learn how to create or alter an existing stored function using the .create-or-alter
function
.
For more information on the .create-or-alter
function
command, see .create-or-alter function
Prerequisites
- A workspace with a Microsoft Fabric-enabled capacity
- A KQL database with editing permissions
Functions
This feature allows you to create or alter an existing function using the .create-or-alter
function
command, which stores it in the database metadata. If the function with the provided functionName doesn't exist in the database metadata, the command creates a new function. Otherwise, the named function is changed.
Browse to your KQL database, and select New > Function. The
.create-or-alter
command is automatically populated in the Explore your data window.Enter the function name and query parameters of your function instead of the placeholder text, and then select Run.
Stored functions appear under Functions in the Explorer pane.
In the Explore your data window, run a query to check that you have successfully created or altered your function.