Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric Data Days Monthly is back. Join us on March 26th for two expert-led sessions on 1) Getting Started with Fabric IQ and 2) Mapping & Spacial Analytics in Fabric. Register now

Enable scalar functions in ctes and other sql objects

I recently came across that scalar functions are now available in sql end points for warehouses and lakehouses however you are unable to call them within CTEs and other sql objects , please make this feature available 

Status: Planned
Comments
akatesmith
Microsoft Employee
Status changed to: Need Clarification

Can you please clarify if this is something you want from DW or from the SQL Server capability? It should be available in SQL Server as it is supported in other versions of SQL. 

data_fab_weaver
New Member
Hi Thank you for your response ! My request is regarding the ability to call scalar functions within cte's in the sql end points of data objects within microsoft fabric. What I mean is that for example if I have a CTE : with cte1 as ( select [col1], dbo.sfunc([col2]) FROM [mytable] ) SELECT * FROM [cte1] This code will fail but if i do this : select [col1], dbo.sfunc([col2]) FROM [mytable] The code will run successfully. I want to be able to use my scalar functions in a cte in my sql code
SMATIN
Microsoft Employee
Status changed to: Need Clarification

Couple of digressions:

1. We are working on allowing scalar UDFs which are pure expression based (aka don't reference table/view inside) to work with CTEs in a user query.

2. In case you need similar capability for data-access based scalar UDFs, please vote and comment on Enable data-access based scalar functions to be us... - Microsoft Fabric Community

 

Clarification needed:

1. Can you clarify on which other sql objects you refer to? 

SMATIN
Microsoft Employee
Status changed to: Planned