SQL cascade Update, cascade delete concept

Source: Internet
Author: User
Tags mssql
SQL Cascade UPDATE, cascade Delete did a test today, made clear cascade Update, cascade Delete
Cascade Delete: When we do not have a key to cascade Delete, delete the primary key table data (foreign key table has reference data), will be error, cannot delete, must first the associated foreign key data
deleted, in order to delete the primary key table data, but if the new foreign key is set to cascade Delete, then when we delete the primary key table data, the database will automatically help us to
The associated foreign key table data is removed, this good understanding
Cascade UPDATE: Has been bothering me, cascade Update What is the use, is to update what things, today did a test (MSSQL), finally made clear a little, we modify the primary key table and foreign key table into
Row associated fields (typically primary key table primary key, MSSQL seems to be the primary key), if we do not set the Cascade update, then this time will prompt cannot update, because the foreign key table
There is data associated with this data, but if cascading updates are set up, the data from the Foreign key table will automatically help us update

SQL cascade Update, cascade delete concept

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.