Solved

to delete a row in SQL

Posted on 2008-06-10
4
191 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 142

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.‚Äč
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now