deleting all rows from a huge table
843854Mar 19 2004 — edited Dec 15 2005Hi all,
I'm making a Database replication app. One of the replication types is REPLACE, this one deletes all content from target table and inserts all rows from source table.
I'm having a little problem with big tables: when I execute "delete * from table" if the table is so big, transaction log gets FULL and the transaction cannot be done. Then I have to increase transaction Log files... but i would like to use a better method. And this is very important: it has to be database independent.
I have thunk to ways to solve this problem:
1.- drop and re-create the table.
I would prefer haven't to do this because i will lose this table for restoring purposes (but this way works sure)
2.- have a way to delete rows from the table in blocks. n each time. each as a separate statement... as a individual transaction...
This way is what i want to try.. I know some waysto do this but they depend always on the DB that i'm accessing (DB2 -- using fetch first n rows only, Oracle -- where rownum < n, etc.) but i don't know any method database independent....
someone knows a way to do this?
thanks in advice,