delete from VCLib.T_ReportFileParameter
from VCLib.T_ReportFileParameter
inner join VCLib.T_ReportFile on VCLib.T_ReportFileParameter.FileID=VCLib.T_ReportFile.FileID
inner join VCLib.T_ReportFileGroup on VCLib.T_ReportFile.GroupID=VCLib.T_ReportFileGroup.GroupID
inner join VCLib.T_Report on VCLib.T_ReportFileGroup.ReportID=VCLib.T_Report.ReportID
inner join VCLib.T_ENTITIES on VCLib.T_Report.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_GR_ATTACHMENT_ITEM
from VCLib.T_GR_ATTACHMENT_ITEM
inner join VCLib.T_GENERIC_REPORT_MAIN_ITEM on VCLib.T_GR_ATTACHMENT_ITEM.GenericReportMainItem=VCLib.T_GENERIC_REPORT_MAIN_ITEM.GenericReportMainItemID
inner join VCLib.T_GENERIC_REPORT on VCLib.T_GENERIC_REPORT_MAIN_ITEM.GenericReport=VCLib.T_GENERIC_REPORT.GenericReportID
inner join VCLib.T_ENTITIES on VCLib.T_GENERIC_REPORT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ReportFile
from VCLib.T_ReportFile
inner join VCLib.T_ReportFileGroup on VCLib.T_ReportFile.GroupID=VCLib.T_ReportFileGroup.GroupID
inner join VCLib.T_Report on VCLib.T_ReportFileGroup.ReportID=VCLib.T_Report.ReportID
inner join VCLib.T_ENTITIES on VCLib.T_Report.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DICTIONARY_ATTRIBUTE_KEY
from VCLib.T_DICTIONARY_ATTRIBUTE_KEY
inner join VCLib.T_DICTIONARY_ATTRIBUTE on VCLib.T_DICTIONARY_ATTRIBUTE_KEY.DictionaryAttribute=VCLib.T_DICTIONARY_ATTRIBUTE.DictionaryAttributeID
inner join VCLib.T_DICTIONARY_UPDATE on VCLib.T_DICTIONARY_ATTRIBUTE.DictionaryUpdate=VCLib.T_DICTIONARY_UPDATE.DictionaryUpdateID
inner join VCLib.T_ENTITIES on VCLib.T_DICTIONARY_UPDATE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DTO_MODEL_COLUMN
from VCLib.T_DTO_MODEL_COLUMN
inner join VCLib.T_DTO_MODEL_VIEW on VCLib.T_DTO_MODEL_COLUMN.DtoModelView=VCLib.T_DTO_MODEL_VIEW.DtoModelViewID
inner join VCLib.T_DTO_MODEL on VCLib.T_DTO_MODEL_VIEW.DtoModel=VCLib.T_DTO_MODEL.DtoModelID
inner join VCLib.T_ENTITIES on VCLib.T_DTO_MODEL.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_UNITED_OBJECT_CHANGESET
from VCLib.T_UNITED_OBJECT_CHANGESET
inner join VCLib.T_UNITED_OBJECT on VCLib.T_UNITED_OBJECT_CHANGESET.UnitedObject=VCLib.T_UNITED_OBJECT.UnitedObjectID
inner join VCLib.T_ENTITIES on VCLib.T_UNITED_OBJECT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DTO_MODEL_FILTER
from VCLib.T_DTO_MODEL_FILTER
inner join VCLib.T_DTO_MODEL on VCLib.T_DTO_MODEL_FILTER.DtoModel=VCLib.T_DTO_MODEL.DtoModelID
inner join VCLib.T_ENTITIES on VCLib.T_DTO_MODEL.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DTO_MODEL_VIEW
from VCLib.T_DTO_MODEL_VIEW
inner join VCLib.T_DTO_MODEL on VCLib.T_DTO_MODEL_VIEW.DtoModel=VCLib.T_DTO_MODEL.DtoModelID
inner join VCLib.T_ENTITIES on VCLib.T_DTO_MODEL.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DTO_ITEM
from VCLib.T_DTO_ITEM
inner join VCLib.T_DTO_MODEL on VCLib.T_DTO_ITEM.ItemDtoModel=VCLib.T_DTO_MODEL.DtoModelID
inner join VCLib.T_ENTITIES on VCLib.T_DTO_MODEL.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_TEMPLATE_FIELD_VALUE
from VCLib.T_TEMPLATE_FIELD_VALUE
inner join VCLib.T_TEMPLATE_FIELD on VCLib.T_TEMPLATE_FIELD_VALUE.TemplateField=VCLib.T_TEMPLATE_FIELD.TemplateFieldID
inner join VCLib.T_ENTITIES on VCLib.T_TEMPLATE_FIELD.Entity=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_LEXEM_PARAMETER
from VCLib.T_LEXEM_PARAMETER
inner join VCLib.T_TEMPLATE_OVERRIDE on VCLib.T_LEXEM_PARAMETER.TemplateOverride=VCLib.T_TEMPLATE_OVERRIDE.TemplateOverrideID
inner join VCLib.T_ENTITIES on VCLib.T_TEMPLATE_OVERRIDE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DTO_ITEM
from VCLib.T_DTO_ITEM
inner join VCLib.T_DTO_MODEL on VCLib.T_DTO_ITEM.ItemDtoModel=VCLib.T_DTO_MODEL.DtoModelID
inner join VCLib.T_ENTITIES on VCLib.T_DTO_MODEL.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DICTIONARY_DEPEND
from VCLib.T_DICTIONARY_DEPEND
inner join VCLib.T_DICTIONARY_UPDATE on VCLib.T_DICTIONARY_DEPEND.DictionaryUpdate=VCLib.T_DICTIONARY_UPDATE.DictionaryUpdateID
inner join VCLib.T_ENTITIES on VCLib.T_DICTIONARY_UPDATE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DICTIONARY_DEPEND
from VCLib.T_DICTIONARY_DEPEND
inner join VCLib.T_DICTIONARY_UPDATE on VCLib.T_DICTIONARY_DEPEND.DictionaryUpdate=VCLib.T_DICTIONARY_UPDATE.DictionaryUpdateID
inner join VCLib.T_ENTITIES on VCLib.T_DICTIONARY_UPDATE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DICTIONARY_USER
from VCLib.T_DICTIONARY_USER
inner join VCLib.T_DICTIONARY_UPDATE on VCLib.T_DICTIONARY_USER.DictionaryUpdate=VCLib.T_DICTIONARY_UPDATE.DictionaryUpdateID
inner join VCLib.T_ENTITIES on VCLib.T_DICTIONARY_UPDATE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DATAFORM_EXTENSION_ADDATTRIBUTE
from VCLib.T_DATAFORM_EXTENSION_ADDATTRIBUTE
inner join VCLib.T_DATAFORM_EXTENSION on VCLib.T_DATAFORM_EXTENSION_ADDATTRIBUTE.DataformExtension=VCLib.T_DATAFORM_EXTENSION.DataformExtensionID
inner join VCLib.T_ENTITIES on VCLib.T_DATAFORM_EXTENSION.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DATAFORM_EXTENSION_ROLE
from VCLib.T_DATAFORM_EXTENSION_ROLE
inner join VCLib.T_DATAFORM_EXTENSION on VCLib.T_DATAFORM_EXTENSION_ROLE.DataformExtension=VCLib.T_DATAFORM_EXTENSION.DataformExtensionID
inner join VCLib.T_ENTITIES on VCLib.T_DATAFORM_EXTENSION.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DICTIONARY_ATTRIBUTE
from VCLib.T_DICTIONARY_ATTRIBUTE
inner join VCLib.T_DICTIONARY_UPDATE on VCLib.T_DICTIONARY_ATTRIBUTE.DictionaryUpdate=VCLib.T_DICTIONARY_UPDATE.DictionaryUpdateID
inner join VCLib.T_ENTITIES on VCLib.T_DICTIONARY_UPDATE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_VALIDATION_CONDITION
from VCLib.T_VALIDATION_CONDITION
inner join VCLib.T_DATAFORM_VALIDATION on VCLib.T_VALIDATION_CONDITION.DataformValidation=VCLib.T_DATAFORM_VALIDATION.Entities
inner join VCLib.T_ENTITIES on VCLib.T_DATAFORM_VALIDATION.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_BASE_FEATURE_SETTINGS
from VCLib.T_BASE_FEATURE_SETTINGS
inner join VCLib.T_CLIENT_MODULE_FEATURE on VCLib.T_BASE_FEATURE_SETTINGS.ClientModuleFeature=VCLib.T_CLIENT_MODULE_FEATURE.ClientModuleFeatureID
inner join VCLib.T_ENTITIES on VCLib.T_CLIENT_MODULE_FEATURE.EntityIndex=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DATA_ACCESS_ENTRY
from VCLib.T_DATA_ACCESS_ENTRY
inner join VCLib.T_DATA_ACCESS on VCLib.T_DATA_ACCESS_ENTRY.DataAccess=VCLib.T_DATA_ACCESS.DataAccessID
inner join VCLib.T_ENTITIES on VCLib.T_DATA_ACCESS.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_REPORT_ATTACHMENT
from VCLib.T_REPORT_ATTACHMENT
inner join VCLib.T_Report on VCLib.T_REPORT_ATTACHMENT.Report=VCLib.T_Report.ReportID
inner join VCLib.T_ENTITIES on VCLib.T_Report.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ReportFileGroup
from VCLib.T_ReportFileGroup
inner join VCLib.T_Report on VCLib.T_ReportFileGroup.ReportID=VCLib.T_Report.ReportID
inner join VCLib.T_ENTITIES on VCLib.T_Report.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ReportKey
from VCLib.T_ReportKey
inner join VCLib.T_Report on VCLib.T_ReportKey.ReportID=VCLib.T_Report.ReportID
inner join VCLib.T_ENTITIES on VCLib.T_Report.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_SIMPLE_REPORT_MENU_ITEM
from VCLib.T_SIMPLE_REPORT_MENU_ITEM
inner join VCLib.T_Report on VCLib.T_SIMPLE_REPORT_MENU_ITEM.Report=VCLib.T_Report.ReportID
inner join VCLib.T_ENTITIES on VCLib.T_Report.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_EXPORT_COLUMN
from VCLib.T_EXPORT_COLUMN
inner join VCLib.T_EXPORT_TABLE on VCLib.T_EXPORT_COLUMN.ExportTable=VCLib.T_EXPORT_TABLE.ExportTableID
inner join VCLib.T_ENTITIES on VCLib.T_EXPORT_TABLE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_EXPORT_ITEM
from VCLib.T_EXPORT_ITEM
inner join VCLib.T_EXPORT_TABLE on VCLib.T_EXPORT_ITEM.ExportTable=VCLib.T_EXPORT_TABLE.ExportTableID
inner join VCLib.T_ENTITIES on VCLib.T_EXPORT_TABLE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_GENERATOR_LINK
from VCLib.T_GENERATOR_LINK
inner join VCLib.T_GENERIC_REPORT on VCLib.T_GENERATOR_LINK.GenericReport=VCLib.T_GENERIC_REPORT.GenericReportID
inner join VCLib.T_ENTITIES on VCLib.T_GENERIC_REPORT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_GENERATOR_PARAMS
from VCLib.T_GENERATOR_PARAMS
inner join VCLib.T_GENERIC_REPORT on VCLib.T_GENERATOR_PARAMS.GenericReport=VCLib.T_GENERIC_REPORT.GenericReportID
inner join VCLib.T_ENTITIES on VCLib.T_GENERIC_REPORT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_GENERIC_REPORT_FUNCTION
from VCLib.T_GENERIC_REPORT_FUNCTION
inner join VCLib.T_GENERIC_REPORT on VCLib.T_GENERIC_REPORT_FUNCTION.GenericReport=VCLib.T_GENERIC_REPORT.GenericReportID
inner join VCLib.T_ENTITIES on VCLib.T_GENERIC_REPORT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_GENERIC_REPORT_MAIN_ITEM
from VCLib.T_GENERIC_REPORT_MAIN_ITEM
inner join VCLib.T_GENERIC_REPORT on VCLib.T_GENERIC_REPORT_MAIN_ITEM.GenericReport=VCLib.T_GENERIC_REPORT.GenericReportID
inner join VCLib.T_ENTITIES on VCLib.T_GENERIC_REPORT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ENTITIES_WEB_ALIAS_ACCESS
from VCLib.T_ENTITIES_WEB_ALIAS_ACCESS
inner join VCLib.T_ENTITIES_WEB_ALIAS on VCLib.T_ENTITIES_WEB_ALIAS_ACCESS.EntitiesWebAlias=VCLib.T_ENTITIES_WEB_ALIAS.Alias
inner join VCLib.T_ENTITIES on VCLib.T_ENTITIES_WEB_ALIAS.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_IMPORTLOGITEM
from VCLib.T_IMPORTLOGITEM
inner join VCLib.T_IMPORTLOG on VCLib.T_IMPORTLOGITEM.ImportLogID=VCLib.T_IMPORTLOG.ImportLogID
inner join VCLib.T_ENTITIES on VCLib.T_IMPORTLOG.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ROLE_ATTRIBUTE_ACCESS
from VCLib.T_ROLE_ATTRIBUTE_ACCESS
inner join VCLib.T_HIDDEN_ATTRIBUTE on VCLib.T_ROLE_ATTRIBUTE_ACCESS.HiddenAttribute=VCLib.T_HIDDEN_ATTRIBUTE.HiddenAttributeID
inner join VCLib.T_ENTITIES on VCLib.T_HIDDEN_ATTRIBUTE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_HIDDEN_ATTRIBUTE
from VCLib.T_HIDDEN_ATTRIBUTE
inner join VCLib.T_ENTITIES on VCLib.T_HIDDEN_ATTRIBUTE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_IMPORTLOG
from VCLib.T_IMPORTLOG
inner join VCLib.T_ENTITIES on VCLib.T_IMPORTLOG.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_CLIENT_MODULE_FORM
from VCLib.T_CLIENT_MODULE_FORM
inner join VCLib.T_ENTITIES on VCLib.T_CLIENT_MODULE_FORM.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ENTITIES_WEB_ALIAS
from VCLib.T_ENTITIES_WEB_ALIAS
inner join VCLib.T_ENTITIES on VCLib.T_ENTITIES_WEB_ALIAS.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_EXTRA_UI_COMMAND
from VCLib.T_EXTRA_UI_COMMAND
inner join VCLib.T_ENTITIES on VCLib.T_EXTRA_UI_COMMAND.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_OBJECT_COPY_TEMPLATE
from VCLib.T_OBJECT_COPY_TEMPLATE
inner join VCLib.T_ENTITIES on VCLib.T_OBJECT_COPY_TEMPLATE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_EXTRA_UI_COMMAND
from VCLib.T_EXTRA_UI_COMMAND
inner join VCLib.T_ENTITIES on VCLib.T_EXTRA_UI_COMMAND.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_GENERIC_REPORT
from VCLib.T_GENERIC_REPORT
inner join VCLib.T_ENTITIES on VCLib.T_GENERIC_REPORT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_CASCADE_DELETE_SETTING
from VCLib.T_CASCADE_DELETE_SETTING
inner join VCLib.T_ENTITIES on VCLib.T_CASCADE_DELETE_SETTING.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_NOTIFY_MESSAGE_TYPE
from VCLib.T_NOTIFY_MESSAGE_TYPE
inner join VCLib.T_ENTITIES on VCLib.T_NOTIFY_MESSAGE_TYPE.NotifyEntity=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_NOTIFY_MESSAGE_TYPE
from VCLib.T_NOTIFY_MESSAGE_TYPE
inner join VCLib.T_ENTITIES on VCLib.T_NOTIFY_MESSAGE_TYPE.NotifyEntity=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_NOTIFY_MESSAGE_OBJECT
from VCLib.T_NOTIFY_MESSAGE_OBJECT
inner join VCLib.T_ENTITIES on VCLib.T_NOTIFY_MESSAGE_OBJECT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_PROCESS_ACCESS_ENTRY
from VCLib.T_PROCESS_ACCESS_ENTRY
inner join VCLib.T_ENTITIES on VCLib.T_PROCESS_ACCESS_ENTRY.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_Report
from VCLib.T_Report
inner join VCLib.T_ENTITIES on VCLib.T_Report.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DATAFORM_EXTENSION
from VCLib.T_DATAFORM_EXTENSION
inner join VCLib.T_ENTITIES on VCLib.T_DATAFORM_EXTENSION.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DATA_ACCESS
from VCLib.T_DATA_ACCESS
inner join VCLib.T_ENTITIES on VCLib.T_DATA_ACCESS.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_CLIENT_MODULE_FEATURE
from VCLib.T_CLIENT_MODULE_FEATURE
inner join VCLib.T_ENTITIES on VCLib.T_CLIENT_MODULE_FEATURE.EntityIndex=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DICTIONARY_UPDATE
from VCLib.T_DICTIONARY_UPDATE
inner join VCLib.T_ENTITIES on VCLib.T_DICTIONARY_UPDATE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DATAFORM_TEMPLATE
from VCLib.T_DATAFORM_TEMPLATE
inner join VCLib.T_ENTITIES on VCLib.T_DATAFORM_TEMPLATE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DATAFORM_VALIDATION
from VCLib.T_DATAFORM_VALIDATION
inner join VCLib.T_ENTITIES on VCLib.T_DATAFORM_VALIDATION.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_DTO_MODEL
from VCLib.T_DTO_MODEL
inner join VCLib.T_ENTITIES on VCLib.T_DTO_MODEL.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ENTITY_ACCESS_ENTRY
from VCLib.T_ENTITY_ACCESS_ENTRY
inner join VCLib.T_ENTITIES on VCLib.T_ENTITY_ACCESS_ENTRY.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_TEMPLATE_OVERRIDE
from VCLib.T_TEMPLATE_OVERRIDE
inner join VCLib.T_ENTITIES on VCLib.T_TEMPLATE_OVERRIDE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ENT_ATTR_ACCESS_ENTRY
from VCLib.T_ENT_ATTR_ACCESS_ENTRY
inner join VCLib.T_ENTITIES on VCLib.T_ENT_ATTR_ACCESS_ENTRY.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ENTITIES_ATTRIBUTES
from VCLib.T_ENTITIES_ATTRIBUTES
inner join VCLib.T_ENTITIES on VCLib.T_ENTITIES_ATTRIBUTES.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_TEMPLATE_FIELD
from VCLib.T_TEMPLATE_FIELD
inner join VCLib.T_ENTITIES on VCLib.T_TEMPLATE_FIELD.Entity=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_UNITED_OBJECT_CHANGESET
from VCLib.T_UNITED_OBJECT_CHANGESET
inner join VCLib.T_ENTITIES on VCLib.T_UNITED_OBJECT_CHANGESET.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_USER_SEARCHES
from VCLib.T_USER_SEARCHES
inner join VCLib.T_ENTITIES on VCLib.T_USER_SEARCHES.EntityID=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_EXPORT_TABLE
from VCLib.T_EXPORT_TABLE
inner join VCLib.T_ENTITIES on VCLib.T_EXPORT_TABLE.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_UNITED_OBJECT
from VCLib.T_UNITED_OBJECT
inner join VCLib.T_ENTITIES on VCLib.T_UNITED_OBJECT.Entities=VCLib.T_ENTITIES.EntityID
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';

delete from VCLib.T_ENTITIES
where VCLib.T_ENTITIES.[Schema] = 'FIES' and EntName like 'CHAT%';