When you're working with SQL Server, understanding the properties of your functions can be really helpful for performance optimization. The following SQL query helps you identify your scalar user-defined functions (UDFs) and check if they are "inlineable."
Check if Your SQL Scalar Functions are Inlineable
This query provides insight into whether a scalar UDF can be inlined, which can significantly improve query performance by essentially expanding the function's logic directly into the calling query, avoiding the overhead of a function call.
SELECT OBJECT_NAME(m.object_id) AS [Function Name] ,is_inlineable ,inline_type FROM sys.sql_modules AS m WITH (NOLOCK) LEFT OUTER JOIN sys.dm_exec_function_stats AS efs WITH (NOLOCK) ON m.object_id = efs.object_id WHERE efs.type_desc = N'SQL_SCALAR_FUNCTION' OPTION (RECOMPILE);
For more detailed information on scalar UDF inlining and related system views, you can refer to the official Microsoft documentation: