• If I really had to know whether Customer was a table or a view - and I usually wouldn't - it would not take very long to find out, in any of the development or admin tools I have used.  Expand the tables list.. nope.  Expand Views... OK, it's a view.

    For most development using that object, it makes no difference if it is a table or a view.  You select, insert, update, delete, build indexes, and write triggers on tables and views the same way.  While some views are not legal targets for inserts, updates and deletes, this is not an issue: if you don't know what's inside the thing, why are you trying to delete data from it? 

    When tuning, the query plan names the underlying objects being referenced and any indexes in them being used.  If I'm querying a view, and look at the plan, the view isn't even mentioned.  I still don't need to know if my target object is a view or a table; I'm only interested in what's actually happening, and that is explicitly displayed in the plan.

    Going back to one of my earlier points, if Customer was a table when the database was built, that doesn't mean it always will be.  If a database was not designed to get huge, and it gets huge, then all sorts of changes are usually necessary to keep it from suffocating under its own weight.  Just one example is turning large tables into views and partitioning the data horizontally and/or vertically into multiple tables, potentially over multiple servers.  Unless the original table had been cursed with an identity column, then clients would treat the view the same way they treated the table. 

    Requirements change.  Objects change.  Some project formats, such as 'extreme' or 'agile' programming, are built on this premise.  Rigidity = death.  By treating your SQL Server objects similar to other programming objects - the implementation is hidden from the caller, they just need the interface - your designs are ready for these changes.  The larger the project, the more changes that will come.  Adaptable code is just another trick in the bag that makes life easier.

    Eddie Wuerch
    MCM: SQL