SQL Server › Views
What is a schema bound view, and what specific benefit does the WITH SCHEMABINDING option provide?
IntermediateAnswer
A schema bound view is created using the WITH SCHEMABINDING option, which prevents the underlying tables referenced by the view from being altered or dropped in a way that would break the view's definition, providing an extra layer of protection and also being a requirement if you want to create an indexed view.
CREATE VIEW dbo.ActiveOrders
WITH SCHEMABINDING
AS
SELECT OrderId, CustomerId, Amount
FROM dbo.Orders
WHERE Status = 'Active';Real-world example A team creates a schema bound view over their orders table, preventing a well meaning developer from accidentally dropping a column that the view actually depends on without first being warned by SQL Server.