 IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[HTETKIK]') AND name = N'IX_HTETKIK_HESAPISLIDDURUM')
    BEGIN
       CREATE NONCLUSTERED INDEX [IX_HTETKIK_HESAPISLIDDURUM] ON [dbo].[HTETKIK]
	   (
		   [HESAPISLID] ASC,
		   [DURUM] ASC
	   )
	   INCLUDE ( 	[HDOSYAID],
		   [HTETKIKKARTID],
		   ONAYLI,DISTETKIK,TONAYKULLANICI
		   ) 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_HTETKIK_HESAPISLIDDURUM] ON [dbo].[HTETKIK]
	   (
		   [HESAPISLID] ASC,
		   [DURUM] ASC
	   )
	   INCLUDE ( 	[HDOSYAID],
		   [HTETKIKKARTID],
		   ONAYLI,DISTETKIK,TONAYKULLANICI
		   ) 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
