if exists(select* from sys.indexes i where i.[object_id] = OBJECT_ID('AKUZ.T_HOSPITAL_DESTINATION', 'U') and i.name = 'IX_HOSPITAL_DESTINATION_ExecutionDivision')
	drop index IX_HOSPITAL_DESTINATION_ExecutionDivision on AKUZ.T_HOSPITAL_DESTINATION;
go
	CREATE INDEX IX_HOSPITAL_DESTINATION_ExecutionDivision ON AKUZ.T_HOSPITAL_DESTINATION (ExecutionDivision, CancelDateTime) WHERE CancelDateTime IS NULL;
go

if exists(select* from sys.indexes i where i.[object_id] = OBJECT_ID('AKUZ.T_DESTINATION_EXECUTE_ELEMENT', 'U') and i.name = 'IX_DESTINATION_EXECUTE_ELEMENT_HospitalDestination')
	drop index IX_DESTINATION_EXECUTE_ELEMENT_HospitalDestination on AKUZ.T_DESTINATION_EXECUTE_ELEMENT;
go
    CREATE INDEX [IX_DESTINATION_EXECUTE_ELEMENT_HospitalDestination] ON [AKUZ].[T_DESTINATION_EXECUTE_ELEMENT] ( [HospitalDestination], [DeclareDateTime] ) INCLUDE ([ElementText], [ShowRealDeclareDateTime]) WITH (FILLFACTOR=90, SORT_IN_TEMPDB=ON);
go
