 IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[HRANDEVU]') AND name = N'IX_HRANDEVU_DRID_RTARIH_RSAAT')
    BEGIN
	   CREATE NONCLUSTERED INDEX [IX_HRANDEVU_DRID_RTARIH_RSAAT] ON [dbo].[HRANDEVU]
	   (
		   [DRID] ASC,
		   [RTARIH] ASC,
		   [RSAAT] ASC,
		   [RANDEVUID] ASC,
		   [SALONID] ASC
	   )
	   INCLUDE
	   (
		   [KIMLIKID],
		   [RNEDENID],
		   [RSURE],
		   [RANDDURUMID],
		   [RACIKLAMA],
		   [ADISOYADI],
		   [TEL],
		   [HMUAYENEISLID],
		   [SIRANO],
		   [SGKULLANICI],
		   [WEB]
	   )
	   WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = ON, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
END
ELSE
BEGIN
	   CREATE NONCLUSTERED INDEX [IX_HRANDEVU_DRID_RTARIH_RSAAT] ON [dbo].[HRANDEVU]
	   (
		   [DRID] ASC,
		   [RTARIH] ASC,
		   [RSAAT] ASC,
		   [RANDEVUID] ASC,
		   [SALONID] ASC
	   )
	   INCLUDE
	   (
		   [KIMLIKID],
		   [RNEDENID],
		   [RSURE],
		   [RANDDURUMID],
		   [RACIKLAMA],
		   [ADISOYADI],
		   [TEL],
		   [HMUAYENEISLID],
		   [SIRANO],
		   [SGKULLANICI],
		   [WEB]
	   )
	   WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
END