I have a table consists of 10000 records. i want to delete these records, if i tried to delete those records at a time, database fail out of log space. So, I want to delete these 10000 records as smaller chunks. i am using DB2.
Can anyone help me to delete the records in smaller chunks?
Ramakanth, In general: You could add a where clause to your delete statement on the primary key. For example, delete from table where myPrimaryKey < X. Then increment X in groups of whatever the database can handle.
In db2: There is a way of telling the database to commit after a certain number of operations for a bulk operation. I've used it when importing a large data file from the control center. (There's a textfield for the # of records to commit after.) I'm sure this translates into SQL somehow. Try looking in the db2 document for the syntax.