• fregatepllada (8/1/2014)


    If I am not mistaken, it works only when View built on top of a SINGLE table and includes table's PK column(s)?

    Only if you try an update directly through the view. If you define appropriate triggers you can do multi-table updates. Triggers have their own issues, and if you think about it, by the time you write the logic for those, you've probably written a fair piece of a stored procedure.

    I inherited a database with an Access front-end that was linked directly to the tables (you may wince now) and I used views that mimicked the exsiting tables to de-couple the tables from Access so I could re-work the schema without blowing up the whole thing. Stored procedures can be used with Access via pass-through queries but there are some extra gymnastics since SQL Server doesn't know a thing about the Access object model. Views on the other hand act the same as a linked table.

    It's still a work in progress with the eventual goal of moving to a tiered architecture, but using views has certainly simplified the process - not to mention allowing me to learn a good bit of SQL in the process.

    This isn't to say you should or souldn't use views. Like all things SQL Server, they're another tool in the toolbox and you have to evaluate when, where and how to use them.

    ____________
    Just my $0.02 from over here in the cheap seats of the peanut gallery - please adjust for inflation and/or your local currency.