Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

to delete a row in SQL

Posted on 2008-06-10
4
Medium Priority
?
198 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
[X]
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
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

618 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