delete from IES.T_DICTIONARY_LIST_ROLES
from IES.T_DICTIONARY_LIST_ROLES
inner join IES.T_DICTIONARY_LIST on IES.T_DICTIONARY_LIST_ROLES.DictionaryList=IES.T_DICTIONARY_LIST.DictionaryListID
inner join VCLib.T_ENTITIES on IES.T_DICTIONARY_LIST.Entities=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

delete from IES.T_DICTIONARY_LIST
from IES.T_DICTIONARY_LIST
inner join VCLib.T_ENTITIES on IES.T_DICTIONARY_LIST.Entities=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


delete from IES.T_HIDDEN_FILTER_ROLES
from IES.T_HIDDEN_FILTER_ROLES
inner join IES.T_HIDDEN_FILTER on IES.T_HIDDEN_FILTER_ROLES.HiddenFilter=IES.T_HIDDEN_FILTER.HiddenFilterID
inner join VCLib.T_ENTITIES on IES.T_HIDDEN_FILTER.Entities=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

delete from IES.T_HIDDEN_FILTER
from IES.T_HIDDEN_FILTER
inner join VCLib.T_ENTITIES on IES.T_HIDDEN_FILTER.Entities=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


delete from IES.T_LISTS_ENTITY_USERS_GROUP
from IES.T_LISTS_ENTITY_USERS_GROUP
inner join IES.T_LISTS_ENTITY on IES.T_LISTS_ENTITY_USERS_GROUP.ListsEntity=IES.T_LISTS_ENTITY.ListsEntityID
inner join VCLib.T_ENTITIES on IES.T_LISTS_ENTITY.Entities=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

delete from IES.T_LISTS_ENTITY
from IES.T_LISTS_ENTITY
inner join VCLib.T_ENTITIES on IES.T_LISTS_ENTITY.Entities=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');



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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


delete from VCLib.T_ENT_ATTR_ACCESS_ENTRY
from VCLib.T_ENT_ATTR_ACCESS_ENTRY
inner join VCLib.T_BASE_ACCESS_ENTRY on VCLib.T_ENT_ATTR_ACCESS_ENTRY.EntryID=VCLib.T_BASE_ACCESS_ENTRY.EntryID
inner join VCLib.T_ENTITIES on VCLib.T_BASE_ACCESS_ENTRY.type_=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

delete from VCLib.T_ENTITY_ACCESS_ENTRY
from VCLib.T_ENTITY_ACCESS_ENTRY
inner join VCLib.T_BASE_ACCESS_ENTRY on VCLib.T_ENTITY_ACCESS_ENTRY.EntryID=VCLib.T_BASE_ACCESS_ENTRY.EntryID
inner join VCLib.T_ENTITIES on VCLib.T_BASE_ACCESS_ENTRY.type_=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

delete from VCLib.T_BASE_ACCESS_ENTRY
from VCLib.T_BASE_ACCESS_ENTRY
inner join VCLib.T_ENTITIES on VCLib.T_BASE_ACCESS_ENTRY.type_=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

delete from VCLib.T_DTO_ITEM
from VCLib.T_DTO_ITEM
inner join VCLib.T_DTO_MODEL on VCLib.T_DTO_ITEM.DtoModel=VCLib.T_DTO_MODEL.DtoModelID
inner join VCLib.T_ENTITIES on VCLib.T_DTO_MODEL.Entities=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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.EntitiesWebAliasID
inner join VCLib.T_ENTITIES on VCLib.T_ENTITIES_WEB_ALIAS.Entities=VCLib.T_ENTITIES.EntityID
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');


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 (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

delete from VCLib.T_ENTITIES
 where (EntName = 'MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED');

 drop table ies.T_MEDICAL_EXPERTISE_SCHET_SLUCH_ACCOMPLISHED;