if exists(select * from sys.indexes i where i.object_id = object_id('AKUZ.T_EMDR_DOC_TYPE', 'U') and i.name = 'IX_EMDR_DOC_TYPE_1')
	DROP INDEX IX_EMDR_DOC_TYPE_1 ON AKUZ.T_EMDR_DOC_TYPE;
go
CREATE INDEX IX_EMDR_DOC_TYPE_1 ON AKUZ.T_EMDR_DOC_TYPE ([SemdEntity], [IsSemd], [ActiveDate]) WITH (FILLFACTOR = 90, SORT_IN_TEMPDB = ON)

if exists ( select * from sys.indexes i where i.object_id = object_id('AKUZ.T_VISIT', 'U') and i.name = 'IX_T_VISIT_DATE')
		DROP INDEX [IX_T_VISIT_DATE] ON [AKUZ].[T_VISIT];
go
CREATE INDEX [IX_T_VISIT_DATE] ON [AKUZ].[T_VISIT] ( [VisitDate], [type_] ) INCLUDE ( [OutcomeRecord], [AmbulanceEvent]) WITH (FILLFACTOR=90, ONLINE=ON, SORT_IN_TEMPDB=ON);
