Schema binding

  • Hi,

    I am learning about indexing a view and I understood I have to create it with SCHEMA BINDING.

    I red about it, but it is still not clear to me: what exactly is this "SCHEMA BINDING" and why is it necessary- it offers me some facilities  or is just mandatory and I have to take it like it is?


    Daniela

  • SCHEMABINDING:

    Binds the view to the schema. When SCHEMABINDING is specified, the select_statement must include the two-part names (owner.object) of tables, views, or user-defined functions referenced.

    Views or tables participating in a view created with the schema binding clause cannot be dropped unless that view is dropped or changed so that it no longer has schema binding. Otherwise, SQL Server raises an error. In addition, ALTER TABLE statements on tables that participate in views having schema binding will fail if these statements affect the view definition.

    This is a really nice bonus on referential integrity.

    *

    I've been learnt in a sql class that indexed views can only be usefull performance wise on rather static tables.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply