What is the purpose of the WITH SCHEMABINDING clause and where can it be used?
What is the purpose of the WITH SCHEMABINDING clause and where can it be used?
WITH SCHEMABINDING can be used in Views and T-SQL Functions, but not in Stored Procedures.
Objects that are schema bound can have their definition changed, but objects that are referenced by schema bound objects cannot have their definition changed.
Schema binding effectively states that the meta-data which is created at object creation time can then be relied upon to be accurate at all times, and use of sp_refreshsqlmodule is not necessary.
Schema binding can also significantly increase the performance of user defined functions in SQL Server 2005 and above. However, caution should be applied, as this is definitely not always the case.
Schema binding is a way of ensuring that the objects referenced within a function or view, do not change their definition in any way that would break the binded object. Objects are prevented from changing their defintions while they are schema bound.
4 People are following this question.