Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the row values updated or deleted either do not make the row unique or they alter multiple rows

Tags:

sql

sql-server

I want to delete row and I get this error:

the row values updated or deleted either do not make the row unique or they alter multiple rows

enter image description here

like image 647
Zumm Avatar asked Apr 26 '16 08:04

Zumm


3 Answers

There are duplicate rows in your table. When this is the case you cannot edit table using UI. first delete rows with matching data using SQL then try and edit. Delete rows with matching data one by one until you are left with one row. Use the following query for deleting matching rows where column IdSeminar has value 1 :

Delete top(1) from tab where IdSeminar=1

do the same with other matching rows.

like image 75
Akshey Bhat Avatar answered Nov 11 '22 21:11

Akshey Bhat


This might be a bit late but it could help someone. I ran into the same issue today but Akshey's code didn't work for me. My database table didn't contain an ID column, so I added one in and set it's 'Identity Specification' to 'Yes'. I reloaded the table with this new column in it and then was able to delete whichever rows I wanted. Afterwards I deleted the ID column, reloaded and the table and everything was fine.

like image 40
Scanner Avatar answered Nov 11 '22 23:11

Scanner


SQL Studio cautiously tries to delete exactly one row but finds no way to identify it. Contrary to what it's UI may tempt you to suppose, row can't be identified by it's position in the result set.

like image 7
Serg Avatar answered Nov 11 '22 22:11

Serg