Summary of SQL Server View

Source: Internet
Author: User

Summary of the SQL Server View

A view is stored on a physical table. It is changed due to changes to the physical table and generally does not need to be updated.

View as a filter: It can be seen from the Filter Name that the main purpose of such a view is to hide and can be considered as a hidden select statement.

One of the most important details in a view is that in many Update operations, you need to add the "checkwith option" Statement (where conditions must be met for Update, insert, and delete ), this ensures data integrity.

In addition, in most databases, the View tool is usually used too much or too little. Some people like to use views to abstract almost everything (this also means adding a layer of processing ). Others seem to have forgotten the view. View should be used at the right time to get better results.

When using a view, you should pay attention to the following aspects:

1. Avoid building a view based on the view-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 some flexibility that is not available for different check constraints.

3. View encryption-the encrypted view can no longer restore unencrypted code.

4. In addition to permissions, using 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 alter statement must contain the withencryption and withcheck option clauses.

5. Use sp_helptext to display the supported code of the view-avoid using the system table.

6. Minimize users who use the view for production queries-because they increase additional system overhead and compromise performance.

Depending on the Usage:

1. Filter rows

2. protect 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.