View previous topic :: View next topic |
Author |
Message |
paleeshwaran Beginner
Joined: 13 Feb 2006 Posts: 5 Topics: 1
|
Posted: Tue May 25, 2010 12:47 pm Post subject: DELETE utility |
|
|
Hi,
Greetings! I am trying to find if there is any DB2 utility where we can DELETE rows from a table, by reading primary key from a file.
Please advise and Thanks in Advance!
~ Peace
Palee |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Tue May 25, 2010 12:48 pm Post subject: |
|
|
paleeshwaran,
It would be easier to just unload the file and remove the duplicates based on the primary key and reload it back again. Alternatively you can generate the Delete SQL commands reading a file and run it thru DSNTIAUL
Kolusu |
|
Back to top |
|
|
paleeshwaran Beginner
Joined: 13 Feb 2006 Posts: 5 Topics: 1
|
Posted: Tue May 25, 2010 12:53 pm Post subject: |
|
|
Actually i thought about that option. But my DB have too many bad data, So if i remove duplicates the chances of Bad data being picked up for LOAD are high. So, i am thinking of an option where i can DELETE based on primary key extract from a file. Please advice |
|
Back to top |
|
|
paleeshwaran Beginner
Joined: 13 Feb 2006 Posts: 5 Topics: 1
|
Posted: Tue May 25, 2010 12:57 pm Post subject: |
|
|
Kolusu,
Apologies! i just noticed your recommendation on DSNTIAUL. Could you please let know delete command that should be given in SYSIN and how the where clause of DELETE can be referrenced to a file value? Thanks |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Tue May 25, 2010 12:59 pm Post subject: |
|
|
paleeshwaran wrote: | Actually i thought about that option. But my DB have too many bad data, So if i remove duplicates the chances of Bad data being picked up for LOAD are high. So, i am thinking of an option where i can DELETE based on primary key extract from a file. Please advice |
huh? I am confused . your table already has the bad data and all you are doing is removing the duplicates based on the primary key in both files. So I just don't understand what the problem is
Kolusu |
|
Back to top |
|
|
paleeshwaran Beginner
Joined: 13 Feb 2006 Posts: 5 Topics: 1
|
Posted: Tue May 25, 2010 1:06 pm Post subject: |
|
|
I have a primary key which is timestamp and no duplicates. I have account record which are duplicates some of them are bad data and some of them are good data.
For example below is the data that i have
2009-01-01.00.00.00.000001 ACCOUNT1 XXXXXGOOD
2009-01-01.00.00.00.000002 ACCOUNT1 XXXXXBAD
2009-01-01.00.00.00.000003 ACCOUNT2 XXXXXBAD1
2009-01-01.00.00.00.000004 ACCOUNT2 XXXXXBAD2
2009-01-01.00.00.00.000005 ACCOUNT2 XXXXXGOOD
I just want to delete only record 2, 3 & 4. I already have them in a file. Now i am looking for a utility to delete these records based on primary key(which is the timestamp) |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
paleeshwaran Beginner
Joined: 13 Feb 2006 Posts: 5 Topics: 1
|
Posted: Tue May 25, 2010 2:56 pm Post subject: |
|
|
Thanks Kolusu! It worked! |
|
Back to top |
|
|
|
|