Schema binding an object such as a user-defined function (UDF) is considered good practice, as it prevents changes being done to any objects that it references that could inadvertently break the function.
You can schema bind a user-defined function at the time you create it, or you can alter later on.
Normally, you can check if a UDF is schema bound in SQL Server by viewing its definition. You can usually do this via the GUI by selecting “Script as Create” or similar.
You can also do it using T-SQL by selecting the definition
column of the sys.sql_modules
system catalog view.
But this will only work if the UDF isn’t encrypted.
However, there is another column in the sys.sql_modules
view that serves our purpose whether the UDF is encrypted or not: is_schema_bound
Continue reading →