Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to delete a record that cannot be loaded?
Published On: January 15, 2004

All versions

It may happen that you have a damaged record that you can't load. Running 4D Tools to repair the data file or performing a recover by tag will not fix the problem.

The problem is that the contents of the record are damaged, not the record itself. This is why 4D Tools does not detect any damage. It only checks the definition of the record, not the values for each field.

A possible case would be a record that contains a blob field. The blob field has a length that will define the size of the blob. Let's assume that a byte swapping problem occurred or that the wrong information has been saved. So, instead of reading a size of 5 Mb, we may read an erroneous value such as 3 Gb. 4D will try to create a memory block of 2 Gb and will fail to load the record. Since you can't load the record, you can't modify it and may not be able to delete it.

You can still delete the record as long as you do not try to load it.
- Be sure that there is no code that loads the record, such as triggers
- Disable all indexes for this table
- Disable any deletion control
- Make sure that there is no running transaction
- Create a selection that contains this record and does not load it. This can be done using the CREATE SELECTION FROM ARRAY command, for example.
- You can then delete the record using the DELETE SELECTION command