January 20, 2012

No row was updated

Error:
- A SQL Server Database contains some tables but one of table's rows cannot be updated!!
- How i can update some NULL rows in my table ?
- Can't update rows (...) in Microsoft Visual Studio ...

Error Message:
No row was updated.
The data in row X was not committed.
Error Source: Microsoft.VisualStudio.DataTools.
Error Message: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows(N rows).
Correct the errors and retry or press ESC to cancel the change(s).
Problem Causes:
This issue occurs if the following conditions are true:
- The table contains one or more columns of the text or ntext data type.
- The value of one of these columns contains the following characters:
        - Percent sign (%)
        - Underscore (_)
        - Left bracket ([)
- The table does not contain a primary key.

Solution:
This is a Microsoft BUG (BUG-925719)
There's not any solution. You need to have a new table with a primary key or correct values and copy data into new table and drop old table, Sorry.


Solution In Microsoft Visual Studio 
(NEW):

- Goto Server Explorer
- Goto Database > Tables > The Table
- RightClick and Select Edit Table Schema
ADD a new Column with these options
        - Data Type: uniqueidentifier
        - Allow Nulls: No
        - Unique: Yes
        - Primary Key: Yes
        - Is RowGuid: True
- Save and Close and open Table and update rows ;-)


REF: 
http://amastaneh.blogspot.com/2012/01/no-rows-were-deleted.html

2 comments:

Anonymous said...

Great man, it's working fine!

Ralph Carpenter said...

nice post