What are the advantages of using views. Why do we need
views when we have SPs?

Answer Posted / dr.job418

A view provides several benefits.

1. Views can hide complexity

If you have a query that requires joining several tables, or has complex logic or calculations, you can code all that logic into a view, then select from the view just like you would a table.

2. Views can be used as a security mechanism

A view can select certain columns and/or rows from a table, and permissions set on the view instead of the underlying tables. This allows surfacing only the data that a user needs to see.

3. Views can simplify supporting legacy code

If you need to refactor a table that would break a lot of code, you can replace the table with a view of the same name. The view provides the exact same schema as the original table, while the actual schema has changed. This keeps the legacy code that references the table from breaking, allowing you to change the legacy code at your leisure.

These are just some of the many examples of how views can be useful.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to get a list of columns in a view using the "sp_columns" stored procedure?

612


what's the information that can be stored inside a bit column? : Sql server database administration

527


what happens on checkpoint? : Sql server database administration

503


How to create a new login name in ms sql server?

544


What is transaction server auto commit?

575






What is the server name in sql server?

555


What is difference between join and natural join?

477


How much space does sql server 2016 take?

567


Determine when an index is appropriate?

554


Explain transaction server auto commit?

531


what is an index? : Sql server database administration

518


How do I run sql server 2014?

506


what is normalization? Explain different levels of normalization? : Sql server database administration

650


Explain insert into select statement?

523


What is the maximum size per database for sql server express?

557