Tutorial by Examples

CREATE VIEW dbo.PersonsView AS SELECT name, address FROM persons;
This query will drop the view - if it already exists - and create a new one. IF OBJECT_ID('dbo.PersonsView', 'V') IS NOT NULL DROP VIEW dbo.PersonsView GO CREATE VIEW dbo.PersonsView AS SELECT name, address FROM persons;
If a view is created WITH SCHEMABINDING, the underlying table(s) can't be dropped or modified in such a way that they would break the view. For example, a table column referenced in a view can't be removed. CREATE VIEW dbo.PersonsView WITH SCHEMABINDING AS SELECT name, address FROM d...

Page 1 of 1