Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cant delete 1 record from SQL table 1

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I have an SQL table that I entered 2 extra records by mistake. I have tried to delete the record and I keep on getting an error. When I highlight the record a messgae box comes up You are about to delete 1 row(s). Click yes to permanently delete these rows. You won't be able to undo these changes. I click yes

The messgae I gete is No rows were deleted.
A problem occured attempting to delete row 35.
error Source: Microsoft.VisualSudio.dataTools.
Error Message; The row calues updated or deleted either do not make the row unique or they alter multiple rows(2 rows).

Correct the errors and atttempt to delete the row again.

Tom
 
Sounds like there is a trigger or FK constraint in place. If so you could disable & try again. What happens when you try doing it through SQL Qery. Something like "DELETE FROM tbl_name WHERE condition = ?" ?

Beir bua agus beannacht!
 
The file has no keys in it. I did the delete query and it worked thank you very much!

Tom
 
The table has no primary Key. This was a common problem in Access, and guess what the GUI in SSMS is based on. If the rows are completely identical, you can use
Code:
delete top 1 tablename where somecondition
This will pick one of the rows at random (that fulfill the conditions) and delete it. This should be tested, so you are comfortable with it, and don't accidentally delete a random row. If you are not comfortable with that approach, you can always delete both rows, and re-insert one of them. This would have to be done in a query window, of course.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top