what is Schemabinding View.

 Posted by Manishsoni on 4/19/2011 | Category: Sql Server Interview questions | Views: 4908 | Points: 40
Answer:

Schemabinding View Restirct you to made any change in tables you used in your View.
Example:

Suppose I have an table Employee(EmpID,EmpName, DOJ,Managerid,DepartID)

Now am Creating a view

Create View EmployeeDetails
with Schemabinding
as
Select EmPid, EmpName,DOj,ManagerId,DepartID from Employee



after it just try to execute delete table and alter table and delete column of employee table.

Sql server will not allow to change table schema. Because you are having Schema dependency.First you need to delete View then only database will allow to modify table.


If you are using Normal View. Sytem will Allow you to delete or modify table but when you run your View next time it will display error.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Merryj on: 4/28/2011 | Points: 10
Oho Very Lengthy answer.

Login to post response

More Interview Questions by Manishsoni