Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

to delete a row in SQL

Posted on 2008-06-10
4
194 Views
Last Modified: 2010-04-21
A query returned 2 rows for me. But both the rows are having the same values. I need to delete one row of that. For deleting i tried to update one field of one row so that i can delete one..but its giving out an error like ;

Key column information is insufficient or incorrect. Too many rows were affected by update.

So how can i delete one row of those two
0
Comment
Question by:cinibia_nidhin
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 21750717
you could do this:
SET ROWCOUNT 1
DELETE yourtable WHERE col1 = value1 AND col2=value2 ...

Open in new window

0
 
LVL 60

Expert Comment

by:chapmandew
ID: 21750744
delete top(1) yourtable
where yourquerycriteria = 'something'
0
 
LVL 4

Expert Comment

by:albuitra
ID: 21750845
in oracle you can do something like this
delete from TABLE
where CONDITIONS
AND rownum < 2
0
 

Author Closing Comment

by:cinibia_nidhin
ID: 31465712
thanks
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question