Question
Martin Weissenborn · Aug 11, 2021

drop column "Deleting a column definition does not delete any data that has been stored in that column from the data map."

How can you find referenced entries in a table that have been deleted with the drop column?
I have to find all fields in the database afterwards and then delete them properly.
Has anyone had this problem yet?
Can the information be found in the class or storage definitions?

Thanks for a quick feedback.

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.5 (Build 659_0_20787U) Thu Apr 8 2021 22:23:41 EDT
20
2 0 2 91
Log in or sign up to continue

Hello Martin,

Using "DROP COLUMN" deletes the property from the class definition and modifies the storage definition by removing the property name. The storage definition will still have a "Value" item for the data, but it no longer includes the name of the property.

If you have the class definition in source control, the easiest way to truly delete the data is to revert to the previous version. Then you can run DROP COLUMN again with the %DELDATA option to remove the column and delete the data.

If this is not possible, I would look at the storage definition and find the empty slot in the storage definition. The "name" property on that slot will give you the storage index. You could then iterate through the global where the data is stored and do something like set $list(value, name) = "" to delete the data. I would recommend contacting Support before doing this to see if they have better suggestions.

With this query you can find the deletet columns.

select List(name) as tIds
from %Dictionary.StorageDataValueDefinition
where parent [ 'Tablename||'
and Value is null