Truncating a table with a condition

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
purush
Participant
Posts: 16
Joined: Sat Nov 25, 2006 5:34 am
Location: Hyderabad

Truncating a table with a condition

Post by purush »

Hi,

I need to truncate a table based on a conditon.........For a column 'Input' There will be two values A and B. I need to truncate only for the value A.

Previously when there was no condition I used to use Stored Procedrue to truncate the entire table.........Now can I use SP with a condition to truncate the table.......

Please suggest me an :idea:

Thanks in Advance.......
Purush
nick.bond
Charter Member
Charter Member
Posts: 230
Joined: Thu Jan 15, 2004 12:00 pm
Location: London

Post by nick.bond »

what database are you using?

you can't truncate with a condition, that would be performing a delete.

If you partition your table by the column in question you could drop the partition which will probably be quicker that a delete if you have a huge table.
Regards,

Nick.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Can you approach this as a series of discrete steps? Evaluate your condition, possibly truncate, etc - all controlled in a Sequence job by triggers?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is the question IF condition THEN truncate ELSE don't or is the question truncate only certain rows?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply