SET SQL_SAFE_UPDATES=0;
DELETE
FROM catalog_category_entity_datetime
WHERE catalog_category_entity_datetime.attribute_id NOT IN (
SELECT eav_attribute.attribute_id FROM eav_entity_type
INNER JOIN eav_attribute ON eav_attribute.entity_type_id = eav_entity_type.entity_type_id
WHERE (eav_entity_type.entity_type_code='catalog_category')
);
DELETE
FROM catalog_category_entity_decimal
WHERE catalog_category_entity_decimal.attribute_id NOT IN (
SELECT eav_attribute.attribute_id FROM eav_entity_type
INNER JOIN eav_attribute ON eav_attribute.entity_type_id = eav_entity_type.entity_type_id
WHERE (eav_entity_type.entity_type_code='catalog_category')
);
DELETE
FROM catalog_category_entity_int
WHERE catalog_category_entity_int.attribute_id NOT IN (
SELECT eav_attribute.attribute_id FROM eav_entity_type
INNER JOIN eav_attribute ON eav_attribute.entity_type_id = eav_entity_type.entity_type_id
WHERE (eav_entity_type.entity_type_code='catalog_category')
);
DELETE
FROM catalog_category_entity_text
WHERE catalog_category_entity_text.attribute_id NOT IN (
SELECT eav_attribute.attribute_id FROM eav_entity_type
INNER JOIN eav_attribute ON eav_attribute.entity_type_id = eav_entity_type.entity_type_id
WHERE (eav_entity_type.entity_type_code='catalog_category')
);
DELETE
FROM catalog_category_entity_varchar
WHERE catalog_category_entity_varchar.attribute_id NOT IN (
SELECT eav_attribute.attribute_id FROM eav_entity_type
INNER JOIN eav_attribute ON eav_attribute.entity_type_id = eav_entity_type.entity_type_id
WHERE (eav_entity_type.entity_type_code='catalog_category')
);
SET SQL_SAFE_UPDATES=0;
TRUNCATE TABLE catalog_category_entity_datetime;
TRUNCATE TABLE catalog_category_entity_decimal;
TRUNCATE TABLE catalog_category_entity_int;
TRUNCATE TABLE catalog_category_entity_text;
TRUNCATE TABLE catalog_category_entity_varchar;
TRUNCATE TABLE core_url_rewrite;