Make scalar functions inlineable (SQL Server)

Related products: Software Factory

Starting with SQL Server 2019 it is possible to inline scalar functions. This feature improves the performance of queries that invoke scalar user defined functions (UDFs) (https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/scalar-udf-inlining?view=sql-server-ver15).

One of the requirements is that the function should not reference user defined types. Unfortunately (for SQL Server) the Software Factory creates function parameters based on the user defined type (user_defined_dttp).

If the parameters would be created using the SQL data type (dttp) a scalar function could become an inline scalar function.   

It’s possible to implement this with a tag and a dynamic control procedure (override the generated parameter value), but it could also be done by default. 

Quite a list of requirements but not too difficult. Since we also support the older versions of SQL Server, sometimes these new features cannot be implemented yet. In this case it can as we only have to support the Function to be created while abiding to the requirements. The rest SQL Server will take care of :wink:

I like the idea! Let's see how many other would love this.


Updated idea status NewOpen
Updated idea statusOpenWorking on it!

With the next release of the Thinkwise Platform, it will be possible to mark a function to use schemabinding

This will cause the datatypes to be the raw SQL data types instead of the user defined data types and will in turn satisfy this requirement for an UDF to be inlined.

Will this option be sufficient or are you looking for an option to inline UDF’s without using schemabinding?


Updated idea statusWorking on it!Needs feedback

Hi @Andre te Raa,

Can you let us know if the option Anne described is sufficient for your case?


This will do! Thanks.


Updated idea statusNeeds feedbackNext release

Updated idea statusNext releaseCompleted