Wednesday, January 5, 2011

Schema Binding in SQL server

Schema Binding : Creating a view with the SCHEMABINDING option locks the tables being referred by the view and prevents any changes that may change the table schema. Notice two important points while creating a view with SCHEMABINDING OPTION:1. The objects should be referred to by their owner names (two part name - [ownername.objectname] ).2. SELECT * is not permitted. We see that using below scripts.create table schema_binding_table(id int,msg varchar(10))insert into schema_binding_table values(1,'msg1'),(2,'msg2'),(3,'msg3')select * from schema_binding_tableid...