Returns just one value from T-SQL code you write yourself. Currently a preview feature for Fabric warehouses plus SQL analytics endpoints; queries against tables may call one only when inlining is possible.
Also called scalar UDF.
Read more: Microsoft Learn
In the Ultra Transcenders books
Each book explains Scalar user-defined function in context, with comparison tables and the common traps.
Terms in this definition
- RETURNS
States what a function gives back, as a type or a table, inside
CREATE FUNCTION. SQL functions can leave it out and have the type worked out from their body. - T-SQL
The dialect of SQL that Microsoft uses for Azure SQL and SQL Server. Azure Monitor logs are queried with KQL instead.
- Preview channel
The pipeline runtime channel for trying out new features and upcoming runtime changes. Production pipelines belong on
current. - Serverless
Compute tier for single Azure SQL databases that scales automatically, pauses when idle and charges by the second. It is offered in General Purpose and Hyperscale, not Business Critical, and reserved capacity does not apply.
Related terms
- Scalar UDF inlining
From compatibility level 150, intelligent query processing can replace an eligible scalar user-defined function with an equivalent expression or subquery inside the query that calls it. The optimiser can then cost it properly and consider a parallel plan.