When you manipulate a database, you often encounter an updated or deleted row value that either does not make the row a unique row or changes multiple rows, as follows:
Reason analysis: Prompt that the deleted row is not the only row, and then check it again and discover:
is a duplicate key value or data that appears in the database, prompting an error when you try to delete it.
Workaround:
Method One: Add a primary key to make the row value unique.
SQL statement: ALTER table name
Add ID int Identity primary KEY (note: Identity must be added, otherwise the addition will fail)
Or through the DBMS graphical interface to add, click the following figure small key, according to the prompts step-by-step:
Method Two: Simple and rough. Through the DBMS's own Query Analyzer, new query directly delete it, fast and concise. As follows:
。
A successful deletion will prompt several rows to be affected.