Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding Views
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01587551
Message ID:
01587553
Views:
39
>>Hi,
>>
>>I have a general newbie question on SQL Server views.
>>
>>When you create a view, does SQL Server automatically maintain records in the view? Example. Say I create a view on records in a table that have value in column STATUS set to 'O' and in column CATEGORY to 'ABC'. Do I understand that whenever the base table (on which the view is created) gets records of STATUS 'O' and CATEGORY 'ABC', these records immediately are in the view? When when you, say, change the STATUS to 'C', the record is removed from the view (automatically) by SQL Server?
>
>A view is executed on the fly; it does not already have the data stored and ready to be served up.
>
>From - http://stackoverflow.com/questions/1278521/why-do-you-create-a-view-in-a-database
>
>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.

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform