Summary of SQL Server view

Source: Internet
Author: User
Tags abstract

Summary of SQL Server views

The view is stored on the physical table, changed by the physical table changes, generally no longer need to update.

View as a filter: you can see from the filter name that the main purpose of such a view is to hide, as a hidden SELECT statement.

One of the more important details in the view is that, in many updates, you need to add the "checkwith option" statement (the Where condition is required for UPDATE, INSERT, delete) to ensure the integrity of the data.

In addition: In most databases, the use of views as a tool is often not too much or too little. Some people like to use views to abstract almost everything (while doing this means adding a layer of processing). Others seem to forget that the view is also an option. The view should be used at the right time to get better results.

In the process of using a view, several aspects should be noted:

1. Avoid building views based on views-instead, apply the appropriate query information from the first view to the new view.

2. Remember to use the view with CHECK option to provide flexibility that is not available with some different check constraints.

3. View encryption-The encrypted view is no longer able to recover unencrypted code.

4. In addition to the permissions, the use of Alter view means that the existing view is completely replaced. This means that if the encryption and restrictions in the modified view are still valid, the withencryption and withcheck option clauses must be included in the ALTER statement.

5. Use sp_helptext to display the support code for the view--Avoid using system tables.

6. Minimize the users of the view used for production queries-because they add additional overhead and compromise performance.

General usage of Views:

1. Filter line

2. Protection of sensitive data

3. Reduce database complexity

4. Abstract multiple physical databases into one logical database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.