Search code examples
sql-serverssms

sql delete row error


I am trying to delete a row in sql server management studio 2012 but an error appears:

sql error

No rows were deleted

A problem occurred attempting to delete row 2 Error Source: Microsoft.SqlServer.Management.DataTools Error Message: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows(2 rows)

Is there a way to fix error that without typing any query?


Solution

  • You don't have a primary, unique key in your table.

    SQL Server is unable to delete your row because nothing discriminate it from the other rows.

    The solution is to add a unique Primary key to your table. It is not recommended to have none anyway. A simple integer with autoincrement should work transparently for you.