IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

If we have two same rows and want to Delete only one row


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gcchowdary
Warnings : 1

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Wed Nov 18, 2009 7:47 pm
Reply with quote

If we have two same rows and want to Delete only one row from DB2 table. is it possible thru SQL ? If os please let me know.

Thanks,
G C Chowdary
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Wed Nov 18, 2009 8:23 pm
Reply with quote

People started thinking primary keys are not useful anymore? icon_eek.gif

The delete query will delete all the rows matching the where clause.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 18, 2009 11:09 pm
Reply with quote

Hello,

One way to do what you want is with a cursor. . .
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Thu Nov 19, 2009 12:24 am
Reply with quote

yes you can use the cursor and can delete the selected row.
Back to top
View user's profile Send private message
gcchowdary
Warnings : 1

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Thu Nov 19, 2009 11:19 am
Reply with quote

Thank You Dick & Sachin!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts To get the count of rows for every 1 ... DB2 3
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts How to delete a user's alias from the... JCL & VSAM 11
Search our Forums:

Back to Top