The updated or deleted row values cannot make the row unique, or change multiple rows and multiple

Source: Internet
Author: User

The updated or deleted row values cannot make the row unique, or change multiple rows and multiple

When I tried a table, I added several pieces of data to it. Later I found that the values of the fields originally intended as primary keys are "NULL". This is not acceptable. Delete the fields and try again. When you select Delete, the following error occurs: "The modified or deleted row value cannot be changed to a unique row, or multiple rows (X rows) have been changed.


It turns out that I forgot to add the primary key when creating the table, but now I cannot delete it. I can enter something in it, but I cannot enter it, and an error is returned. No way ~ Baidu ~ Various solutions finally found the methods that I can understand and operate on. (Good Method !!!)
Solution:
Click "new query" on the SQL toolbar, log on to the database where the data table to be modified is located, and enter the following SQL statement "delete database name. table name where field name to be deleted = 'field value'
For example:
Use jifang -- go to the jifang database go
Delete jifang. dbo. weihubiao where card number = 'null' </span>
Then press F5 to execute. Although the mistake was made carelessly, I learned something from the mistake and felt that it was worthwhile. If an error occurs, it is necessary to make progress ~ Come on !!!
If the updated or deleted row value cannot make the row a unique row, multiple rows must be changed (2 rows)

Most of these problems are caused by the absence of primary keys (PK), which results in several identical data records in the same table. When a DBMS is stored, only one piece of data is stored for it, because the DBMS underlying layer is optimized to reduce data redundancy. Therefore, deleting or updating a duplicate data will trigger the whole body.
If you understand the root cause, it is easy to solve the problem. We recommend that you set a primary key to check whether the same row of data exists.
 
How can I change the data in SQL statements?

Add a primary key to the table.

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.