x
login about faq Site discussion (meta-askssc)

I cannot delete rows in SQL table

Hello, I have a SQL server database which contains different tables, one of its table's rows cannot be deleted. I don't know what is the problem, I checked table properties and server roles too. I want to mention that some of its rows are used in views.

I try to delete it directly from the SQL server. It gives me the following message:

No rows were deleted. A problem occured attempting to delete row 3. Error Source: Microsft.VisualStudio.DataTools. Error Message: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows (5 rows)

Correct the errors and attempt to delete rows again or press ESC to cancel the change(s)

more ▼

asked Nov 23 '09 at 07:56 AM in Default

Jahid gravatar image

Jahid
13 1 1 2

Posting the error message you get is a must, really.

Nov 23 '09 at 08:09 AM Matt Whitfield ♦♦

Do you get referential error?

Nov 23 '09 at 08:35 AM Peso
(comments are locked)
10|1200 characters needed characters left

5 answers: sort newest

It sounds like you're relying on the data tool to handle the deletes but your data has duplicates which is preventing the data tool from completing the operation. I think sp_lock has it nailed, you don't have a primary key on this data.

more ▼

answered Nov 24 '09 at 09:58 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
62.2k 12 20 66

(comments are locked)
10|1200 characters needed characters left

Have you tried deleting with a manually typed delete statement instead of through the GUI?

The one time I have seen an error like that was when I was deleting rows through the gui that another developer had modified by t-sql command. (Just to be clear, this was setting up test data on a test server. I generally would not recommend using the GUI to make changes in production, especially on a system with many users.)

more ▼

answered Nov 24 '09 at 02:44 AM

TimothyAWiseman gravatar image

TimothyAWiseman
14.3k 16 20 29

(comments are locked)
10|1200 characters needed characters left

Are the views created with schemabinding?

more ▼

answered Nov 23 '09 at 12:05 PM

Blackhawk-17 gravatar image

Blackhawk-17
10.5k 23 29 34

(comments are locked)
10|1200 characters needed characters left

To add to what has already been said and asked....

There are various reasons why you may not be able to delete, or the result of a delete MAY not appear to have worked, including triggers, constraints, permissions, errors etc.

You really need to post both the method by which you are trying to delete (i.e. the SQL) and any resulting error messages or completion messages. This will then help us to help you.

more ▼

answered Nov 23 '09 at 09:13 AM

Kev Riley gravatar image

Kev Riley ♦♦
46.1k 38 43 69

(comments are locked)
10|1200 characters needed characters left

Are you trying this via SSMS?

Silly question...Does the table have a Primary key?

more ▼

answered Nov 23 '09 at 08:19 AM

sp_lock gravatar image

sp_lock
8.1k 20 26 29

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x43
x12

asked: Nov 23 '09 at 07:56 AM

Seen: 4612 times

Last Updated: Nov 24 '09 at 02:29 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.