-- This file is part of the it-crafts software and is subject to copyright protection.
-- (C) 2022..2025, All rights reserved by Steffen Anders, Elsteraue - Germany
-- Visit also https://www.it-crafts.de.
--

-- --------------------------------------------- aus sa_Fibu2023_Trn_Saldieren.sql

IF OBJECT_ID (N'itcfunc_Prior_Buchungszeilen_Key00', N'FN') IS NOT NULL
  DROP FUNCTION dbo.itcfunc_Prior_Buchungszeilen_Key00
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_Buchungszeilen' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize_Trn_Saldieren')
  DROP INDEX [Ik_Optimize_Trn_Saldieren] ON [dbo].[ut_Buchungszeilen] 
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_Buchungszeilen' and so.[id] = si.[id] and si.[name] = 'Ik_PrjNr_Typ_Konto')
  DROP INDEX [Ik_PrjNr_Typ_Konto] ON [dbo].[ut_Buchungszeilen] 
GO

-- --------------------------------------------- aus hwext.sql

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_BelPos' and so.[id] = si.[id] and si.[name] = 'Ik_ArtikelNr')
  DROP INDEX [Ik_ArtikelNr] ON [ut_BelPos]
GO

IF 0 < (SELECT count(*) from [sysobjects] where [xtype] = 'P'   and [name] = 'hwp_GetLangtext')
  DROP PROCEDURE [dbo].[hwp_GetLangtext]
GO

IF 0 < (SELECT count(*) from [sysobjects] where [xtype] = 'V' and [name] = 'hwv_GueltigeLangtextzeilen')
  DROP VIEW [dbo].[hwv_GueltigeLangtextzeilen]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so  
   on  so.[xtype] = 'U'  and so.[name] = 'ut_Langtextzeilen' and so.[id] = si.[id] and si.[name] = 'Ik_Aktuelle')
  DROP INDEX [Ik_Aktuelle] ON [ut_Langtextzeilen]
GO

-- --------------------------------------------- aus hwext_optimize.sql

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_BelKopfExt' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_BelKopfExt]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_BelPos' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_BelPos]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_BelText' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_BelText]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_BelText' and so.[id] = si.[id] and si.[name] = 'Ik_Key0')
  DROP INDEX [Ik_Key0] ON [dbo].[ut_BelText]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_WartungsObjekte' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_WartungsObjekte]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_WartungsVertraege' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_WartungsVertraege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_WartungsPosten' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_WartungsPosten]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_WartungsPositionen' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_WartungsPositionen]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
	on  so.[xtype] = 'U'  and so.[name] = 'ut_WartungsAnlagen' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_WartungsAnlagen]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_WartungsAuftraege' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize')
  DROP INDEX [Ik_Optimize] ON [dbo].[ut_WartungsAuftraege]
GO

-- ---------------------------------------------- aus sa_Fibu2023_Trn_Saldieren

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_KladdenZeile' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize_Code_TransNo_LfdNr')
  DROP INDEX [Ik_Optimize_Code_TransNo_LfdNr] ON [dbo].[ut_KladdenZeile] 
GO

-- ---------------------------------------------- aus xZeitKladdenZeile_Extension.sql

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_ZeitKladdenZeile' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize_Code_GebZeitw_LfdNr')
  DROP INDEX [Ik_Optimize_Code_GebZeitw_LfdNr] ON [dbo].[ut_ZeitKladdenZeile] 
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_ZeitKladdenZeile' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize_ZeitKladdenZeile_get')
  DROP INDEX [Ik_Optimize_ZeitKladdenZeile_get] ON [dbo].[ut_ZeitKladdenZeile] 
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_ZeitKladdenZeile' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize_ZeitKladdenZeile_get2')
  DROP INDEX [Ik_Optimize_ZeitKladdenZeile_get2] ON [dbo].[ut_ZeitKladdenZeile] 
GO

-- ---------------------------------------------- aus cr_Wartung.sql

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Belege' AND so.[id] = si.[id] AND si.[name] = 'WK_Belege')
  DROP INDEX WK_Belege ON dbo.ut_Belege
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_BelPos' AND so.[id] = si.[id] AND si.[name] = 'WK_BelPos')
  DROP INDEX WK_BelPos ON dbo.ut_BelPos
GO


IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsObjekte' AND so.[id] = si.[id] AND si.[name] = 'WK_WObjekte1')
  DROP INDEX WK_WObjekte1 ON dbo.ut_WartungsObjekte
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsObjekte' AND so.[id] = si.[id] AND si.[name] = 'WK_WObjekte2')
  DROP INDEX WK_WObjekte2 ON dbo.ut_WartungsObjekte
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsObjekte' AND so.[id] = si.[id] AND si.[name] = 'WK_WObjekte3')
  DROP INDEX WK_WObjekte3 ON dbo.ut_WartungsObjekte
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsObjekte' AND so.[id] = si.[id] AND si.[name] = 'WK_WObjekte4')
  DROP INDEX WK_WObjekte4 ON dbo.ut_WartungsObjekte
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsAnlagen' AND so.[id] = si.[id] AND si.[name] = 'WK_WAnlagen1')
  DROP INDEX WK_WAnlagen1 ON dbo.ut_WartungsAnlagen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsAnlagen' AND so.[id] = si.[id] AND si.[name] = 'WK_WAnlagen2')
  DROP INDEX WK_WAnlagen2 ON dbo.ut_WartungsAnlagen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsAnlagen' AND so.[id] = si.[id] AND si.[name] = 'WK_WAnlagen3')
  DROP INDEX WK_WAnlagen3 ON dbo.ut_WartungsAnlagen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsAnlagen' AND so.[id] = si.[id] AND si.[name] = 'WK_WAnlagen4')
  DROP INDEX WK_WAnlagen4 ON dbo.ut_WartungsAnlagen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsDimensionen' AND so.[id] = si.[id] AND si.[name] = 'WK_WDimensionen1')
  DROP INDEX WK_WDimensionen1 ON dbo.ut_WartungsDimensionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
   ON so.[xtype] = 'U' AND so.[name] = 'ut_Adressen' AND so.[id] = si.[id] AND si.[name] = 'WK_Adressen1')
  DROP INDEX WK_Adressen1 ON dbo.ut_Adressen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
   ON so.[xtype] = 'U' AND so.[name] = 'ut_Adressen' AND so.[id] = si.[id] AND si.[name] = 'WK_Adressen2')
  DROP INDEX WK_Adressen2 ON dbo.ut_Adressen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsVertraege' AND so.[id] = si.[id] AND si.[name] = 'WK_WVertraege1')
  DROP INDEX WK_WVertraege1 ON dbo.ut_WartungsVertraege
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsAuftraege' AND so.[id] = si.[id] AND si.[name] = 'WK_WAuftraege1')
  DROP INDEX WK_WAuftraege1 ON dbo.ut_WartungsAuftraege
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsAuftraege' AND so.[id] = si.[id] AND si.[name] = 'WK_WAuftraege2')
  DROP INDEX WK_WAuftraege2 ON dbo.ut_WartungsAuftraege
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsAuftraege' AND so.[id] = si.[id] AND si.[name] = 'WK_WAuftraege3')
  DROP INDEX WK_WAuftraege3 ON dbo.ut_WartungsAuftraege
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsPosten' AND so.[id] = si.[id] AND si.[name] = 'WK_WPosten1')
  DROP INDEX WK_WPosten1 ON dbo.ut_WartungsPosten
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_WartungsPositionen' AND so.[id] = si.[id] AND si.[name] = 'WK_WPositionen1')
  DROP INDEX WK_WPositionen1 ON dbo.ut_WartungsPositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'WK_Stammpositionen')
  DROP INDEX WK_Stammpositionen ON dbo.ut_Stammpositionen
GO

-- ---------------------------------------------- aus alter pamvz.sql

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY0')
  DROP INDEX [Ik_KEY0] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY1')
  DROP INDEX [Ik_KEY1] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY4')
  DROP INDEX [Ik_KEY2] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY3')
  DROP INDEX [Ik_KEY3] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY4')
  DROP INDEX [Ik_KEY4] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY5')
  DROP INDEX [Ik_KEY5] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY6')
  DROP INDEX [Ik_KEY6] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY7')
  DROP INDEX [Ik_KEY7] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY8')
  DROP INDEX [Ik_KEY8] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEY9')
  DROP INDEX [Ik_KEY9] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEYA')
  DROP INDEX [Ik_KEYA] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEYB')
  DROP INDEX [Ik_KEYB] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEYC')
  DROP INDEX [Ik_KEYC] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEYD')
  DROP INDEX [Ik_KEYD] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEYE')
  DROP INDEX [Ik_KEYE] ON [dbo].[ut_Belege]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Belege' and so.[id] = si.[id] and si.[name] = 'Ik_KEYF')
  DROP INDEX [Ik_KEYF] ON [dbo].[ut_Belege]
GO

-- ---------------------------------------------- aus alter pdest.sql

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Adressen' and so.[id] = si.[id] and si.[name] = 'Ik_Key2')
  DROP INDEX [Ik_Key2] ON [dbo].[ut_Adressen]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Adressen' and so.[id] = si.[id] and si.[name] = 'Ik_Key3')
  DROP INDEX [Ik_Key3] ON [dbo].[ut_Adressen]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Adressen' and so.[id] = si.[id] and si.[name] = 'Ik_Key4')
  DROP INDEX [Ik_Key4] ON [dbo].[ut_Adressen]
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on so.[xtype]    = 'U' and so.[name] = 'ut_Adressen' and so.[id] = si.[id] and si.[name] = 'Ik_Key8')
  DROP INDEX [Ik_Key8] ON [dbo].[ut_Adressen]
GO

-- ---------------------------------------------- aus alter pteil.sql

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Primary')
  DROP INDEX Ik_Primary ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Suchen')
  DROP INDEX Ik_Key_Suchen ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Z01')
  DROP INDEX Ik_Key_Z01 ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Z02')
  DROP INDEX Ik_Key_Z02 ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Z03')
  DROP INDEX Ik_Key_Z03 ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Z04')
  DROP INDEX Ik_Key_Z04 ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Z05')
  DROP INDEX Ik_Key_Z05 ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Z06')
  DROP INDEX Ik_Key_Z06 ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Z07')
  DROP INDEX Ik_Key_Z07 ON dbo.ut_Stammpositionen
GO

IF 0 < (SELECT COUNT(*) FROM sysindexes si INNER JOIN sysobjects so 
        ON so.[xtype] = 'U' AND so.[name] = 'ut_Stammpositionen' AND so.[id] = si.[id] AND si.[name] = 'Ik_Key_Z08')
  DROP INDEX Ik_Key_Z08 ON dbo.ut_Stammpositionen
GO

-- ---------------------------------------------- aus xWebUserSession_Extension.sql

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_WebUserSession' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize_Knr_Uid_IPAddress')
  DROP INDEX [Ik_Optimize_Knr_Uid_IPAddress] ON [dbo].[ut_WebUserSession] 
GO

IF 0 < (select count(*) from sysindexes si inner join sysobjects so 
   on  so.[xtype] = 'U'  and so.[name] = 'ut_WebUserSession' and so.[id] = si.[id] and si.[name] = 'Ik_Optimize_SessionId_IPAddress')
  DROP INDEX [Ik_Optimize_SessionId_IPAddress] ON [dbo].[ut_WebUserSession] 
GO
