IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[HESAPISL]') AND name = N'IX_HESAPISL_IPTAL_ONAYLI_TEKLIF_HSTODEMESIZYAP_ITARIH_ISTDRID')
BEGIN
	CREATE NONCLUSTERED INDEX IX_HESAPISL_IPTAL_ONAYLI_TEKLIF_HSTODEMESIZYAP_ITARIH_ISTDRID
	ON [dbo].[HESAPISL] 
	([ITEMID],[IPTAL],[ONAYLI],[TEKLIF],[HSTODEMESIZYAP],[ITARIH],[ISTDRID],[HESAPISLID],[ISTBOLUMID],[UYGBOLUMID],[UYGDRID])
	INCLUDE ([HDOSYAID],[ADET],[FIYAT],[DOVIZKODU],[KRMHFATISLID],[OZELHFATISLID],[ACIKLAMA],[OZELODENDI],[KRMODENDI],[KYTARIH],[KYKULLANICI],[SGFATID],[SGODENDI],[MDLISLEMSIRANO],[HIKRMNETTUTAR],[HIHSTNETTUTAR],[HISGNETTUTAR],[HSTISLEMSIRANO],[HSTSONUCSIRANO],[HSTSONUCGOSTTRH],[HSTSONUCGOSTDRM],[MDLOZELDURUMKOD],[SNKAYDET]
	)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_HESAPISL_IPTAL_ONAYLI_TEKLIF_HSTODEMESIZYAP_ITARIH_ISTDRID
	ON [dbo].[HESAPISL] 
	([ITEMID],[IPTAL],[ONAYLI],[TEKLIF],[HSTODEMESIZYAP],[ITARIH],[ISTDRID],[HESAPISLID],[ISTBOLUMID],[UYGBOLUMID],[UYGDRID])
	INCLUDE ([HDOSYAID],[ADET],[FIYAT],[DOVIZKODU],[KRMHFATISLID],[OZELHFATISLID],[ACIKLAMA],[OZELODENDI],[KRMODENDI],[KYTARIH],[KYKULLANICI],[SGFATID],[SGODENDI],[MDLISLEMSIRANO],[HIKRMNETTUTAR],[HIHSTNETTUTAR],[HISGNETTUTAR],[HSTISLEMSIRANO],[HSTSONUCSIRANO],[HSTSONUCGOSTTRH],[HSTSONUCGOSTDRM],[MDLOZELDURUMKOD],[SNKAYDET]
	)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