Skip to main content
Completed

Make scalar functions inlineable (SQL Server)

Related products:Software Factory
  • Marco Maat
  • Marius Korff
    Marius Korff

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. 

Did this topic help you find an answer to your question?

9 replies

Mark Jongeling
Administrator
Forum|alt.badge.img+23

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.


Mark Jongeling
Administrator
Forum|alt.badge.img+23
Updated idea status NewOpen

Mark Jongeling
Administrator
Forum|alt.badge.img+23
Updated idea statusOpenWorking on it!

Anne Buit
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 653 replies
  • October 22, 2021

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?


Jeroen van den Belt
Administrator
Forum|alt.badge.img+9
Updated idea statusWorking on it!Needs feedback

Jeroen van den Belt
Administrator
Forum|alt.badge.img+9

Hi @Andre te Raa,

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


Forum|alt.badge.img+14
  • Author
  • Captain
  • 111 replies
  • November 5, 2021

This will do! Thanks.


Jeroen van den Belt
Administrator
Forum|alt.badge.img+9
Updated idea statusNeeds feedbackNext release

Jeroen van den Belt
Administrator
Forum|alt.badge.img+9
Updated idea statusNext releaseCompleted

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings