if exists(select * from sys.indexes i where i.[object_id] = OBJECT_ID('AKUZ.T_CDA_DOCUMENT', 'U') and i.name = 'IX_CDA_DOCUMENT_RecordTarget')
	drop index IX_CDA_DOCUMENT_RecordTarget on AKUZ.T_CDA_DOCUMENT;
go
CREATE INDEX [IX_CDA_DOCUMENT_RecordTarget] ON [AKUZ].[T_CDA_DOCUMENT] ([RecordTarget]) WHERE ([RecordTarget] IS NOT NULL)  WITH (FILLFACTOR=100,SORT_IN_TEMPDB=ON);

if exists(select * from sys.indexes i where i.[object_id] = OBJECT_ID('AKUZ.T_EXAMINATION_TYPE_LINK', 'U') and i.name = 'IX_EXAMINATION_TYPE_LINK_Status_Includes')
	drop index IX_EXAMINATION_TYPE_LINK_Status_Includes on AKUZ.T_EXAMINATION_TYPE_LINK;
go
CREATE INDEX [IX_EXAMINATION_TYPE_LINK_Status_Includes] ON [AKUZ].[T_EXAMINATION_TYPE_LINK] ([Status])  INCLUDE ([ExaminationBase], [ExecutionDate]) WITH (FILLFACTOR=100,SORT_IN_TEMPDB=ON, MAXDOP = 0);

if exists(select * from sys.indexes i where i.[object_id] = OBJECT_ID('AKUZ.T_DIAGNOSTICS_RESULTS_DEVICE', 'U') and i.name = 'IX_DIAGNOSTICS_RESULTS_DEVICE_DiagnosticsResults')
	drop index IX_DIAGNOSTICS_RESULTS_DEVICE_DiagnosticsResults on AKUZ.T_DIAGNOSTICS_RESULTS_DEVICE;
go
CREATE INDEX [IX_DIAGNOSTICS_RESULTS_DEVICE_DiagnosticsResults] ON [AKUZ].[T_DIAGNOSTICS_RESULTS_DEVICE] ([DiagnosticsResults])  WITH (SORT_IN_TEMPDB=ON, MAXDOP = 0);