Solved

to delete a row in SQL

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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how the fundamental information of how to create a table.

726 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