USE [master]
GO
/****** Object:  Database [CentronVOED2]    Script Date: 11.11.2025 11:20:25 ******/
CREATE DATABASE [CentronVOED2]
 CONTAINMENT = NONE
 ON  PRIMARY 
( NAME = N'CentronLeerDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\CentronVOED2.mdf' , SIZE = 15852992KB , MAXSIZE = UNLIMITED, FILEGROWTH = 102400KB )
 LOG ON 
( NAME = N'CentronLeerDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\CentronVOED2_0.ldf' , SIZE = 3687424KB , MAXSIZE = 2048GB , FILEGROWTH = 102400KB )
 WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF
GO
ALTER DATABASE [CentronVOED2] SET COMPATIBILITY_LEVEL = 160
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [CentronVOED2].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [CentronVOED2] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [CentronVOED2] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [CentronVOED2] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [CentronVOED2] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [CentronVOED2] SET ARITHABORT OFF 
GO
ALTER DATABASE [CentronVOED2] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [CentronVOED2] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [CentronVOED2] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [CentronVOED2] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [CentronVOED2] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [CentronVOED2] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [CentronVOED2] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [CentronVOED2] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [CentronVOED2] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [CentronVOED2] SET  DISABLE_BROKER 
GO
ALTER DATABASE [CentronVOED2] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [CentronVOED2] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [CentronVOED2] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [CentronVOED2] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [CentronVOED2] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [CentronVOED2] SET READ_COMMITTED_SNAPSHOT OFF 
GO
ALTER DATABASE [CentronVOED2] SET HONOR_BROKER_PRIORITY OFF 
GO
ALTER DATABASE [CentronVOED2] SET RECOVERY SIMPLE 
GO
ALTER DATABASE [CentronVOED2] SET  MULTI_USER 
GO
ALTER DATABASE [CentronVOED2] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [CentronVOED2] SET DB_CHAINING OFF 
GO
ALTER DATABASE [CentronVOED2] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
GO
ALTER DATABASE [CentronVOED2] SET TARGET_RECOVERY_TIME = 0 SECONDS 
GO
ALTER DATABASE [CentronVOED2] SET DELAYED_DURABILITY = DISABLED 
GO
ALTER DATABASE [CentronVOED2] SET ACCELERATED_DATABASE_RECOVERY = OFF  
GO
EXEC sys.sp_db_vardecimal_storage_format N'CentronVOED2', N'ON'
GO
ALTER DATABASE [CentronVOED2] SET QUERY_STORE = OFF
GO
USE [CentronVOED2]
GO
/****** Object:  User [LeerDB]    Script Date: 11.11.2025 11:20:25 ******/
CREATE USER [LeerDB] WITHOUT LOGIN WITH DEFAULT_SCHEMA=[dbo]
GO
/****** Object:  User [crm7]    Script Date: 11.11.2025 11:20:25 ******/
CREATE USER [crm7] WITHOUT LOGIN WITH DEFAULT_SCHEMA=[dbo]
GO
/****** Object:  User [CentronDemoUser]    Script Date: 11.11.2025 11:20:25 ******/
CREATE USER [CentronDemoUser] WITHOUT LOGIN WITH DEFAULT_SCHEMA=[dbo]
GO
/****** Object:  User [centron]    Script Date: 11.11.2025 11:20:25 ******/
CREATE USER [centron] WITHOUT LOGIN WITH DEFAULT_SCHEMA=[dbo]
GO
/****** Object:  User [admin]    Script Date: 11.11.2025 11:20:25 ******/
CREATE USER [admin] FOR LOGIN [admin] WITH DEFAULT_SCHEMA=[dbo]
GO
ALTER ROLE [db_owner] ADD MEMBER [LeerDB]
GO
ALTER ROLE [db_datareader] ADD MEMBER [LeerDB]
GO
ALTER ROLE [db_datawriter] ADD MEMBER [LeerDB]
GO
ALTER ROLE [db_owner] ADD MEMBER [CentronDemoUser]
GO
ALTER ROLE [db_datareader] ADD MEMBER [CentronDemoUser]
GO
ALTER ROLE [db_datawriter] ADD MEMBER [CentronDemoUser]
GO
ALTER ROLE [db_owner] ADD MEMBER [centron]
GO
ALTER ROLE [db_owner] ADD MEMBER [admin]
GO
ALTER ROLE [db_accessadmin] ADD MEMBER [admin]
GO
ALTER ROLE [db_securityadmin] ADD MEMBER [admin]
GO
ALTER ROLE [db_ddladmin] ADD MEMBER [admin]
GO
ALTER ROLE [db_backupoperator] ADD MEMBER [admin]
GO
ALTER ROLE [db_datareader] ADD MEMBER [admin]
GO
ALTER ROLE [db_datawriter] ADD MEMBER [admin]
GO
ALTER ROLE [db_denydatareader] ADD MEMBER [admin]
GO
ALTER ROLE [db_denydatawriter] ADD MEMBER [admin]
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_ArticleCount]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_ArticleCount] 
        (@ArtikelI3D int,	@LagerI3D int) 
RETURNS float 
AS 
-- bei der Neuentwicklung statt dies Function 
-- join mit view cvw_ArticleCount benutzen 
BEGIN 
   DECLARE @cnt float 
   IF @LagerI3D = -2 
      SET @cnt =  (select sum(ac.cnt) from cvw_ArticleCount ac where ac.ArtikelI3D = @ArtikelI3D) 
   ELSE IF @LagerI3D = 0 
      SET @cnt =  (select sum(ac.cnt) from cvw_ArticleCount ac where ac.ArtikelI3D = @ArtikelI3D and ac.LagerI3D > 0) 
   ELSE	SET @cnt = (select ac.cnt from cvw_ArticleCount ac where ac.ArtikelI3D = @ArtikelI3D and ac.LagerI3D = @LagerI3D) 
   RETURN @cnt 
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_AuftragsBestand]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[cfn_AuftragsBestand] 
	(@ArtikelI3D int,	@LagerI3D int) 
 RETURNS float  
 AS 
BEGIN  
	DECLARE @AuftragBestand float  
  IF @LagerI3D = -2 
  	SET @AuftragBestand = 
	 		(SELECT  SUM(ap.Stk - ISNULL(ap.Liefermenge,0)) 
				FROM AufPos ap 
				INNER JOIN AufKopf ak ON ak.I3D = ap.AufKopfI3D 
				WHERE ak.Status = 1 
					AND ap.ArtikelI3D = @ArtikelI3D 
                    AND ak.Nummer > 0)  
  ELSE IF @LagerI3D = 0 
  		SET @AuftragBestand = 
	 			(SELECT SUM(ap.Stk - ISNULL(ap.Liefermenge,0)) 
					FROM AufPos ap 
					INNER JOIN AufKopf ak ON ak.I3D = ap.AufKopfI3D 
					WHERE ak.Status = 1 
						AND ap.NebenlagerI3D > 0 
						AND ap.ArtikelI3D = @ArtikelI3D 
                        AND ak.Nummer > 0)  
  ELSE 
  		SET @AuftragBestand = 
	 			(SELECT  SUM(ap.Stk - ISNULL(ap.Liefermenge,0)) 
					FROM AufPos ap 
					INNER JOIN AufKopf ak ON ak.I3D = ap.AufKopfI3D 
					WHERE ak.Status = 1 
						AND ap.NebenlagerI3D = @LagerI3D 
						AND ap.ArtikelI3D = @ArtikelI3D
                        AND ak.Nummer > 0) 
 RETURN ISNULL(@AuftragBestand,0) 
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_BarcodeCount]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_BarcodeCount]  
	(@ArtikelI3D int,	@LagerI3D int)
RETURNS int 
AS
BEGIN
	DECLARE @cnt int 
	IF @LagerI3D = -2 
		SET @cnt =  (select count(barcode) from barcode b where b.Status in (1,2,8) and b.ArtikelI3D = @ArtikelI3D )
	ELSE IF @LagerI3D = 0
		SET @cnt =  (select count(barcode) from barcode b where b.Status in (1,2,8) and b.ArtikelI3D = @ArtikelI3D and b.LagerI3D > 0) 
	ELSE	SET @cnt = (select count(barcode) from barcode b where b.Status in (1,2,8) and b.ArtikelI3D = @ArtikelI3D and ISNULL(b.LagerI3D,-1) = @LagerI3D) 
	RETURN @cnt 
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_CalculateNetPrice]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_CalculateNetPrice]
(
	@BasePrice float,
	@Precision int,
	@Discount float,
	@CurrencyFactor float = 1,
	@IsFC bit = 0
)
RETURNS decimal(24,7)
AS
BEGIN
	RETURN ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * CASE WHEN @IsFC = 1 THEN @CurrencyFactor ELSE 1 END, @Precision) * ((100 - @Discount) / 100)), @Precision)
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_CalculateNetTotalPrice]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_CalculateNetTotalPrice] 
(
	@BasePrice float,
	@Precision int,
	@Discount float,
	@CurrencyFactor float = 1,
	@IsFC bit = 0,
	@Quantity float,
	@QuantityProcessed float
)
RETURNS DECIMAL(19,2)
AS
BEGIN
	RETURN ROUND(CONVERT(DECIMAL(24, 7), 
		CASE WHEN @Precision = -1 THEN
			@BasePrice * CASE WHEN @IsFC = 1 THEN @CurrencyFactor ELSE 1 END * ((100 - @Discount) / 100)
		ELSE
			dbo.cfn_CalculateNetPrice(@BasePrice, @Precision, @Discount, @CurrencyFactor, @IsFC)
		END * (@Quantity - @QuantityProcessed)),2)
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_CalculateReceiptSpecialPosition]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[cfn_CalculateReceiptSpecialPosition]
(
	@ReceiptI3D int,
	@ReceiptKind int,
	@ReceiptPositionI3D int,
	@ReceiptPositionKind int,
	@ReceiptPositionExpanded int,
	@PriceGroupKind int
)
RETURNS decimal(19,4)
AS
BEGIN
	DECLARE @tablePrefix nvarchar(16),
			@tableCursor cursor,
			@PriceField nvarchar(16),
			@TaxPriceField nvarchar(16),
			@SqlQuery nvarchar(max),
			@ValueKind int = 0,
			@IsUnitPrice bit = 0;

	IF @ReceiptPositionKind = 1 AND @ReceiptPositionExpanded IS NOT NULL BEGIN
		SET @ValueKind = 1;
	END ELSE IF @ReceiptPositionKind = 6 BEGIN
		SET @ValueKind = 2;
	END ELSE IF @ReceiptPositionKind = 5 BEGIN
		SET @ValueKind = 3;
	END ELSE IF @ReceiptPositionKind = 4 BEGIN
		SET @ValueKind = 4;
	END ELSE IF ISNULL(@ReceiptPositionKind,0) = 0 BEGIN
		SET @ValueKind = 5;
	END ELSE BEGIN
		RETURN NULL;
	END

	IF @PriceGroupKind > 8 BEGIN
		-- Einzelpreisberechnung nur bei Stückliste
		IF @ValueKind <> 1 BEGIN
			RETURN NULL
		END ELSE BEGIn
			SET @IsUnitPrice = 1;
			SET @PriceGroupKind = @PriceGroupKind - 4;
		END
	END

	IF @ReceiptKind = 1 BEGIN 
		SET @tableCursor = cursor for SELECT I3D, Expanded, Indent, GroupID, ISNULL(ArticlePositionKind,0) AS ArticlePositionKind, Kind, NetPriceTotal, TaxPriceTotal, NetPriceTotalFC, TaxPriceTotalFC, NetPriceTotal AS NetPriceTotalComplete, TaxPriceTotal AS TaxPriceTotalComplete, NetPriceTotalFC AS NetPriceTotalFCComplete, TaxPriceTotalFC AS TaxPriceTotalFCComplete, QuantityComplete FROM cvw_OfferPos WHERE HeadI3D = @ReceiptI3D ORDER BY InternalPosition
	END ELSE IF @ReceiptKind = 2 BEGIN
		SET @tableCursor = cursor for SELECT I3D, Expanded, Indent, GroupID, ISNULL(ArticlePositionKind,0) AS ArticlePositionKind, Kind, NetPriceTotal, TaxPriceTotal, NetPriceTotalFC, TaxPriceTotalFC, NetPriceTotalComplete, TaxPriceTotalComplete, NetPriceTotalFCComplete, TaxPriceTotalFCComplete, QuantityComplete FROM cvw_OrderPos WHERE HeadI3D = @ReceiptI3D ORDER BY InternalPosition
	END ELSE IF @ReceiptKind = 3 BEGIN
		SET @tableCursor = cursor for SELECT I3D, Expanded, Indent, GroupID, ISNULL(ArticlePositionKind,0) AS ArticlePositionKind, Kind, NetPriceTotal, TaxPriceTotal, NetPriceTotalFC, TaxPriceTotalFC, NetPriceTotalComplete, TaxPriceTotalComplete, NetPriceTotalFCComplete, TaxPriceTotalFCComplete, QuantityComplete FROM cvw_DeliveryListPos WHERE HeadI3D = @ReceiptI3D ORDER BY InternalPosition
	END ELSE IF @ReceiptKind = 4 BEGIN
		SET @tableCursor = cursor for SELECT I3D, Expanded, Indent, GroupID, ISNULL(ArticlePositionKind,0) AS ArticlePositionKind, Kind, NetPriceTotal, TaxPriceTotal, NetPriceTotalFC, TaxPriceTotalFC, NetPriceTotalComplete, TaxPriceTotalComplete, NetPriceTotalFCComplete, TaxPriceTotalFCComplete, QuantityComplete FROM cvw_InvoicePos WHERE HeadI3D = @ReceiptI3D ORDER BY InternalPosition
	END ELSE IF @ReceiptKind = 5 BEGIN
		SET @tableCursor = cursor for SELECT I3D, Expanded, Indent, GroupID, ISNULL(ArticlePositionKind,0) AS ArticlePositionKind, Kind, NetPriceTotal, TaxPriceTotal, NetPriceTotalFC, TaxPriceTotalFC, NetPriceTotal AS NetPriceTotalComplete, TaxPriceTotal AS TaxPriceTotalComplete, NetPriceTotalFC AS NetPriceTotalFCComplete, TaxPriceTotalFC AS TaxPriceTotalFCComplete, QuantityComplete FROM cvw_PickupListPos WHERE HeadI3D = @ReceiptI3D ORDER BY InternalPosition
	END ELSE IF @ReceiptKind = 6 BEGIN
		SET @tableCursor = cursor for SELECT I3D, Expanded, Indent, GroupID, ISNULL(ArticlePositionKind,0) AS ArticlePositionKind, Kind, NetPriceTotal, TaxPriceTotal, NetPriceTotalFC, TaxPriceTotalFC, NetPriceTotal AS NetPriceTotalComplete, TaxPriceTotal AS TaxPriceTotalComplete, NetPriceTotalFC AS NetPriceTotalFCComplete, TaxPriceTotalFC AS TaxPriceTotalFCComplete, QuantityComplete FROM cvw_CreditVoucherPos WHERE HeadI3D = @ReceiptI3D ORDER BY InternalPosition
	END ELSE IF @ReceiptKind = 22 BEGIN
		SET @tableCursor = cursor for SELECT I3D, Expanded, Indent, GroupID, ISNULL(ArticlePositionKind,0) AS ArticlePositionKind, Kind, NetPriceTotal, TaxPriceTotal, NetPriceTotalFC, TaxPriceTotalFC, NetPriceTotalComplete, TaxPriceTotalComplete, NetPriceTotalFCComplete, TaxPriceTotalFCComplete, QuantityComplete FROM cvw_ContractPos WHERE HeadI3D = @ReceiptI3D ORDER BY InternalPosition
	END ELSE BEGIN
		RETURN NULL;
	END

	DECLARE @I3D int, 
			@Expanded int, 
			@Indent int, 
			@GroupID int, 
			@ArticlePositionKind int, 
			@Kind int,
			@NetPriceTotal decimal(19,2),
			@TaxPriceTotal decimal(19,4),
			@NetPriceTotalFC decimal(19,2),
			@TaxPriceTotalFC decimal(19,4),
			@NetPriceTotalComplete decimal(19,2),
			@TaxPriceTotalComplete decimal(19,4),
			@NetPriceTotalFCComplete decimal(19,2),
			@TaxPriceTotalFCComplete decimal(19,4),
			@QuantityComplete decimal(19,7),
			@ResultPrice decimal(19,4) = 0,
			@CountValue bit,
			@PartListIndent int = -1,
			@UnitPriceCalculationQuantity decimal(19,7) = 0,
			@CurrentGroupID int = -1

	OPEN @tableCursor

	FETCH NEXT FROM @tableCursor INTO @I3D, @Expanded, @Indent, @GroupID, @ArticlePositionKind, @Kind, @NetPriceTotal, @TaxPriceTotal, @NetPriceTotalFC, @TaxPriceTotalFC, @NetPriceTotalComplete, @TaxPriceTotalComplete, @NetPriceTotalFCComplete, @TaxPriceTotalFCComplete, @QuantityComplete
	WHILE @@FETCH_STATUS = 0 BEGIN
		SET @CountValue = 0;
		IF @ValueKind = 1 BEGIN
			-- Partlist
			IF @I3D = @ReceiptPositionI3D BEGIN
				SET @PartListIndent = @Indent;
				SET @UnitPriceCalculationQuantity = @QuantityComplete
			END ELSE BEGIN
				IF @PartListIndent >= 0 BEGIN
					IF @Indent > @PartListIndent BEGIN
						SET @CountValue = 1;
					END ELSE BEGIN
						SET @PartListIndent = -1;
					END
				END
			END
		END ELSE IF @ValueKind = 2 BEGIN
			-- Titelposition
			IF @I3D = @ReceiptPositionI3D BEGIN
				SET @PartListIndent = 0;
			END ELSE BEGIn
				IF @PartListIndent = 0 BEGIN
					IF @Kind = 6 BEGIN
						SET @PartListIndent = -1;
					END ELSE BEGIn
						SET @CountValue = 1;
					END
				END
			END
		END ELSE IF @ValueKind = 3 BEGIN
			-- Partsummary
			IF @I3D = @ReceiptPositionI3D BEGIN
				SET @PartListIndent = -2;
			END ELSE BEGIN
				IF @PartListIndent = -1 BEGIN
					IF @Kind = 5 BEGIN
						SET @ResultPrice = 0;
					END ELSE BEGIN
						SET @CountValue = 1;
					END
				END
			END
		END ELSE IF @ValueKind = 4 BEGIN
			-- Completesummary
			IF @I3D = @ReceiptPositionI3D BEGIN
				SET @PartListIndent = -2;
			END ELSE BEGIN
				IF @PartListIndent = -1 BEGIN
					SET @CountValue = 1
				END
			END
		END ELSE IF @ValueKind = 5 BEGIn
			-- Group
			IF @I3D = @ReceiptPositionI3D BEGIN
				SET @PartListIndent = -2;
			END ELSE BEGIN
				IF @PartListIndent = -1 BEGIN
					IF ISNULL(@GroupID,0) > 0 BEGIN
						IF @CurrentGroupID = -1 OR @CurrentGroupID <> @GroupID BEGIN
							SET @CurrentGroupID = @GroupID;
							SET @ResultPrice = 0;
						END;
						SET @CountValue = 1;
					END ELSE BEGIn
						SET @ResultPrice = 0;
					END
				END
			END
		END


		IF @CountValue = 1 AND @Expanded IS NULL AND @Kind IN (1,3) AND (@ArticlePositionKind IN (0,50) OR (@IsUnitPrice = 1)) BEGIN
			SET @ResultPrice = @ResultPrice + CASE 
				WHEN @PriceGroupKind = 1 THEN @NetPriceTotal 
				WHEN @PriceGroupKind = 2 THEN @TaxPriceTotal 
				WHEN @PriceGroupKind = 3 THEN @NetPriceTotalFC 
				WHEN @PriceGroupKind = 4 THEN @TaxPriceTotalFC 
				WHEN @PriceGroupKind = 5 THEN @NetPriceTotalComplete 
				WHEN @PriceGroupKind = 6 THEN @TaxPriceTotalComplete 
				WHEN @PriceGroupKind = 7 THEN @NetPriceTotalFCComplete 
				WHEN @PriceGroupKind = 8 THEN @TaxPriceTotalFCComplete 
				ELSE 0 END;
		END
		FETCH NEXT FROM @tableCursor INTO @I3D, @Expanded, @Indent, @GroupID, @ArticlePositionKind, @Kind, @NetPriceTotal, @TaxPriceTotal, @NetPriceTotalFC, @TaxPriceTotalFC, @NetPriceTotalComplete, @TaxPriceTotalComplete, @NetPriceTotalFCComplete, @TaxPriceTotalFCComplete, @QuantityComplete
	END

	IF @IsUnitPrice = 1 BEGIN
		IF @UnitPriceCalculationQuantity <> 0 BEGIN
			SET @ResultPrice = @ResultPrice / @UnitPriceCalculationQuantity
		END;
		IF @PriceGroupKind IN (5,7) BEGIN
			SET @ResultPrice = ROUND(@ResultPrice,2);
		END
	END

	RETURN @ResultPrice
END
      
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_CalculateTaxPrice]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_CalculateTaxPrice]
(
	@BasePrice float,
	@Precision int,
	@Discount float,
	@CurrencyFactor float = 1,
	@IsFC bit = 0,
	@TaxRate float,
	@IsCashReceipt bit
)
RETURNS DECIMAL(19,7)
AS
BEGIN
	RETURN CONVERT(DECIMAL(19, 7) , CASE 
						WHEN @IsCashReceipt = 1 THEN
							ROUND(CONVERT(DECIMAL(24,7),(@BasePrice * CASE WHEN @IsFC = 1 THEN @CurrencyFactor ELSE 1 END * ((100 - @Discount) / 100)) * (@TaxRate / 100)), 2)
						ELSE
							dbo.cfn_CalculateNetPrice(@BasePrice, @Precision, @Discount, @CurrencyFactor, @IsFC) * (@TaxRate / 100)
						END)
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_CalculateTaxPriceTotal]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_CalculateTaxPriceTotal]
(
	@BasePrice float,
	@Precision int,
	@Discount float,
	@CurrencyFactor float = 1,
	@IsFC bit = 0,
	@TaxRate float,
	@IsCashReceipt bit,
	@Quantity float,
	@QuantityProcessed float
)
RETURNS DECIMAL(19,4)
AS
BEGIN
	RETURN CONVERT(DECIMAL(19,4), 
		CASE WHEN @IsCashReceipt = 1 THEN
			ROUND(CONVERT(DECIMAL(19,4),dbo.cfn_CalculateTaxPrice(@BasePrice, @Precision, @Discount, @CurrencyFactor, @IsFC, @TaxRate, @IsCashReceipt) * (@Quantity - @QuantityProcessed)), 2)
		ELSE
			dbo.cfn_CalculateNetTotalPrice(@BasePrice, @Precision, @Discount, @CurrencyFactor, @IsFC, @Quantity, @QuantityProcessed) * (@TaxRate / 100)
		END)
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_ContingentState]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE  FUNCTION  [dbo].[cfn_ContingentState] 
( @parContractID Int = 0, @parCustomerID Int = 0) 
RETURNS @ret TABLE   
	(ContractI3D int  
	,ContingentKind int 
	,dtFrom datetime  
	,dtTo   datetime  
	,BookValue  decimal(19,6)  
	,RestValue  decimal(19,6) 
	,UseValue decimal(19,6)  
	,ReservedValue decimal(19,6))  
AS  
-- 11622
BEGIN 
DECLARE @minContractID Int,  
		@maxContractID Int, 
		@minCustomerID Int, 
		@maxCustomerID Int  
	
SET @minContractID = 0 
SET @maxContractID = 2147483647   
SET @minCustomerID = 0  
SET @maxCustomerID = 2147483647 

IF @parContractID > 0 BEGIN   
                              
	SET @minContractID = @parContractID  
	SET @maxContractID = @parContractID  
END  
IF @parCustomerID > 0 BEGIN  
	SET @minCustomerID = @parCustomerID 
	SET @maxCustomerID = @parCustomerID 
END 

DECLARE @ContingentCondition TABLE  
				(Number int
				,ContractI3D int 
				,ContingentKind int   
				,dtFrom datetime  
				,dtTo   datetime  
				,ContingentValue  decimal(19,6) 
				,Rest   decimal(19,6)  
	            ,RestTake int
				,ContractRestTake int
				,AddValue decimal(19,6) 
				,UsedValue decimal(19,6)  
				,Reserved decimal(19,6)) 

DECLARE	@ContingentAdd TABLE  
				(ContractI3D int, 
				ContingentKind int,  
				Value  decimal(19,6))  

-- letzte Abrechnung-RE (auto, manuel, nachbedarf) 
INSERT INTO  @ContingentCondition  
				(Number, ContractI3D, ContingentKind, dtFrom, dtTo, ContingentValue, Rest, RestTake, ContractRestTake, AddValue)   
	select c.Number, c.I3D, IsNull(cb.ContingentKind,c.ContingentKind),  cb.BookedFrom, cb.BookedTo,  
	CASE WHEN  c.TakeRest = 0 and cb.BookedTo+1 < GETDATE() THEN 0 ELSE cb.ContingentValue END ContingentValue, 
	CASE WHEN  c.TakeRest = 0 and cb.BookedTo+1 < GETDATE() THEN 0 ELSE cb.RestValue END RestValue, 
	cb.RestTake,
	 c.TakeRest ContractRestTake,
	IsNull(bk1.sm,0) + IsNull(bk2.sm,0) AddContingentValue
	FROM Contracts c
	-- letzte Abrechnung
	OUTER APPLY (select top 1 b.I3D, b.BookedFrom, b.BookedTo,  b.ContingentKind,
				 	case when  c.TakeRest = 0 and b.BookedTo+1 < GETDATE() then 0 else b.ContingentValue end ContingentValue, 
					b.RestTake, 
					case when  c.TakeRest = 0 and b.BookedTo+1 < GETDATE() then 0 else b.RestValue end RestValue,
					b.AddContingent
				from ContractContingentBooked b
				where  b.State = 1 and ISNULL(b.InterimInvoiceKind,0) in (0,2,3) and IsNull(b.AddContingent, 0) != 1   
					   and b.ContractI3D = c.I3D and b.BookedFrom  < GETDATE()
				order by b.BookedTo desc, b.AddContingent desc ) cb
    -- nachberchnung/freikontingenten/nachbedarf binnen Zeitraum von letzter Abrechnung
	OUTER APPLY (select sum(cb1.ContingentValue) sm 
				 from ContractContingentBooked cb1 
				 where cb1.ContractI3D = c.I3D and cb1.State = 1 and
					(
						(cb.BookedFrom Is Null and c.TakeRest = 1 ) or
							(cb.BookedFrom Is not Null 
								and  cb1.BookedTo <= case when c.TakeRest = 1 then 99999 when cb.BookedTo +1 > GETDATE() then cb.BookedTo else 0 end 
								and cb1.BookedFrom >= cb.BookedFrom 
						)	)
	        			 and ( cb1.AddContingent = 1 or (IsNull(cb.AddContingent,0) = 0 and cb1.AddContingent = 2) ) 
				    ) bk1
      -- mehrere nachbedarf/manuell RE in gleichem Tag
	OUTER APPLY (select sum(cb2.ContingentValue) sm  
				 from ContractContingentBooked cb2 
				 where cb2.ContractI3D = c.I3D and cb2.State = 1 and  cb2.AddContingent = 2 and 
					 (cb2.BookedFrom = cb.BookedFrom and cb2.I3D != cb.I3D and cb.AddContingent = 2)) bk2

	WHERE  c.ExtraKind in (2,3)
	       AND c.I3D >= @minContractID  
		   AND c.I3D<= @maxContractID 
		   AND c.CustomerI3D >= @minCustomerID  
		   AND c.CustomerI3D <= @maxCustomerID   

	ORDER BY cb.BookedTo DESC

----- used
INSERT INTO @ContingentAdd  
	SELECT ic.ContractI3D, 
	       ic.ContingentKind,
		  SUM(ic.BalanceQuantity *  
						CASE WHEN ic.AssetKind < 5 THEN 1 ELSE -1 END *  
						CASE WHEN ic.ContingentKind = 0 THEN 1 ELSE ic.Price END)  
	FROM ContractItemsContingent ic 
	INNER JOIN  Contracts c ON c.I3D = ic.ContractI3D
	LEFT OUTER JOIN @ContingentCondition cc ON cc.ContractI3D = ic.ContractI3D  
	WHERE ic.State > 0 
	AND( cc.dtFrom is null or
		  (
			(
			  (ic.Date < cc.dtTo +1 and cc.dtTo +1 > GETDATE()) or cc.ContractRestTake = 1 
			)  
				AND ic.Date >= IsNull(cc.dtFrom,0) 
		  )
		)
	AND c.I3D >= @minContractID  
		   AND c.I3D<= @maxContractID 
		   AND c.CustomerI3D >= @minCustomerID  
		   AND c.CustomerI3D <= @maxCustomerID      
	GROUP BY ic.ContractI3D, ic.ContingentKind   


MERGE INTO @ContingentCondition cc  
	USING  @ContingentAdd  ca ON ca.ContractI3D = cc.ContractI3D AND ca.ContingentKind = cc.ContingentKind
	WHEN MATCHED THEN UPDATE  SET UsedValue = ca.Value 
	WHEN NOT MATCHED AND ca.Value > 0 THEN INSERT (ContractI3d, ContingentKind, UsedValue) VALUES (ca.ContractI3D, ca.ContingentKind, ca.Value);

----- reserved
MERGE INTO @ContingentCondition cc  
	USING  
(SELECT HT.ContractI3D,ci.Kind,  
			CASE ci.Kind WHEN 0 THEN SUM((ht.Timer - ISNULL(ht.LunchTime,0)) )/3600.0  
								     ELSE Sum((ht.timer-ISNULL(ht.LunchTime,0)) / CASE WHEN a.IsArbeitswert > 0 THEN 1.0 *A.AWFaktor * E.FaktorZuSekunde ELSE 3600.0 END *  
								CASE k.preisliste WHEN 0 THEN a.VK_1  
													   WHEN 1 THEN a.VK_2  
													   WHEN 2 THEN a.VK_3 
														WHEN 3 THEN a.VK_4 END  
		 ) END  sm   
	FROM hlpdsk_timer ht  
	INNER JOIN ContractContingentInfo ci ON ci.ContractI3D = HT.ContractI3D  
	INNER JOIN ARTIK a ON a.I3D = ht.ArtikelI3D  
	INNER JOIN cvw_Tickets T ON T.I3D = ht.RequestI3D   
	INNER JOIN Kunden K ON k.I3D = T.CustomerI3D   
	LEFT OUTER JOIN ArtikelEinheit E ON E.I3D = A.Einheit  
	WHERE ISNULL(ht.RechPosI3D,0) = 0 AND ISNULL(ht.LiefPosI3D,0) = 0 AND ht.Berechenbar = 1  
		AND HT.ContractI3D >= @minContractID  
		AND HT.ContractI3D <= @maxContractID   
		AND k.I3D >= @minCustomerID  
		AND k.I3D <= @maxCustomerID   
	 GROUP BY HT.ContractI3D, ci.Kind) RD ON RD.ContractI3D = cc.ContractI3D  
	WHEN MATCHED THEN UPDATE Set Reserved = RD.sm  
	WHEN NOT MATCHED THEN INSERT (ContractI3d, ContingentKind, Reserved) VALUES (RD.ContractI3D, RD.Kind, RD.sm); 
	
	INSERT INTO @ret ( ContractI3D, ContingentKind, dtFrom, dtTo, BookValue, RestValue, UseValue, ReservedValue) 
		SELECT ContractI3D, ContingentKind, dtFrom, CASE WHEN dtTo < 99999 THEN dtTo END, IsNull(ContingentValue,0) + IsNull(AddValue,0), Rest, UsedValue, Reserved FROM @ContingentCondition  
RETURN  
END 
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_CreateEmployeeFullName]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[cfn_CreateEmployeeFullName]
(
    @Firstname nvarchar(60),
    @Lastname nvarchar(60),
    @ShortSign nvarchar(5)
)
RETURNS nvarchar(150)
AS
BEGIN
    Declare @Output nvarchar(150) = ''
    IF (COALESCE(@Lastname,'') <> '')
    SET @Output = @LastName
    IF (COALESCE(@Lastname,'') <> '' AND COALESCE(@Firstname,'') <> '')
    SET @Output = @Output + ', '
    IF (COALESCE(@Firstname,'') <> '')
    SET @Output = @Output + @Firstname
    IF (COALESCE(@ShortSign,'') <> '')
    SET @Output = @Output + ' (' + @ShortSign + ')'
    RETURN @Output
END
    
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_DeliveryCount]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  FUNCTION [dbo].[cfn_DeliveryCount] 
(	@apI3D int ) 
RETURNS float
AS 
BEGIN 
   return (Select dynLiefermenge from cvw_DeliveryCount where apI3D = @apI3D) 
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_Geography_GetPoint]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[cfn_Geography_GetPoint]
(
	@Latitude float,
	@Longitude float,
	@Srid int
)
RETURNS geography
AS
BEGIN
	IF @Latitude IS NULL OR @Longitude IS NULL
	BEGIN
		RETURN NULL
	END

	DECLARE @point geography = geography::Point(@Latitude, @Longitude, @Srid);
	RETURN @point
END;

      
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_GetCustomerMonitoringReport]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_GetCustomerMonitoringReport]
(	
	@CustomerI3D int
)
RETURNS @CustomerMonitoringReport TABLE (SCount int, VMCount int, PCount int, WSCount int)
AS
BEGIN
DECLARE @SCount INT = 0
DECLARE @VMCount INT = 0
DECLARE @PCount INT = 0
DECLARE @WSCount INT = 0
DECLARE @Freitext01 varchar(255)
DECLARE @Pos int
DECLARE @Index int = -1
SELECT @Freitext01 = Freitext01 FROM dbo.Kunden WITH (NOLOCK) WHERE I3D = @CustomerI3D
SET @Freitext01 = LTRIM(RTRIM(@Freitext01))+ '/'
SET @Pos = CHARINDEX('/', @Freitext01, 1)

IF REPLACE(@Freitext01, '/', '') <> ''
	BEGIN
		WHILE @Pos > 0
			BEGIN
				SET @Index = @Index + 1
				IF(@Index = 0)
				BEGIN
					SET @SCount = LTRIM(RTRIM(LEFT(@Freitext01, @Pos - 1)))	
				END
				IF(@Index = 1)
				BEGIN
					SET @VMCount = LTRIM(RTRIM(LEFT(@Freitext01, @Pos - 1)))	
				END
				IF(@Index = 2)
				BEGIN
					SET @PCount = LTRIM(RTRIM(LEFT(@Freitext01, @Pos - 1)))	
				END
				IF(@Index = 3)
				BEGIN
					SET @WSCount = LTRIM(RTRIM(LEFT(@Freitext01, @Pos - 1)))	
				END
				SET @Freitext01 = RIGHT(@Freitext01, LEN(@Freitext01) - @Pos)
				SET @Pos = CHARINDEX('/', @Freitext01, 1)			
			END
	END
	INSERT INTO @CustomerMonitoringReport(SCount, VMCount, PCount, WSCount) VALUES (@SCount, @VMCount, @PCount, @WSCount)
	RETURN
END

GO
/****** Object:  UserDefinedFunction [dbo].[cfn_GetEditorsFromTicketI3D]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_GetEditorsFromTicketI3D]
(
       @TicketI3D int
)
RETURNS NVARCHAR(4000)
 
AS
 
BEGIN
 
DECLARE @listEditors NVARCHAR(4000)
 
SELECT @listEditors = COALESCE(@listEditors+', ' ,'') + per.KurzZeich 
FROM dbo.hlpdsk_request_bearbeiter bear
INNER JOIN dbo.Personal per ON bear.PersonalI3D = per.I3D
WHERE bear.RequestI3D = @TicketI3D
 
RETURN @listEditors

END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_GetRelatedItemsForObject]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[cfn_GetRelatedItemsForObject]
(
	@ObjectI3D INT,
	@ObjectKind INT
)
RETURNS @table TABLE 
(
	ObjectI3D INT, 
	ObjectNumber INT, 
	ObjectKind INT, 
	IsOrigin BIT
)
AS
BEGIN
DECLARE 
	@OriginKind INT;

SET @OriginKind = 
	CASE @ObjectKind
		WHEN 1 THEN 3 
		WHEN 2 THEN 1
		WHEN 3 THEN 2
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		WHEN 10 THEN 13 END;

INSERT INTO @table
(ObjectI3D, ObjectNumber, ObjectKind, IsOrigin)
SELECT 
	item.UrsprungI3D AS ObjectI3D
	,item.UrsprungAngNr AS ObjectNumber
	,CASE item.UrsprungArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10 END AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.AufKopf head
INNER JOIN dbo.AufPos item ON item.AufKopfI3D = head.I3D
WHERE head.I3D = @ObjectI3D
AND 2 = @ObjectKind
AND ISNULL(item.UrsprungI3D,0)>0
AND item.UrsprungArt IN (1,2,3,4,5,6,13)
GROUP BY item.UrsprungI3D, item.UrsprungArt, item.UrsprungAngNr

UNION ALL

SELECT 
	item.UrsprungI3D AS ObjectI3D
	,item.UrsprungNr AS ObjectNumber
	,CASE item.UrsprungArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10 END AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.LiefKopf head
INNER JOIN dbo.LiefPos item ON item.LiefKopfI3D = head.I3D
WHERE head.I3D = @ObjectI3D
AND 3 = @ObjectKind
AND ISNULL(item.UrsprungI3D,0)>0
AND item.UrsprungArt IN (1,2,3,4,5,6,13)
GROUP BY item.UrsprungI3D, item.UrsprungArt, item.UrsprungNr

UNION ALL

SELECT 
	item.UrsprungI3D AS ObjectI3D
	,item.UrsprungLiefNr AS ObjectNumber
	,CASE item.UrsprungArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10 END AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.AbholKopf head
INNER JOIN dbo.AbholPos item ON item.AbholKopfI3D = head.I3D
WHERE head.I3D = @ObjectI3D
AND 5 = @ObjectKind
AND ISNULL(item.UrsprungI3D,0)>0
AND item.UrsprungArt IN (1,2,3,4,5,6,13)
GROUP BY item.UrsprungI3D, item.UrsprungArt, item.UrsprungLiefNr

UNION ALL

SELECT 
	item.UrsprungI3D AS ObjectI3D
	,item.UrsprungNr AS ObjectNumber
	,CASE item.UrsprungArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10 END AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.RechKopf head
INNER JOIN dbo.RechPos item ON item.RechKopfI3D = head.I3D
WHERE head.I3D = @ObjectI3D
AND 4 = @ObjectKind
AND ISNULL(item.UrsprungI3D,0)>0
AND item.UrsprungArt IN (1,2,3,4,5,6,13)
GROUP BY item.UrsprungI3D, item.UrsprungArt, item.UrsprungNr

UNION ALL

SELECT 
	item.UrsprungI3D AS ObjectI3D
	,item.UrsprungNr AS ObjectNumber
	,CASE item.UrsprungArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10 END AS ObjectKind
	,CAST(1 AS BIT) AS IsOrigin
FROM dbo.GutKopf head
INNER JOIN dbo.GutPos item ON item.GutKopfI3D = head.I3D
WHERE head.I3D = @ObjectI3D
AND 6 = @ObjectKind
AND ISNULL(item.UrsprungI3D,0)>0
AND item.UrsprungArt IN (1,2,3,4,5,6,13)
GROUP BY item.UrsprungI3D, item.UrsprungArt, item.UrsprungNr

UNION ALL

SELECT 
	headOrigin.I3D AS ObjectI3D
	,headOrigin.Number AS ObjectNumber
	,7 AS ObjectKind
	, CAST(0 AS BIT) AS IsOrigin
FROM dbo.AufKopf head
INNER JOIN dbo.AufPos item ON item.AufKopfI3D = head.I3D
INNER JOIN dbo.SupplierOrderItems itemOrigin ON itemOrigin.ReceiptOrderItemI3D = item.I3D
INNER JOIN dbo.SupplierOrders headOrigin ON headOrigin.I3D = itemOrigin.ReceiptI3D
WHERE head.I3D = @ObjectI3D
AND 2 = @ObjectKind
GROUP BY headOrigin.I3D, headOrigin.Number

UNION ALL

SELECT 
	headOrigin.I3D AS ObjectI3D
	,headOrigin.Nummer AS ObjectNumber
	,2 AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.SupplierOrders head
INNER JOIN dbo.SupplierOrderItems item ON item.ReceiptI3D = head.I3D
INNER JOIN dbo.AufPos itemOrigin ON itemOrigin.I3D = item.ReceiptOrderItemI3D
INNER JOIN dbo.AufKopf headOrigin ON headOrigin.I3D = itemOrigin.AufKopfI3D
WHERE head.I3D = @ObjectI3D
AND 7 = @ObjectKind
AND ISNULL(item.ReceiptOrderItemI3D,0)>0
GROUP BY headOrigin.I3D, headOrigin.Nummer

UNION ALL

SELECT 
	headOrigin.I3D AS ObjectI3D
	,headOrigin.Nummer AS ObjectNumber
	,CASE item.UebernommenAusArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10
		ELSE item.UebernommenAusArt END AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.SupplierOrders head
INNER JOIN dbo.BestPos2 item ON item.BestKopfI3D = head.I3D
LEFT OUTER JOIN dbo.AnfrPos itemOrigin ON itemOrigin.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 15
LEFT OUTER JOIN dbo.AnfrKopf headOrigin ON headOrigin.I3D = itemOrigin.AnfrKopfI3D
WHERE head.I3D = @ObjectI3D
AND 7 = @ObjectKind
AND ISNULL(item.UebernommenAusI3D,0)>0
AND item.UebernommenAusArt IN (1,2,3,4,5,6,13,7,8,15,18,148)
GROUP BY item.UebernommenAusArt, headOrigin.I3D, headOrigin.Nummer

UNION ALL

SELECT 
	headOrigin.I3D AS ObjectI3D
	,headOrigin.Number AS ObjectNumber
	,CASE item.UebernommenAusArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10
		ELSE item.UebernommenAusArt END AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.WareKopf head
INNER JOIN dbo.WarePos item ON item.WareKopfI3D = head.I3D
LEFT OUTER JOIN dbo.SupplierOrderItems itemOrigin ON itemOrigin.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 7
LEFT OUTER JOIN dbo.SupplierOrders headOrigin ON headOrigin.I3D = itemOrigin.ReceiptI3D
WHERE head.I3D = @ObjectI3D
AND 8 = @ObjectKind
AND ISNULL(item.UebernommenAusI3D,0)>0
AND item.UebernommenAusArt IN (1,2,3,4,5,6,13,7,8,15,18,148)
GROUP BY item.UebernommenAusArt, headOrigin.I3D, headOrigin.Number

UNION ALL

SELECT 
	ISNULL(headOrigin.I3D,headOrigin2.I3D) AS ObjectI3D
	,ISNULL(headOrigin.Nummer,headOrigin2.Number) AS ObjectNumber
	,CASE item.UebernommenAusArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10
		ELSE item.UebernommenAusArt END AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.KalkKopf head
INNER JOIN dbo.KalkPos item ON item.KalkKopfI3D = head.I3D
LEFT OUTER JOIN dbo.WarePos itemOrigin ON itemOrigin.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 8
LEFT OUTER JOIN dbo.WareKopf headOrigin ON headOrigin.I3D = itemOrigin.WareKopfI3D
LEFT OUTER JOIN dbo.SupplierOrderItems itemOrigin2 ON itemOrigin2.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 7
LEFT OUTER JOIN dbo.SupplierOrders headOrigin2 ON headOrigin2.I3D = itemOrigin2.ReceiptI3D
WHERE head.I3D = @ObjectI3D
AND 18 = @ObjectKind
AND ISNULL(item.UebernommenAusI3D,0)>0
AND item.UebernommenAusArt IN (1,2,3,4,5,6,13,7,8,15,18,148)
GROUP BY item.UebernommenAusArt, headOrigin.I3D, headOrigin.Nummer, headOrigin2.I3D, headOrigin2.Number, headOrigin2.I3D

UNION ALL

SELECT 
	headOrigin.I3D AS ObjectI3D
	,headOrigin.Nummer AS ObjectNumber
	,CASE item.UebernommenAusArt
		WHEN 3 THEN 1
		WHEN 1 THEN 2 
		WHEN 2 THEN 3
		WHEN 4 THEN 4
		WHEN 5 THEN 6
		WHEN 6 THEN 5
		--WHEN 10 THEN 22
		WHEN 13 THEN 10
		ELSE item.UebernommenAusArt END AS ObjectKind
	, CAST(1 AS BIT) AS IsOrigin
FROM dbo.LiGutKopf head
INNER JOIN dbo.LiGutPos item ON item.LiGutKopfI3D = head.I3D
LEFT OUTER JOIN dbo.KalkPos itemOrigin ON itemOrigin.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 18
LEFT OUTER JOIN dbo.KalkKopf headOrigin ON headOrigin.I3D = itemOrigin.KalkKopfI3D
WHERE head.I3D = @ObjectI3D
AND 148 = @ObjectKind
AND ISNULL(item.UebernommenAusI3D,0)>0
AND item.UebernommenAusArt IN (1,2,3,4,5,6,13,7,8,15,18,148)
AND head.AktuelleVersion = 1
GROUP BY item.UebernommenAusArt, headOrigin.I3D, headOrigin.Nummer


UNION ALL

SELECT
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,2 AS ObjectKind
	,CAST(1 AS BIT) AS IsOrigin
FROM dbo.hlpdsk_requests ticket
INNER JOIN dbo.AufKopf head ON head.I3D = ticket.CreatedFromObjectI3D
WHERE ticket.I3D = @ObjectI3D
AND 10 = @ObjectKind
AND ticket.CreatedFromObjectKind = 2

UNION ALL

SELECT
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,2 AS ObjectKind
	,CAST(1 AS BIT) AS IsOrigin
FROM dbo.AufKopf head
INNER JOIN dbo.AufPos item ON item.AufKopfI3D = head.I3D
WHERE item.HelpdeskI3D = @ObjectI3D AND ISNULL(item.UrsprungArt, 0) <> 13
AND 10 = @ObjectKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT
	ticket.I3D AS ObjectI3D
	,ticket.Nummer AS ObjectNumber
	,10 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.hlpdsk_requests ticket
WHERE ticket.CreatedFromObjectI3D = @ObjectI3D
AND 2 = @ObjectKind
AND ticket.CreatedFromObjectKind = 2

UNION ALL

SELECT 
	HR.I3D AS ObjectI3D,
	HR.Nummer AS ObjectNumber,
	10 AS ObjectKind,
	CAST(0 as BIT) AS IsOrigin
FROM AufPos AP
INNER JOIN AufKopf AK ON AK.I3D = AP.AufKopfI3D
INNER JOIN hlpdsk_requests HR ON HR.I3D = AP.HelpdeskI3D AND ISNULL(AP.UrsprungArt, 0) <> 13
WHERE AK.I3D = @ObjectI3D
AND 2 = @ObjectKind

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,2 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.AufKopf head
INNER JOIN dbo.AufPos item ON item.AufKopfI3D = head.I3D
WHERE item.UrsprungI3D = @ObjectI3D
AND item.UrsprungArt = @OriginKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,3 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.LiefKopf head
INNER JOIN dbo.LiefPos item ON item.LiefKopfI3D = head.I3D
WHERE item.UrsprungI3D = @ObjectI3D
AND item.UrsprungArt = @OriginKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,5 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.AbholKopf head
INNER JOIN dbo.AbholPos item ON item.AbholKopfI3D = head.I3D
WHERE item.UrsprungI3D = @ObjectI3D
AND item.UrsprungArt = @OriginKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,4 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.RechKopf head
INNER JOIN dbo.RechPos item ON item.RechKopfI3D = head.I3D
WHERE item.UrsprungI3D = @ObjectI3D
AND item.UrsprungArt = @OriginKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,6 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.GutKopf head
INNER JOIN dbo.GutPos item ON item.GutKopfI3D = head.I3D
WHERE item.UrsprungI3D = @ObjectI3D
AND item.UrsprungArt = @OriginKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Number AS ObjectNumber
	,7 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.SupplierOrders head
INNER JOIN dbo.BestPos2 item ON item.BestKopfI3D = head.I3D
LEFT OUTER JOIN dbo.AnfrPos originItem ON originItem.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 15
LEFT OUTER JOIN dbo.AnfrKopf originHead ON originHead.I3D = originItem.AnfrKopfI3D
WHERE originHead.I3D = @ObjectI3D
AND item.UebernommenAusArt = @ObjectKind
GROUP BY head.I3D, head.Number

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,8 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.WareKopf head
INNER JOIN dbo.WarePos item ON item.WareKopfI3D = head.I3D
LEFT OUTER JOIN dbo.SupplierOrderItems originItem ON originItem.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 7
LEFT OUTER JOIN dbo.SupplierOrders originHead ON originHead.I3D = originItem.ReceiptI3D
WHERE originHead.I3D = @ObjectI3D
AND item.UebernommenAusArt = @ObjectKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,18 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.KalkKopf head
INNER JOIN dbo.KalkPos item ON item.KalkKopfI3D = head.I3D
LEFT OUTER JOIN dbo.WarePos originItem ON originItem.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 8
LEFT OUTER JOIN dbo.WareKopf originHead ON originHead.I3D = originItem.WareKopfI3D
LEFT OUTER JOIN dbo.SupplierOrderItems originItem2 ON originItem2.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 7
LEFT OUTER JOIN dbo.SupplierOrders originHead2 ON originHead2.I3D = originItem2.ReceiptI3D
WHERE ISNULL(originHead.I3D,originHead2.I3D) = @ObjectI3D
AND item.UebernommenAusArt = @ObjectKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
	head.I3D AS ObjectI3D
	,head.Nummer AS ObjectNumber
	,148 AS ObjectKind
	,CAST(0 AS BIT) AS IsOrigin
FROM dbo.LiGutKopf head
INNER JOIN dbo.LiGutPos item ON item.LiGutKopfI3D = head.I3D
LEFT OUTER JOIN dbo.KalkPos originItem ON originItem.I3D = item.UebernommenAusI3D AND item.UebernommenAusArt = 18
LEFT OUTER JOIN dbo.KalkKopf originHead ON originHead.I3D = originItem.KalkKopfI3D
WHERE originHead.I3D = @ObjectI3D
AND item.UebernommenAusArt = @ObjectKind
AND head.AktuelleVersion = 1
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
       head.I3D AS ObjectI3D
       ,head.Nummer AS ObjectNumber
       ,4 AS ObjectKind
       ,CAST(0 AS BIT) AS IsOrigin
FROM dbo.RechKopf head
INNER JOIN dbo.VertragRechKopfZuordnung vrk ON vrk.RechKopfI3D = head.I3D
WHERE vrk.VertragI3D = @ObjectI3D
AND 22 = @ObjectKind
GROUP BY head.I3D, head.Nummer

UNION ALL

SELECT 
       vk.I3D AS ObjectI3D
       ,vk.Nummer AS ObjectNumber
       ,22 AS ObjectKind
       , CAST(1 AS BIT) AS IsOrigin
FROM dbo.RechKopf head
INNER JOIN dbo.VertragRechKopfZuordnung vrk ON vrk.RechKopfI3D = head.I3D
INNER JOIN dbo.VertragKopf vk ON vk.I3D = vrk.VertragI3D
WHERE head.I3D = @ObjectI3D
AND 4 = @ObjectKind
GROUP BY vk.I3D, vk.Nummer

UNION ALL

-- Vertragsartikel aus Sicht Vertrag
SELECT 
	O.I3D AS ObjectI3D,
	O.Number AS ObjectNumber,
	2 AS ObjectKind,
	CAST(1 AS BIT) AS IsOrigin
FROM dbo.Contracts C
INNER JOIN dbo.ContractItems CI ON CI.ReceiptI3D = C.I3D AND CI.OriginKind = 26
INNER JOIN dbo.Orders O ON O.I3D = CI.OriginReceiptI3D
WHERE C.I3D = @ObjectI3D
AND 22 = @ObjectKind
GROUP BY O.I3D, O.Number

UNION ALL

-- Vertragsartikel aus Sicht Auftrag
SELECT 
	C.I3D AS ObjectI3D,
	C.Number AS ObjectNumber,
	22 AS ObjectKind,
	CAST(0 AS BIT) AS IsOrigin
FROM dbo.Contracts C
INNER JOIN dbo.ContractItems CI ON CI.ReceiptI3D = C.I3D AND CI.OriginKind = 26
INNER JOIN dbo.Orders O ON O.I3D = CI.OriginReceiptI3D
WHERE O.I3D = @ObjectI3D
AND 2 = @ObjectKind
GROUP BY C.I3D, C.Number

RETURN;
END;
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_GetSnmpCountByCustomer]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_GetSnmpCountByCustomer]
(
	@CustomerI3D INT
)
RETURNS int
AS
BEGIN
	DECLARE @SnmpCount INT = 0
	SET @SnmpCount = (SELECT SUM(SnmpCount) FROM (SELECT Count(Distinct SnmpD.ProviderName) AS SnmpCount
			FROM dbo.AssetManagementDevices Dev WITH (NOLOCK) 
			INNER JOIN dbo.AssetManagementCheckConfigurations CC  WITH (NOLOCK) ON Dev.I3D = CC.DeviceId
			INNER JOIN dbo.AssetManagementSnmpMibChecks SnmpC WITH (NOLOCK) ON SnmpC.I3D = CC.CheckID
			INNER JOIN dbo.AssetManagementSnmpMibOidDetails SnmpOid WITH (NOLOCK) ON SnmpOid.I3D = SnmpC.SnmpOidI3D
			INNER JOIN dbo.AssetManagementSnmpMibDetails SnmpD WITH (NOLOCK) ON SnmpD.I3D = SnmpOid.SnmpMibI3D
			WHERE CC.CheckType = 14 AND Dev.KundenI3D = @CustomerI3D
			group by CC.DeviceId) a)
	RETURN @SnmpCount
END

GO
/****** Object:  UserDefinedFunction [dbo].[cfn_GetTicketBearbeiterKurzZeichen]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 CREATE FUNCTION [dbo].[cfn_GetTicketBearbeiterKurzZeichen] (@ATicketI3D int) 
 RETURNS VARCHAR(5000) 
 AS 
 BEGIN 
 DECLARE 
		@result varchar (8000) = '' , 
		@tmpstr varchar (8000) , 
		@qryData  CURSOR 

		SET @qryData = CURSOR SCROLL FOR 
		SELECT Personal.Kurzzeich 
		from hlpdsk_request_bearbeiter 
		INNER JOIN Personal ON hlpdsk_request_bearbeiter.PersonalI3D = Personal.I3D 
		WHERE hlpdsk_request_bearbeiter.RequestI3D = @ATicketI3D 
		ORDER BY Personal.Kurzzeich 

		OPEN @qryData 

		IF @@CURSOR_ROWS > 0 
		BEGIN 
			FETCH FIRST FROM @qryData INTO @tmpstr 

			WHILE @@FETCH_STATUS = 0 
			BEGIN 
				IF @result <> '' 
				BEGIN 
					SET @result = @result + ', ' 
				END 
				SET @result = @result + LTRIM(RTRIM(@tmpstr)) 

				FETCH NEXT FROM @qryData INTO @tmpstr 
			END 
		END 

		CLOSE @qryData 
		DEALLOCATE @qryData 

		RETURN @result 

 END 
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_LastActionCheckResultStatus]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_LastActionCheckResultStatus]
        (
	        @DeviceI3D int
        )
        RETURNS @CheckResultStatus TABLE (LastActionDate datetime, LastActionResult nvarchar(256))
        AS
        BEGIN	
	        DECLARE @LastActionDate datetime
	        DECLARE @LastActionResult nvarchar(256) = ''

	        DECLARE @OkLastTransaction int = 0
	        DECLARE @WarningLastTransaction int = 0
	        DECLARE @ErrorLastTransaction int = 0

	        SELECT @OkLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1639
	        SELECT @WarningLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1640
	        SELECT @ErrorLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1641

	        SET @LastActionDate = ''

	        SELECT TOP 1 @LastActionDate = crt.Date FROM AssetManagementCheckResults crt 
			        INNER JOIN AssetManagementCheckConfigurations mct ON mct.I3D = crt.CheckConfigurationID 
			        WHERE mct.DeviceId = @DeviceI3D ORDER BY crt.Date DESC

	        IF(@LastActionDate > DATEADD(minute, -@OkLastTransaction, GETDATE()))
				        BEGIN
					        SET @LastActionResult = 'ok'
				        END

			        ELSE IF(@LastActionDate > DATEADD(minute, -@WarningLastTransaction, GETDATE()))
				        BEGIN
					        SET @LastActionResult = 'warning'
				        END

			        ELSE IF(@LastActionDate > DATEADD(minute, -@ErrorLastTransaction, GETDATE()))
				        BEGIN
					        SET @LastActionResult = 'error'
				        END
			        ELSE IF(@LastActionDate = '1900-01-01 00:00:00.000')
				        BEGIN
					        SET @LastActionResult = ''
				        END
			        ELSE
				        BEGIN
					        SET @LastActionResult = 'error'
				        END	

	        INSERT INTO @CheckResultStatus(LastActionDate, LastActionResult) VALUES (@LastActionDate, @LastActionResult)
	        RETURN
        END
        
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_LastActionCheckResultStatusDetails]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_LastActionCheckResultStatusDetails]
        (
        )
        RETURNS @CheckResultStatus TABLE 
        (
	        DeviceI3D int, 
	        LastActionDate datetime, 
	        LastActionResult nvarchar(256), 
	        CheckStatusIndicator int
        )
        AS
        BEGIN
	        DECLARE @OkLastTransaction int = 0
	        DECLARE @WarningLastTransaction int = 0
	        DECLARE @ErrorLastTransaction int = 0

	        SELECT @OkLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1639
	        SELECT @WarningLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1640
	        SELECT @ErrorLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1641
	
	        DECLARE @table TABLE
	        (
		        DeviceID int,
		        LastActionDate datetime, 
		        LastActionResult nvarchar(256), 
		        CheckStatusIndicator int
	        )

	        INSERT INTO @table(DeviceID ,LastActionDate) 
		        SELECT amd.I3D Deviceid, isnull(max(acr.date),'1900-01-01 00:00:00.000') LastDate FROM AssetManagementDevices AMD 
		        LEFT JOIN AssetManagementCheckConfigurations acc on amd.I3D= acc.DeviceId 
		        LEFT JOIN AssetManagementCheckResults acr on acc.i3d= acr.CheckConfigurationID 
		        GROUP BY amd.i3d

	        INSERT INTO @CheckResultStatus(DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator) SELECT DeviceID, LastActionDate, 
					        CASE WHEN LastActionDate > DATEADD(minute, -@OkLastTransaction, GETDATE()) THEN	'ok'
						        WHEN LastActionDate > DATEADD(minute, -@WarningLastTransaction, GETDATE()) THEN 'warning'
						        WHEN LastActionDate > DATEADD(minute, -@ErrorLastTransaction, GETDATE()) THEN 'error'
						        WHEN LastActionDate = '1900-01-01 00:00:00.000' THEN ''
						        ELSE 'error'
					        END AS LastActionResult,
					        CASE WHEN LastActionDate > DATEADD(minute, -@OkLastTransaction, GETDATE()) THEN	1
						        WHEN LastActionDate > DATEADD(minute, -@WarningLastTransaction, GETDATE()) THEN 3
						        WHEN LastActionDate > DATEADD(minute, -@ErrorLastTransaction, GETDATE()) THEN 2
						        WHEN LastActionDate = '1900-01-01 00:00:00.000' THEN 0
						        ELSE 2
					        END AS CheckStatusIndicator FROM @table 
	        RETURN
        END
        
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_LastSaleDate]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_LastSaleDate] 
	( @ArtileI3D int ) 
	RETURNS DateTime 
AS 
BEGIN 
	DECLARE @ret  DateTime; 
	IF @ArtileI3D > 0 
		SET @ret = (SELECT MAX(rk.Datum) 
						FROM rechpos rp 
						INNER JOIN Rechkopf rk ON rk.I3D = rp.RechKopfI3D 
						WHERE rk.Status < 3 
						  AND rp.ArtikelI3D = @ArtileI3D) 
	RETURN @ret 
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_LieferBestand]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_LieferBestand] 
	(@ArtikelI3D int,	@LagerI3D int) 
 RETURNS float  
 AS 
BEGIN  
	RETURN (SELECT SUM(lp.Stk - ISNULL(lp.numAbhol,0)) LieferBestand  
				 FROM LiefPos lp  
				INNER JOIN LiefKopf lk ON lk.I3D = lp.LiefKopfI3D  
				WHERE lk.Status = 1 
					AND lp.ArtikelI3D = @ArtikelI3D  
					AND lp.NebenlagerI3D = @LagerI3D)  
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_PickUpCount]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  FUNCTION [dbo].[cfn_PickUpCount] 
(	@lpI3D int ) 
RETURNS float
AS 
BEGIN 
   return (Select dynNumAbhol from cvw_PickUpCount where lpI3D = @lpI3D) 
END
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_RestValue]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

 CREATE FUNCTION [dbo].[cfn_RestValue] 
				(@contractID int, @diadLine dateTime)  
			RETURNS  float
				AS 
			BEGIN 
			 DECLARE @dtStart datetime, 
			         @booked float, 
			      	 @used float  
			SET @dtStart =  
				 IsNull((select  top 1  vz.GebuchtVon from dbo.VertragRechKopfZuordnung vz 
							where VertragI3D = @contractID 
							and IsNull(vz.NachBerechnung,0)  != 1 
							and vz.Zwischenrechnung in (0,2,3) 
							and vz.KontingentRestMitnehmen = 0 
							and vz.GebuchtVon < @diadLine 
							and vz.Status = 1
							order by vz.GebuchtVon desc),0) 
			
  			  SET @booked = (select SUM(vz.KontingentWert) from  dbo.VertragRechKopfZuordnung vz where vz.VertragI3D = @contractID and vz.Status = 1 and vz.GebuchtVon < @diadLine and vz.GebuchtVon >= @dtStart) 
			
			  SET @used = (select SUM (CASE vap.KontingentArt WHEN 0 THEN vap.AusgleichStk ELSE vap.AusgleichStk* vap.VKKalk END * CASE WHEN vap.anlageArt > 4 THEN -1 ELSE 1 END) 
				 				from dbo.VertragKontingentAnlagePositionen vap  
								where vap.Status > 0 
								and vap.datum < @diadLine and vap.datum >= @dtStart 
								and vap.VertragKopfI3D = @contractID) 
			
			 RETURN  ROUND( ROUND(IsNull(@booked,0) - IsNull(@used,0), 2),2) 
			END
GO
/****** Object:  UserDefinedFunction [dbo].[cnf_StockQuantity]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cnf_StockQuantity]() 
RETURNS 
 @ret TABLE 
	( 
		ArticleI3D int, 
		StockI3D int, 
		StockQuantity numeric(18,4), 
		StockPurchasePrice numeric(18,4), 
     PriceTotal numeric(18,4),
		SpecialStockQuantity numeric(18,4), 
		SpecialPriceTotal numeric(18,4) 
	) 
 AS 
BEGIN 
 DECLARE 	@Cur cursor, 
			 	@ArticleI3D int, 
				@StockI3D int,  
				@SpecialPurchasePrice numeric(18,4), 
				@SpecialStockQuantity numeric(18,4), 
				@OrderQuantity numeric(18,4), 
				@StockQuantity numeric(18,4), 
				@cnt numeric(18,4) 

		INSERT INTO @ret (ArticleI3D, StockI3D, StockQuantity, StockPurchasePrice, PriceTotal) 
		SELECT AC.ArtikelI3D, AC.LagerI3D, AC.cnt 
				,CASE WHEN nl.EigenerEK = 1 AND S.Wert=1 THEN NLA.EK ELSE A.EK END 
				,CASE WHEN nl.EigenerEK = 1 AND S.Wert=1 THEN NLA.EK ELSE A.EK END * AC.cnt 
		FROM cvw_ArticleCount ac 
		INNER JOIN Artik A ON A.I3D = AC.ArtikelI3D 
		INNER JOIN Stammdat S ON s.I3D = 147 
		LEFT OUTER JOIN NebenlagerArtikel NLA ON NLA.ArtikelI3D = AC.ArtikelI3D AND NLA.NebenlagerI3D = AC.LagerI3D 
		LEFT OUTER JOIN Nebenlager NL ON NL.I3D = AC.LagerI3D AND NL.I3D > 0 AND NL.Status = 1 
		WHERE Ac.cnt > 0 AND A.Abbuchung = 'J' 
		GROUP BY AC.ArtikelI3D, Ac.LagerI3D, Ac.CNT, CASE WHEN nl.EigenerEK = 1 AND S.Wert=1 THEN NLA.EK ELSE A.EK END 
		ORDER BY AC.ArtikelI3D, Ac.LagerI3D 

	SET @Cur = CURSOR FOR 
					SELECT  AP.ArtikelI3D,  AP.NebenlagerI3D, AP.Stk, AP.EK,-- wp.stk, kp.Stk,wk.SpaeteBuchung,A.BarcodeScanen, bc.cnt, 
								SUM(CASE WHEN A.BarcodeScanen = 1 THEN BC.cnt ELSE CASE WHEN wk.SpaeteBuchung = 1 THEN ISNULL(kp.stk,0) ELSE ISNULL(wp.stk,0) END - AP.Liefermenge END) 
					FROM AufPos AP 
					INNER JOIN ARTIK A ON A.I3D = AP.ArtikelI3D 
					LEFT OUTER JOIN AufKopf AK ON AK.I3D = AP.AufKopfI3D 
					LEFT OUTER JOIN WarePos wp ON wp.EKAusAufPosI3D = ap.I3D 
					LEFT OUTER JOIN (SELECT BestPosI3D, AufPosI3D, Count(*) cnt FROM Barcode WHERE BestPosI3D > 0 and Status = 2 GROUP BY BestPosI3D, AufPosI3D) bc ON bc.BestPosI3D = wp.I3D and bc.AufPosI3D = AP.I3D 
					LEFT OUTER JOIN WareKopf wk ON wk.I3D = wp.WareKopfI3D 
					LEFT OUTER JOIN KalkPos kp ON kp.UebernommenAusI3D = wp.I3D 
					LEFT OUTER JOIN KalkKopf kk ON kk.I3D = kp.KalkKopfI3D AND kk.Status= 2 
					WHERE AP.SondervereinbarungI3D > 0 AND AK.Status = 1 AND ap.Stk > AP.Liefermenge AND AP.EK > 0 AND A.Abbuchung = 'J' 
					GROUP BY ap.i3d, AP.ArtikelI3D,  AP.Stk, AP.EK, AP.NebenlagerI3D 
					HAVING SUM(CASE WHEN A.BarcodeScanen = 1 THEN BC.cnt ELSE CASE WHEN wk.SpaeteBuchung = 1 THEN ISNULL(kp.stk,0) ELSE ISNULL(wp.stk,0) END - AP.Liefermenge 	END)> 0 
					ORDER BY AP.ArtikelI3D, AP.NebenlagerI3D 
	OPEN @Cur  
	FETCH FROM @Cur INTO @ArticleI3D, @StockI3D , @OrderQuantity, @SpecialPurchasePrice, @SpecialStockQuantity 
	WHILE @@FETCH_STATUS = 0 BEGIN 
		IF  @OrderQuantity < @SpecialStockQuantity  
			SET  @cnt = @OrderQuantity 
		ELSE SET @cnt =  @SpecialStockQuantity 
		IF @cnt > 0 BEGIN 
			SET @StockQuantity  = (SELECT StockQuantity FROM @ret WHERE ArticleI3D =  @ArticleI3D AND StockI3D = @StockI3D) 
			IF @StockQuantity >= @cnt 
				UPDATE @Ret SET StockQuantity = StockQuantity - @cnt 
									 ,SpecialStockQuantity = ISNULL(SpecialStockQuantity,0) + @Cnt 
									 ,SpecialPriceTotal = ISNULL(SpecialPriceTotal,0) + @cnt * @SpecialPurchasePrice 
									 ,PriceTotal = (StockQuantity - @cnt) * StockPurchasePrice
				WHERE ArticleI3D = @ArticleI3D AND StockI3D = @StockI3D 
		END 
		FETCH FROM @Cur INTO @ArticleI3D, @StockI3D , @OrderQuantity, @SpecialPurchasePrice, @SpecialStockQuantity 
	END 
  CLOSE @Cur 
	DEALLOCATE @Cur 
	RETURN 
END
GO
/****** Object:  UserDefinedFunction [dbo].[fnGetBearbeiterByTicketID]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[fnGetBearbeiterByTicketID] ( @TicketI3D int ) 
RETURNS VARCHAR(Max) 
AS 
BEGIN 
		DECLARE @listBearbeiter NVARCHAR(MAX) 
		SELECT @listBearbeiter = COALESCE(@listBearbeiter+', ' ,'') + Personal.Kurzzeich 
		FROM dbo.hlpdsk_requests 
		INNER JOIN dbo.hlpdsk_request_bearbeiter ON hlpdsk_request_bearbeiter.RequestI3D = hlpdsk_requests.I3D 
		INNER JOIN dbo.Personal ON personal.i3d = hlpdsk_request_bearbeiter.PersonalI3D 
		WHERE Hlpdsk_requests.I3D = @TicketI3D 
		order by Personal.kurzzeich 
		RETURN @listBearbeiter 
END
      
GO
/****** Object:  UserDefinedFunction [dbo].[func_ContingentCurrentState]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[func_ContingentCurrentState] (@ParContractID int) 
RETURNS @ret TABLE 
(
	ContractID int,
	Booked float,
	Used float
)
AS
BEGIN
	DECLARE
			@CurContract cursor,
			@ContractID int,
			@Booked float,
			@Used float,
			@Rest float,
			@Sm   float,
			@DateFrom Datetime,
			@DateTo Datetime,
			@BookedFrom Datetime, 
			@BookedTo datetime,
			@RestTogo int, 
			@ContingentValue float,
			@ContingentRestValue float, 
			@KontngentKind int 

   DECLARE	@Contingent TABLE (     ContractID int,
									BookedFrom Datetime,
									BookedTo Datetime,
									RestTogo int,
									ContingentValue float,
									ContingentRestValue float)
	INSERT INTO @Contingent
   			SELECT  rz.VertragI3D, rz.GebuchtVon, rz.GebuchtBis,  rz.KontingentWert, rz.KontingentRestMitnehmen, rz.KontingentRestWert 
				FROM VertragRechKopfZuordnung rz   
				INNER JOIN VertragKopf vk ON vk.I3D = rz.VertragI3D AND vk.KontingentVertrag =1
				WHERE rz.Status = 1   
				  AND ISNULL(rz.Zwischenrechnung,0) in (0,2,3) 
				  AND  ISNULL(rz.Nachberechnung,0)=0
				  AND ((rz.GebuchtBis +1 > GETDATE() AND rz.GebuchtVon < GETDATE()) 
						OR  (rz.GebuchtBis < GETDATE() 
								AND rz.I3D = (select max(i3d) from VertragRechKopfZuordnung v where v.VertragI3D = rz.VertragI3D and v.Status = 1 
												and ISNULL(v.Zwischenrechnung,0) in (0,2,3) and ISNULL(v.Nachberechnung,0)=0) )
						OR
								(rz.GebuchtVon > GETDATE() 
								AND rz.I3D = ( select min(i3d) from VertragRechKopfZuordnung v 
								where v.VertragI3D = rz.VertragI3D   and v.Status = 1 and ISNULL(v.Zwischenrechnung,0) in (0,2,3) and ISNULL(v.Nachberechnung,0)=0) ))
				 AND rz.VertragI3D >= @ParContractID
				 AND rz.VertragI3D <= CASE WHEN @ParContractID > 0 THEN  @ParContractID ELSE 2147483647 END

    DECLARE	@Nachberechnung TABLE (ContractID int,
								   Summary float)

	SET  @CurContract = CURSOR FAST_FORWARD FOR 
			SELECT I3D, KontingentArt   
			FROM VertragKopf
			WHERE KontingentVertrag = 1
				 AND I3D >= @ParContractID
				 AND I3D <= CASE WHEN @ParContractID > 0 THEN  @ParContractID ELSE 2147483647 END
				
	OPEN @CurContract
	FETCH FROM  @CurContract INTO @ContractID, @KontngentKind
	WHILE @@FETCH_STATUS = 0 BEGIN 
		SET @Booked = 0
		SET @Used = 0
		SET	@Rest = 0
		SET @ContingentValue = -2
		SET @ContingentRestValue = 0
		SET	@BookedFrom = 0
		SET	@BookedTo	= 99999 
		SET @Sm = 0 

		SELECT  @ContingentValue = ContingentValue,
				@RestTogo = RestTogo,
				@ContingentRestValue = ContingentRestValue,
				@BookedFrom = BookedFrom,
				@BookedTo	= BookedTo 
		 FROM	@Contingent		
		WHERE ContractID = @ContractID
		IF  @ContingentValue >-1 BEGIN -- wurden schon abgerechnet
			IF (@BookedTo + 1 > GetDate() OR @RestTogo = 1)
				SET @Booked = ISNULL(@ContingentValue,0) + ISNULL(@ContingentRestValue,0)
			IF @BookedTo +1 < GETDATE() BEGIN
				IF @RestTogo = 0 SET @BookedFrom = @BookedTo
				SET	@BookedTo	= 99999  
			END
			IF @RestTogo = 1 SET @BookedTo	= 99999  
		END 

		SET @Sm = 0
	
		SET @Sm = (SELECT SUM(vr.KontingentWert) sm   
							FROM  VertragRechKopfZuordnung vr  
							WHERE vr.NachBerechnung = 1 
							  AND vr.VertragI3D = @ContractID
							  AND vr.Status = 1
							  AND vr.GebuchtVon BETWEEN  @BookedFrom AND  @BookedTo	)
		
		SET @Booked = @Booked + ISNULL(@Sm,0) 

		SET @Used = (SELECT SUM(CASE WHEN vkp.KontingentArt =1 THEN VKKalk ELSE 1 END * vkp.AusgleichStk * CASE WHEN AnlageArt >4 THEN -1 ELSE 1 END) smBalance	
                     FROM VertragKontingentAnlagePositionen vkp
					 WHERE vkp.VertragKopfI3D = @ContractID
                       AND vkp.AnlageArt > 2 
                       AND vkp.Status > 0 
                        AND vkp.datum  BETWEEN  @BookedFrom AND  @BookedTo )
	    INSERT INTO @Ret VALUES(@ContractID, ISNULL(@Booked,0), ISNULL(@Used,0) )
		FETCH FROM  @CurContract INTO @ContractID, @KontngentKind
	END
	RETURN 
END
GO
/****** Object:  UserDefinedFunction [dbo].[func_ContingentDetails]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[func_ContingentDetails] 
(
	@ParContractID int,
	@ParDateFrom datetime = 0,
	@ParDateTo datetime = 99999
)
RETURNS 
 @ret TABLE 
(
	ContractID int,
	AssetDate datetime,
	IntervalFrom datetime,
	IntervalTo datetime,
	Overbooking int,
	AssetKind int,
	AssetNumber int,
	Booked float,
	Used float,
	Employee varchar(10),
	ContractKind int
)
AS
BEGIN

 INSERT INTO @ret ( 
 
 ContractID ,
	AssetDate,
	IntervalFrom,
	IntervalTo,
	Overbooking,
	Assetkind,
	Assetnumber,
	Booked,
	Employee
 
 )
	SELECT  vrz.VertragI3D, 
			CASE WHEN vrz.AnlageArt = 6 THEN gk.Datum ELSE rk.Datum END AssetDate,
			vrz.GebuchtVon, vrz.GebuchtBis,
			vrz.KontingentUeberbuchung, 
			ISNULL(vrz.AnlageArt,0),
			CASE WHEN vrz.AnlageArt = 6 THEN gk.Nummer ELSE rk.Nummer END Nummer,
			vrz.KontingentWert,  
			p.KurzZeich
	 FROM VertragRechKopfZuordnung vrz 
	 LEFT OUTER JOIN RechKopf rk ON rk.I3D = vrz.RechKopfI3D and ISNULL(vrz.AnlageArt,4) = 4
	 LEFT OUTER JOIN GutKopf gk ON gk.I3D = vrz.RechKopfI3D AND vrz.AnlageArt = 6
	 INNER JOIN Personal p ON p.I3D = CASE WHEN vrz.AnlageArt = 6 THEN gk.ErstellerI3D ELSE rk.ErstellerI3D END
	 WHERE vrz.VertragI3D = @ParContractID 
	   AND vrz.Status = 1
	   AND vrz.GebuchtVon >= @ParDateFrom
	   AND vrz.GebuchtVon < @ParDateTo

 INSERT INTO @ret ( 
   ContractID ,
	AssetDate,
	Assetkind,
	Assetnumber,
	ContractKind,
	Used,
	Employee
 )

SELECT vk.I3D, vkp.Datum, vkp.AnlageArt, vkp.AnlageNummer, vk.KontingentArt,
CASE WHEN vk.KontingentArt = 0 THEN SUM(vkp.stk) ELSE SUM(vkp.stk * vkp.VKKalk) END Total,  
ISNULL(p.KurzZeich,'')
--(vkp.stk * vkp.VKKalk)
                     FROM VertragKontingentAnlagePositionen vkp
					 INNER JOIN VertragKopf vk ON vk.I3D = vkp.VertragKopfI3D	
					 LEFT OUTER JOIN Mitarbeiterartikel ma ON ma.ArtikelI3D = vkp.ArtikelI3D
					 LEFT OUTER JOIN Personal p  ON p.I3D = ma.MitarbeiterI3D
					 WHERE vkp.VertragKopfI3D =  @ParContractID 
                       AND vkp.AnlageArt > 2 
                       AND vkp.Status > 0 
					   AND vkp.datum  BETWEEN  @ParDateFrom AND  @ParDateTo
GROUP BY vk.I3D,  vkp.Datum, vkp.AnlageArt, vkp.AnlageNummer, ISNULL(p.KurzZeich,''),vk.KontingentArt


	RETURN 
END
GO
/****** Object:  UserDefinedFunction [dbo].[tblGFMailProDetailsV2]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION  [dbo].[tblGFMailProDetailsV2]
(
  @datumVon datetime
  , @datumBis datetime
  , @abteilung varchar(200) = 'Vertrieb'
) 
RETURNS @ret TABLE  
	(PersonalI3D int 
	, KlassifizierungI3D int 
	, openOfferCount int
	, openOfferTotal decimal(19,6) 
	, openOrderCount int
	, openOrderTotal decimal(19,6) 
	, openDeliveryCount int
	, openDeliveryTotal decimal(19,6) 
	, openInvoiceCount int
	, openInvoiceTotal decimal(19,6) 
	, lostOfferCount int
	, lostOfferTotal decimal(19,6) 
	, NewCustomerCount int
	)
AS 
BEGIN 

DECLARE
  @datum datetime;

DECLARE @Personen TABLE 
	(ID INT 
	, PersI3D int
	) ;

insert INTO @Personen (ID,  PersI3D)
SELECT
	RowNum = ROW_NUMBER() OVER(ORDER BY P.I3D), P.I3D
FROM personal p
INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
where 
	ABT.Name = @abteilung

DECLARE @MaxRownum int
SET @MaxRownum = (SELECT MAX(ID) FROM @Personen)

DECLARE @Iter int
SET @Iter = (SELECT MIN(ID) FROM @Personen)

DECLARE @PersI3D int

WHILE @Iter <= @MaxRownum 
BEGIN 
	SET @PersI3D = (SELECT PersI3D FROM @Personen WHERE ID = @Iter);

	insert INTO @ret (PersonalI3D, KlassifizierungI3D)
	values (@PersI3D, -1)
	insert INTO @ret (PersonalI3D, KlassifizierungI3D)
	select 
		@PersI3D
		, kk.I3D
	from KundenKlassifizierung kk
	SET @Iter = @Iter + 1 
END 

UPDATE @ret
	SET openOfferCount = T.openOfferCount
		, openOfferTotal = T.openOfferTotal
		, openOrderCount = T.openOrderCount
		, openOrderTotal = T.openOrderTotal
		, openDeliveryCount = T.openDeliveryCount
		, openDeliveryTotal = T.openDeliveryTotal
		, openInvoiceCount = T.openInvoiceCount
		, openInvoiceTotal = T.openInvoiceTotal
		, lostOfferCount = T.openOrderCount
		, lostOfferTotal = T.openOrderTotal
		, NewCustomerCount = T.NewCustomerCount

	from tblGFMailProDetailsV2_data(@datumVon, @datumBis, @abteilung) T
	WHERE (PersonalI3D = T.PersI3D) and (KlassifizierungI3D = T.KlassI3D)

RETURN 
END
GO
/****** Object:  UserDefinedFunction [dbo].[tblGFMailProDetailsV2_data]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION  [dbo].[tblGFMailProDetailsV2_data]
						   (
						     @datumVon datetime
						     , @datumBis datetime
						     , @abteilung varchar(200) = 'Vertrieb'
						   ) 
						   RETURNS @ret TABLE  
						   	(PersI3D int 
						   	, KlassI3D int 
						   	, openOfferCount int
						   	, openOfferTotal decimal(19,6) 
						   	, openOrderCount int
						   	, openOrderTotal decimal(19,6) 
						   	, openDeliveryCount int
						   	, openDeliveryTotal decimal(19,6) 
						   	, openInvoiceCount int
						   	, openInvoiceTotal decimal(19,6) 
						   	, lostOfferCount int
						   	, lostOfferTotal decimal(19,6) 
						   	, NewCustomerCount int
						   	)
						   AS 
						   BEGIN 
						   
						   DECLARE @Anlage TABLE 
						   	(PersI3d INT 
						   	, KlassI3D int
						   	, TotalSum decimal(19,6)
						   	, TotalCount int 
						   	) ;
						   
						   -- open Offers
						   insert INTO @ret (PersI3D,  KlassI3D, openOfferTotal, openOfferCount)
						   SELECT
						   	H.Adviser2I3D
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END							AS KlassifizierungI3D
						   	, SUM (h.NetPrice)				AS Sum
						   	, Count (*)						AS Count
						   FROM cvw_OfferHead H
						   	INNER JOIN Kunden			KU		ON KU.I3D = H.CustomerI3D 
						   	INNER JOIN AngKopf			K		ON K.I3D = H.I3D 
						   	INNER JOIN Personal			P       ON P.I3D = H.Adviser2I3D
						   	INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
						   	INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
						   WHERE 
						   	H.State = 1 
						   	and ABT.Name = @abteilung
						   GROUP BY 
						   	H.Adviser2I3D		
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END		
						   
						   
						   -- open Orders
						   insert INTO @Anlage (PersI3D,  KlassI3D, TotalSum, TotalCount)
						   SELECT
						   	H.Adviser2I3D
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END							AS KlassifizierungI3D
						   	, SUM (h.NetPrice)				AS Sum
						   	, Count (*)						AS Count
						   FROM cvw_OrderHead H
						   	INNER JOIN Kunden			KU		ON KU.I3D = H.CustomerI3D 
						   	INNER JOIN AufKopf			K		ON K.I3D = H.I3D 
						   	INNER JOIN Personal			P       ON P.I3D = H.Adviser2I3D
						   	INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
						   	INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
						   WHERE 
						   	H.State = 1
						   	and ABT.Name = @abteilung
						   GROUP BY 
						   	H.Adviser2I3D		
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END				 		
						   
						   MERGE @ret As res
						   USING @Anlage As ord
						   ON (res.PersI3D = ord.PersI3D and res.KlassI3D = ord.KlassI3D ) 
						   WHEN MATCHED THEN
						          UPDATE SET res.openOrderTotal  = ord.TotalSum
						                     ,res.openOrderCount = ord.TotalCount 
						   WHEN NOT MATCHED THEN
						          INSERT (PersI3D,  KlassI3D, openOrderTotal, openOrderCount)
						          VALUES (PersI3D,  KlassI3D, TotalSum, TotalCount);
						   
						   
						   -- open DevliveryNotes
						   DELETE from @Anlage
						   insert INTO @Anlage (PersI3D,  KlassI3D, TotalSum, TotalCount)
						   SELECT
						   	H.Adviser2I3D
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END							AS KlassifizierungI3D
						   	, SUM (h.NetPrice)				AS Sum
						   	, Count (*)						AS Count
						   FROM cvw_DeliveryListHead H
						   	INNER JOIN Kunden			KU		ON KU.I3D = H.CustomerI3D 
						   	INNER JOIN LiefKopf			K		ON K.I3D = H.I3D 
						   	INNER JOIN Personal			P       ON P.I3D = H.Adviser2I3D
						   	INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
						   	INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
						   WHERE 
						   	H.State = 1
						   	and ABT.Name = @abteilung
						   GROUP BY 
						   	H.Adviser2I3D		
						       , CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						       	THEN -1
						       	ELSE KU.KlassifizierungI3D
						       END		
						   
						   MERGE @ret As res
						   USING @Anlage As ord
						   ON (res.PersI3D = ord.PersI3D and res.KlassI3D = ord.KlassI3D ) 
						   WHEN MATCHED THEN
						          UPDATE SET res.openDeliveryTotal  = ord.TotalSum
						                     ,res.openDeliveryCount = ord.TotalCount 
						   WHEN NOT MATCHED THEN
						          INSERT (PersI3D,  KlassI3D, openDeliveryTotal, openDeliveryCount)
						          VALUES (PersI3D,  KlassI3D, TotalSum, TotalCount);
						   
						   
						   -- open Invoices
						   DELETE from @Anlage
						   insert INTO @Anlage (PersI3D,  KlassI3D, TotalSum, TotalCount)
						   SELECT
						   	H.Adviser2I3D
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END							AS KlassifizierungI3D
						   	, SUM(H.NetPriceComplete 
						   			+ H.TaxPriceComplete 
						   			- H.Payed)				AS Sum
						   	, COUNT(H.I3D)					AS Count
						   FROM cvw_InvoiceHead H
						   	INNER JOIN Kunden			KU		ON KU.I3D = H.CustomerI3D 
						   	INNER JOIN RechKopf			K		ON K.I3D = H.I3D 
						   	INNER JOIN Personal			P       ON P.I3D = H.Adviser2I3D
						   	INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
						   	INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
						   WHERE 
						   	H.State = 1 
						   	and ABT.Name = @abteilung
						   GROUP BY 
						   	H.Adviser2I3D		
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END	 
						   
						   MERGE @ret As res
						   USING @Anlage As ord
						   ON (res.PersI3D = ord.PersI3D and res.KlassI3D = ord.KlassI3D ) 
						   WHEN MATCHED THEN
						          UPDATE SET res.openInvoiceTotal  = ord.TotalSum
						                     ,res.openInvoiceCount = ord.TotalCount 
						   WHEN NOT MATCHED THEN
						          INSERT (PersI3D,  KlassI3D, openInvoiceTotal, openInvoiceCount)
						          VALUES (PersI3D,  KlassI3D, TotalSum, TotalCount);
						   
						   -- lost Offers
						   DELETE from @Anlage
						   insert INTO @Anlage (PersI3D,  KlassI3D, TotalSum, TotalCount)
						   SELECT 
						   	H.Adviser2I3D
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END							AS KlassifizierungI3D
						   --	, CONVERT(date, K.Datum, 109)		AS Date
						   	, SUM(H.NetPrice)					AS Sum
						   	, COUNT(*)							AS Count
						   FROM AngKopf K 
						   	INNER JOIN cvw_OfferHead	H		ON H.I3D = K.I3D 
						   	INNER JOIN Kunden			KU		ON KU.I3D = H.CustomerI3D 
						   	INNER JOIN Personal			P       ON P.I3D = H.Adviser2I3D
						   	INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
						   	INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
						   WHERE 
						   	NOT ISNULL(K.AbschlI3D, 0) = 0
						   	and ABT.Name = @abteilung
						   	AND K.Datum between @datumVon and @datumBis
						   GROUP BY 
						   	H.Adviser2I3D
						   --	, CONVERT(date, K.Datum, 109)		
						   	, CASE WHEN ISNULL(KU.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE KU.KlassifizierungI3D
						   		END		 
						   
						   
						   MERGE @ret As res
						   USING @Anlage As ord
						   ON (res.PersI3D = ord.PersI3D and res.KlassI3D = ord.KlassI3D ) 
						   WHEN MATCHED THEN
						          UPDATE SET res.lostOfferTotal  = ord.TotalSum
						                     ,res.lostOfferCount = ord.TotalCount 
						   WHEN NOT MATCHED THEN
						          INSERT (PersI3D,  KlassI3D, lostOfferTotal, lostOfferCount)
						          VALUES (PersI3D,  KlassI3D, TotalSum, TotalCount);
						   
						   -- new customer
						   DELETE from @Anlage
						   insert INTO @Anlage (PersI3D,  KlassI3D, TotalCount)
						   SELECT 
						   	K.AnlaBenu
						   	, CASE WHEN ISNULL(K.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE K.KlassifizierungI3D
						   		END							AS KlassifizierungI3D
						   	, COUNT(*)							AS Count
						   FROM (
						   		SELECT 
						   			K.AnlaBenu
						   			, K.KlassifizierungI3D 
						   			, K.AnlaDatum
						   		FROM Kunden K
						   			INNER JOIN Personal			P       ON P.I3D = K.AnlaBenu
						   			INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
						   			INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
						   		WHERE 
						   			K.AnlaDatum between @datumVon and @datumBis
						   			and ABT.Name = @abteilung
						   			) AS K
						   GROUP BY 
						   	K.AnlaBenu 
						   	, CASE WHEN ISNULL(K.KlassifizierungI3D, 0) <= 0
						   			THEN -1
						   			ELSE K.KlassifizierungI3D
						   		END	 
						   
						   
						   MERGE @ret As res
						   USING @Anlage As ord
						   ON (res.PersI3D = ord.PersI3D and res.KlassI3D = ord.KlassI3D ) 
						   WHEN MATCHED THEN
						          UPDATE SET res.NewCustomerCount = ord.TotalCount
						   WHEN NOT MATCHED THEN
						          INSERT (PersI3D,  KlassI3D, NewCustomerCount)
						          VALUES (PersI3D,  KlassI3D, TotalCount);
						   
						   RETURN 
						   END
GO
/****** Object:  UserDefinedFunction [dbo].[tblGFMailProV2]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION  [dbo].[tblGFMailProV2]
	(
	  @datumVon datetime
	  , @datumBis datetime
	  , @abteilung varchar(200) = 'Vertrieb'
	  , @warengruppe int = -1
	) 
	RETURNS @ret TABLE  
		(PersI3D int 
		, EvalDate Datetime 
		, OfferTotalCount int
		, OfferTotalSum  decimal(19,6) 
		, OfferWGCount int
		, OfferWGSum  decimal(19,6)
		, OrderTotalCount int
		, OrderTotalSum  decimal(19,6) 
		, OrderWGCount int
		, OrderWGSum  decimal(19,6)
		, CRM int
		, CRMProject int
		)
	AS 
	BEGIN 
	
	DECLARE
	  @datum datetime;
	
	DECLARE @Personen TABLE 
		(ID INT 
		, PersI3D int
		) ;
	
	insert INTO @Personen (ID,  PersI3D)
	SELECT
		RowNum = ROW_NUMBER() OVER(ORDER BY P.I3D), P.I3D
	FROM personal p
	INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
	INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
	where 
		ABT.Name = @abteilung
	
	DECLARE @MaxRownum int
	SET @MaxRownum = (SELECT MAX(ID) FROM @Personen)
	
	DECLARE @Iter int
	SET @Iter = (SELECT MIN(ID) FROM @Personen)
	
	DECLARE @PersI3D int
	
	WHILE @Iter <= @MaxRownum 
	BEGIN 
		SET @PersI3D = (SELECT PersI3D FROM @Personen WHERE ID = @Iter);
		SET @datum = @datumVon;
		WHILE (@datum <= @datumBis)
		BEGIN  
			insert INTO @ret (PersI3D, EvalDate)
				values (@PersI3D, @datum)
			SET @datum = DATEADD(DAY, 1, @datum);
		END
		SET @Iter = @Iter + 1 
	END 
	
	UPDATE @ret
		SET OfferTotalCount = T.OfferTotalCount
			, OfferTotalSum = T.OfferTotalSum
			, OfferWGCount = T.OfferWGCount
			, OfferWGSum = T.OfferWGSum
			, OrderTotalCount = T.OrderTotalCount
			, OrderTotalSum = T.OrderTotalSum
			, OrderWGCount = T.OrderWGCount
			, OrderWGSum = T.OrderWGSum
			, CRM = T.CRM
			, CRMProject = T.CRMProject
	
		from tblGFMailProV2_data(@datumVon, @datumBis, @abteilung, @warengruppe) T
		WHERE (PersI3D = T.PersonalI3D) and (EvalDate = T.Datum)
	
	RETURN 
	END
GO
/****** Object:  UserDefinedFunction [dbo].[tblGFMailProV2_data]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION  [dbo].[tblGFMailProV2_data]
(
  @datumVon datetime
  , @datumBis datetime
  , @abteilung varchar(200) = 'Vertrieb'
  , @warengruppe int = -1
) 
RETURNS @ret TABLE  
	(PersonalI3D int 
	, Datum Datetime 
	, OfferTotalCount int
	, OfferTotalSum  decimal(19,6) 
	, OfferWGCount int
	, OfferWGSum  decimal(19,6)
	, OrderTotalCount int
	, OrderTotalSum  decimal(19,6) 
	, OrderWGCount int
	, OrderWGSum  decimal(19,6)
	, CRM int
	, CRMProject int
	)
AS 
BEGIN 
DECLARE @Anlage TABLE 
	(PersonalI3d INT 
	, Datum datetime 
	, TotalSum decimal(19,6)
	, TotalCount int 
	, WGSum decimal(19,6)
	, WGCount int
	) ;

DECLARE @CRM TABLE 
	(PersonalI3d INT 
	, Datum datetime 
	, CRMCount int
	, CRMProjectCount int 
	) ;

DECLARE 
	@wg int;

IF @warengruppe = -1 BEGIN 
	SET @wg = (SELECT Wert FROM Stammdat WHERE I3D = 421);
END ELSE BEGIN
	SET @wg = @warengruppe;
END

-- ANGEBOTE
insert INTO @ret (PersonalI3D,  Datum, OfferTotalSum, OfferTotalCount ,OfferWGSum, OfferWGCount)
select  sm.I3D, sm.EvalDate, sum(sm.OfferAnlSum) TotalSum, COUNT(*) TotalCount,  SUM(OfferWGSum) WGSum, SUM(SIGN(sm.OfferWGSum)) WGCount from
(
SELECT distinct
    P.I3D
    , oh.Number
	, CONVERT(date, OH.Date, 104)     AS EvalDate
	, SUM(OP.NetPriceTotal) over (partition by CONVERT(date, OH.Date, 104), oh.I3D)  AS OfferAnlSum
	, SUM(Case WHEN A.Warengruppe = @wg THEN OP.NetPriceTotal ELSE 0 END) over  (partition by CONVERT(date, OH.Date, 104), oh.I3D)    AS OfferWGSum
FROM cvw_OfferPos			OP
INNER JOIN cvw_OfferHead	OH		ON OP.HeadI3D = OH.I3D
INNER JOIN Personal			P       ON P.I3D = OH.Adviser2I3D
INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
INNER JOIN ARTIK			A		ON A.I3D = OP.ArticleI3D AND ISNULL(A.StkListe, 0) <> 1
WHERE  
	ABT.Name = @abteilung
	AND OH.Date between @datumVon and @datumBis
) sm
group by sm.I3D, sm.EvalDate


--  Aufträge
insert INTO @Anlage (PersonalI3D,  Datum, TotalSum, TotalCount , WGSum, WGCount)
select  sm.I3D, sm.EvalDate, sum(sm.TotalSum) TotalSum, COUNT(*) TotalCount,  SUM(WGSum) WGSum, SUM(SIGN(sm.WGSum)) WGCount  from
(SELECT distinct
	P.I3D
    , oh.Number
	, CONVERT(date, OH.Date, 104)     AS EvalDate
	, SUM(OP.NetPriceTotal) over (partition by CONVERT(date, OH.Date, 104), oh.I3D)  AS TotalSum
	, SUM(Case WHEN A.Warengruppe = @wg THEN OP.NetPriceTotal ELSE 0 END) over  (partition by CONVERT(date, OH.Date, 104), oh.I3D)    AS WGSum
FROM cvw_OrderPos			OP
INNER JOIN cvw_OrderHead	OH		ON OP.HeadI3D = OH.I3D
INNER JOIN Personal			P		ON P.I3D = OH.Adviser2I3D
INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
INNER JOIN ARTIK			A		ON A.I3D = OP.ArticleI3D AND ISNULL(A.StkListe, 0) <> 1
WHERE  
	ABT.Name = @abteilung
	AND OH.Date between @datumVon and @datumBis
) sm
group by sm.I3D, sm.EvalDate


MERGE @ret As res
USING @Anlage As ord
ON (res.PersonalI3D = ord.PersonalI3D and res.Datum = ord.datum ) 
WHEN MATCHED THEN
       UPDATE SET res.OrderTotalCount  = ord.TotalCount
                    ,res.OrderTotalSum = ord.TotalSum 
                    ,res.OrderWGCount = ord.WGCount
                    ,res.OrderWGSum =ord.WGSum
WHEN NOT MATCHED THEN
       INSERT (PersonalI3D,  Datum, OrderTotalSum, OrderTotalCount ,OrderWGSum, orderWGCount)
       VALUES (PersonalI3D,  Datum, TotalSum, TotalCount,  WGSum, WGCount);


-- CRM
insert INTO @CRM (PersonalI3D,  Datum, CRMCount, CRMProjectCount)
select distinct
	P.I3D
	, CONVERT(date, TA1.Datum, 104)     AS EvalDate
	, Count(CASE WHEN ISNULL(TA1.CRMProjektI3D, 0) <= 0 THEN 1 END) over (partition by CONVERT(date, TA1.Datum, 104), P.I3D) AS CRM
	, Count(CASE WHEN ISNULL(TA1.CRMProjektI3D, 0) > 0 THEN 1 END) over (partition by CONVERT(date, TA1.Datum, 104), P.I3D) AS CRMProject
from Taetigkeiten	TA1	
INNER JOIN Personal			P       ON P.I3D = TA1.ErstellerI3D
INNER JOIN PersonalGruppen	ABTZ	ON P.I3D = ABTZ.PersonalI3D
INNER JOIN MaAbteilung		ABT		ON ABTZ.MaAbteilungI3D = ABT.I3D
WHERE  
	ABT.Name = @abteilung
	AND TA1.Datum  between @datumVon and @datumBis

MERGE @ret As res
USING @CRM As ord
ON (res.PersonalI3D = ord.PersonalI3D and res.Datum = ord.datum ) 
WHEN MATCHED THEN
       UPDATE SET	res.CRM  = ord.CRMCount
					,res.CRMProject = ord.CRMProjectCount
WHEN NOT MATCHED THEN
       INSERT (PersonalI3D,  Datum, CRM, CRMProject)
       VALUES (PersonalI3D,  Datum, CRMCount, CRMProjectCount);
RETURN 
END
GO
/****** Object:  Table [dbo].[Kreditor]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kreditor](
	[I3D] [int] NOT NULL,
	[Name] [varchar](240) NULL,
	[Fon] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[EMail] [varchar](255) NULL,
	[KrDomain] [varchar](255) NULL,
	[WWW] [varchar](255) NULL,
	[Haendler] [int] NULL,
	[RepaWerk] [int] NULL,
	[Kunde] [int] NULL,
	[VorSteuer] [int] NULL,
	[EG] [int] NULL,
	[UmsaIdentNr] [varchar](30) NULL,
	[SteuerNr] [varchar](80) NULL,
	[SachKonto] [int] NULL,
	[Bank] [varchar](60) NULL,
	[BLZ] [varchar](20) NULL,
	[KtoNr] [varchar](20) NULL,
	[BankLand] [int] NULL,
	[BankOrt] [varchar](50) NULL,
	[BankStrasse] [varchar](50) NULL,
	[BankIBAN] [varchar](50) NULL,
	[BankSWIFT] [varchar](50) NULL,
	[Bank02] [varchar](60) NULL,
	[BankBLZ02] [varchar](20) NULL,
	[BankKtoNr02] [varchar](20) NULL,
	[BankLand02] [int] NULL,
	[BankOrt02] [varchar](50) NULL,
	[BankStrasse02] [varchar](50) NULL,
	[BankIBAN02] [varchar](50) NULL,
	[BankSWIFT02] [varchar](50) NULL,
	[AgbErhaDatu] [datetime] NULL,
	[AgbErhaBenu] [int] NULL,
	[UmsaVorJahr] [float] NULL,
	[UmsaAktJahr] [float] NULL,
	[AnlaDatum] [datetime] NULL,
	[AnlaBenu] [int] NULL,
	[Loeschung] [int] NULL,
	[MandantID] [int] NULL,
	[Datev] [varchar](50) NULL,
	[BetreuerID] [int] NULL,
	[Status] [int] NULL,
	[AenderungID] [int] NULL,
	[Aenderung] [datetime] NULL,
	[Limit] [float] NULL,
	[ZahlKond] [int] NULL,
	[Faxverteiler] [int] NULL,
	[Mailverteiler] [int] NULL,
	[KredKdnr] [varchar](20) NULL,
	[Hersteller] [int] NULL,
	[KredImport] [int] NULL,
	[BestZahlungsArt] [int] NULL,
	[RootDirI3D] [int] NULL,
	[BestDirI3D] [int] NULL,
	[RechDirI3D] [int] NULL,
	[MindBestell] [float] NULL,
	[Import] [int] NULL,
	[RMANeeded] [int] NULL,
	[RMAInfo] [varchar](500) NULL,
	[EinkKond] [int] NULL,
	[ZahlKondAnfr] [int] NULL,
	[ZahlKondBest] [int] NULL,
	[Waehrung] [int] NULL,
	[EDIKind] [int] NULL,
	[Fracht] [float] NULL,
	[Frachtfrei] [float] NULL,
	[Mindestbestellwert] [float] NULL,
	[Mindermengenzuschlag] [float] NULL,
	[RWUebergabe] [int] NULL,
	[RWPersonalI3D] [int] NULL,
	[RWDatum] [datetime] NULL,
	[Kurzbezeichnung] [varchar](30) NULL,
	[WEEE] [varchar](100) NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LieferantenNummer] [int] NULL,
	[LieferantenNummerExt] [int] NULL,
	[Frachtfuehrer] [int] NULL,
	[AnfrageDirI3D] [int] NULL,
	[Lieferantenbewertung] [int] NULL,
	[ISOzertifiziert] [int] NULL,
	[ErstelltDurch] [int] NULL,
	[EgisLieferant] [varchar](50) NULL,
	[Direktlieferung] [int] NULL,
	[ITScopeLieferant] [varchar](50) NULL,
	[LieferbedingungAnfrage] [int] NULL,
	[LieferbedingungBestellung] [int] NULL,
	[VarialUebergabe] [int] NULL,
	[VarialPersonalI3D] [int] NULL,
	[VarialDatum] [datetime] NULL,
	[KalkDirI3D] [int] NULL,
	[MwStNichtAusweisen] [int] NULL,
	[TradersGuideLieferant] [int] NULL,
	[MailDirI3D] [int] NULL,
	[FrachtDirektlieferung] [float] NULL,
	[FrachtfreiDirektlieferung] [float] NULL,
	[MindermengenzuschlagDirektlieferung] [float] NULL,
	[MindestbestellwertDirektlieferung] [float] NULL,
	[PBSEasyLieferant] [varchar](50) NULL,
	[Rabatt] [float] NULL,
	[ALKALieferant] [varchar](50) NULL,
	[LiGutDirI3D] [int] NULL,
	[WareDirI3D] [int] NULL,
	[PBSeasyX400] [varchar](255) NULL,
	[RabattVKBasis] [int] NULL,
	[FrachtfuehrerKuerzel] [varchar](10) NULL,
	[KeinBuchhaltungsexport] [int] NULL,
	[FIBUSammelkonto] [varchar](24) NULL,
	[ZahlKondGut] [int] NULL,
	[IsFavorite] [bit] NULL,
	[ConcertoLieferant] [nvarchar](50) NULL,
 CONSTRAINT [PK_Kreditor] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LiefKopf]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiefKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[Version] [int] NOT NULL,
	[ErstellungsArt] [varchar](50) NULL,
	[Datum] [datetime] NOT NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[LieferBedID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[AusAuf] [int] NULL,
	[Service] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[Lieferstatus] [int] NULL,
	[LiefPersonalI3D] [int] NULL,
	[ScanDocI3D] [int] NULL,
	[Leasing] [int] NULL,
	[LeasingMonate] [int] NULL,
	[LeasingSatz] [float] NULL,
	[LeasingRate] [float] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LeasingGebuehr] [float] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[Zusatztext] [varchar](70) NULL,
	[BestNr] [varchar](50) NULL,
	[ProjNr] [varchar](50) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[RechKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](255) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[Direktlieferung] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](1000) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[Var2Lieferschein] [datetime] NULL,
	[Var1Lieferschein] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[LieferscheinGrundI3D] [int] NULL,
	[LieferscheinGrundText] [varchar](500) NULL,
	[FilialgeberI3D] [int] NULL,
	[Trackingnummer] [varchar](500) NULL,
	[DurchRMAGeschlossen] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[LiefEskDatum] [datetime] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[Rabatt] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[CreatedFromObjectI3D] [int] NULL,
	[CreatedFromObjectKind] [int] NULL,
	[IsPositionProvision] [bit] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFCComplete] [decimal](19, 2) NOT NULL,
	[VertragsI3D] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[TrackingNumberURL] [nvarchar](2000) NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[SendDateOfProduct] [datetime2](7) NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
 CONSTRAINT [PK_LiefKopf] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [ixLiefKopf_Status]    Script Date: 11.11.2025 11:20:25 ******/
CREATE CLUSTERED INDEX [ixLiefKopf_Status] ON [dbo].[LiefKopf]
(
	[Status] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Kunden]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kunden](
	[I3D] [int] NOT NULL,
	[Name] [varchar](240) NULL,
	[Fon] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[KdEMail] [varchar](255) NULL,
	[KdDomain] [varchar](255) NULL,
	[KdWWW] [varchar](255) NULL,
	[Haendler] [int] NULL,
	[Endkunde] [int] NULL,
	[Firmenkunde] [int] NULL,
	[Interessent] [int] NULL,
	[Faxverteiler] [int] NULL,
	[Mailverteiler] [int] NULL,
	[Kreditor] [int] NULL,
	[Mwstkz] [int] NULL,
	[EG] [int] NULL,
	[UmsaIdentNr] [varchar](30) NULL,
	[SteuerNr] [varchar](80) NULL,
	[Bank] [varchar](60) NULL,
	[BLZ] [varchar](20) NULL,
	[KtoNr] [varchar](20) NULL,
	[BankLand] [int] NULL,
	[BankOrt] [varchar](50) NULL,
	[BankStrasse] [varchar](50) NULL,
	[BankIBAN] [varchar](50) NULL,
	[BankSWIFT] [varchar](50) NULL,
	[Bank02] [varchar](60) NULL,
	[BankBLZ02] [varchar](20) NULL,
	[BankKtoNr02] [varchar](20) NULL,
	[BankLand02] [int] NULL,
	[BankOrt02] [varchar](50) NULL,
	[BankStrasse02] [varchar](50) NULL,
	[BankIBAN02] [varchar](50) NULL,
	[BankSWIFT02] [varchar](50) NULL,
	[ZahlKondAng] [int] NULL,
	[ZahlKondAuf] [int] NULL,
	[ZahlKondSer] [int] NULL,
	[ZahlkondLief] [int] NULL,
	[ZahlkondAbhol] [int] NULL,
	[ZahlKondRech] [int] NULL,
	[ZahlKondGut] [int] NULL,
	[ZahlKondLiefBed] [int] NULL,
	[Rabatt] [float] NULL,
	[AgbErhaDatu] [datetime] NULL,
	[AgbErhaBenu] [int] NULL,
	[AnlaDatum] [datetime] NULL,
	[AnlaBenu] [int] NULL,
	[Status] [int] NULL,
	[MandantID] [int] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[AenderungID] [int] NULL,
	[Aenderung] [datetime] NULL,
	[AnzahlLiefer] [int] NULL,
	[AnzahlLieferDup] [int] NULL,
	[AnzahlRech] [int] NULL,
	[AnzahlRechDup] [int] NULL,
	[AnzahlBuchh] [int] NULL,
	[Limit] [float] NULL,
	[LimitVerfuegbar] [float] NULL,
	[BestNrNoetig] [int] NULL,
	[Anrede] [varchar](50) NULL,
	[AufschlagVKProzent] [float] NULL,
	[Liefertext] [varchar](500) NULL,
	[RootDirI3D] [int] NULL,
	[BestDirI3D] [int] NULL,
	[SerDirI3D] [int] NULL,
	[HlpDirI3D] [int] NULL,
	[GerDirI3D] [int] NULL,
	[LiefDirI3D] [int] NULL,
	[AufDirI3D] [int] NULL,
	[RechDirI3D] [int] NULL,
	[ProjDirI3D] [int] NULL,
	[TaetDirI3D] [int] NULL,
	[Import] [int] NULL,
	[ProvArt] [int] NULL,
	[ProvPersonalI3D] [int] NULL,
	[KundenArt] [int] NULL,
	[AkqAnzahlServer] [int] NULL,
	[AkqAnzahlPC] [int] NULL,
	[AkqHerstellerServer] [varchar](80) NULL,
	[AkqHerstellerPC] [varchar](80) NULL,
	[AkqKauftBei] [varchar](80) NULL,
	[AkqHerstellerDrucker] [varchar](80) NULL,
	[AkqWiedervorlage] [datetime] NULL,
	[AkqBearbeitet] [int] NULL,
	[AkqAkquiseKomplett] [int] NULL,
	[AkqStammdatKomplett] [int] NULL,
	[AkqZusatzinfo] [text] NULL,
	[DefaultAnschrift] [int] NULL,
	[Preisliste] [int] NULL,
	[Bonus] [float] NULL,
	[BuchhaltNr] [varchar](20) NULL,
	[AkqVIP] [int] NULL,
	[Werbesperre] [int] NULL,
	[MahnPersonI3D] [int] NULL,
	[MahnArt] [varchar](50) NULL,
	[Gesperrt] [int] NULL,
	[AbwKundeI3D] [int] NULL,
	[AbwAnschriftI3D] [int] NULL,
	[Kommentar] [text] NULL,
	[WebKennwort] [varchar](50) NULL,
	[LastWebLogin] [datetime] NULL,
	[KlassifizierungI3D] [int] NULL,
	[ExterneI3D] [varchar](50) NULL,
	[ToDoAkquiseI3D] [int] NULL,
	[MWStAktiv] [int] NULL,
	[Waehrung] [int] NULL,
	[Abhaengigkeit] [int] NULL,
	[Vertrag] [int] NULL,
	[AngRepI3D] [int] NULL,
	[AngRepAnz] [int] NULL,
	[AufRepI3D] [int] NULL,
	[AufRepAnz] [int] NULL,
	[SerRepI3D] [int] NULL,
	[SerRepAnz] [int] NULL,
	[LiefRepI3D] [int] NULL,
	[LiefRepAnz] [int] NULL,
	[AbhRepI3D] [int] NULL,
	[AbhRepAnz] [int] NULL,
	[RechRepI3D] [int] NULL,
	[RechRepAnz] [int] NULL,
	[GutRepI3D] [int] NULL,
	[GutRepAnz] [int] NULL,
	[LiefDublRepI3D] [int] NULL,
	[LiefDublRepAnz] [int] NULL,
	[RechDublRepI3D] [int] NULL,
	[RechDublRepAnz] [int] NULL,
	[NeuInfoAngebot] [text] NULL,
	[NeuInfoAuftrag] [text] NULL,
	[NeuInfoLieferschein] [text] NULL,
	[NeuInfoAbholschein] [text] NULL,
	[NeuInfoRechnung] [text] NULL,
	[VertriebsgebietI3D] [int] NULL,
	[MahnungNachTagen] [int] NULL,
	[MahnungNachTagen2] [int] NULL,
	[MahnungNachTagen3] [int] NULL,
	[RWUebergabe] [int] NULL,
	[RWPersonalI3D] [int] NULL,
	[RWDatum] [datetime] NULL,
	[KundenHerkunftI3D] [int] NULL,
	[ActStatus] [varchar](10) NULL,
	[VertragDirI3D] [int] NULL,
	[AngRepI3DFax] [int] NULL,
	[AngRepI3DMail] [int] NULL,
	[AngRepI3DDruck] [int] NULL,
	[AufRepI3DFax] [int] NULL,
	[AufRepI3DMail] [int] NULL,
	[AufRepI3DDruck] [int] NULL,
	[SerRepI3DFax] [int] NULL,
	[SerRepI3DMail] [int] NULL,
	[SerRepI3DDruck] [int] NULL,
	[LiefRepI3DFax] [int] NULL,
	[LiefRepI3DMail] [int] NULL,
	[LiefRepI3DDruck] [int] NULL,
	[AbhRepI3DFax] [int] NULL,
	[AbhRepI3DMail] [int] NULL,
	[AbhRepI3DDruck] [int] NULL,
	[RechRepI3DFax] [int] NULL,
	[RechRepI3DMail] [int] NULL,
	[RechRepI3DDruck] [int] NULL,
	[GutRepI3DFax] [int] NULL,
	[GutRepI3DMail] [int] NULL,
	[GutRepI3DDruck] [int] NULL,
	[AngDirI3D] [int] NULL,
	[Kurzbezeichnung] [varchar](30) NULL,
	[SondervereinbarungI3D] [int] NULL,
	[AbwPersonI3D] [int] NULL,
	[AbwEmpfaenger] [varchar](500) NULL,
	[AbwLiefAnschriftI3D] [int] NULL,
	[AbwLiefEmpfaenger] [varchar](500) NULL,
	[AbwLiefKundeI3D] [int] NULL,
	[AbwLiefPersonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[ProjNrNoetig] [int] NULL,
	[AkqAnzahlFrei] [int] NULL,
	[AuftragsperreNachMahnung] [int] NULL,
	[KundenNummer] [int] NULL,
	[KundenNummerExt] [int] NULL,
	[NeuInfoHelpdesk] [text] NULL,
	[AkqFreiText1] [varchar](100) NULL,
	[AkqFreiText2] [varchar](100) NULL,
	[AkqFreiText3] [varchar](100) NULL,
	[AkqFreiText4] [varchar](100) NULL,
	[MailDirI3D] [int] NULL,
	[Lieferantenbewertung] [int] NULL,
	[ISOzertifiziert] [int] NULL,
	[ErstelltDurch] [int] NULL,
	[NeuInfoGutschrift] [text] NULL,
	[MahnungAnAbwRechAnschrift] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[FertigungskonfigurationsPflicht] [int] NULL,
	[FertigungskonfigurationDrucken] [int] NULL,
	[LagerI3D] [int] NULL,
	[VarialUebergabe] [int] NULL,
	[VarialPersonalI3D] [int] NULL,
	[VarialDatum] [datetime] NULL,
	[UnterweisungI3D] [int] NULL,
	[UnterweisungAktiv] [int] NULL,
	[KontakteI3D] [int] NULL,
	[AkqWiedervorlageEinstellung] [int] NULL,
	[AkqWiedervorlageArt] [int] NULL,
	[AkqWiedervorlageDauer] [int] NULL,
	[DistributorI3D] [int] NULL,
	[Freitext01] [varchar](255) NULL,
	[GutDirI3D] [int] NULL,
	[Warenempfaengernummer] [varchar](50) NULL,
	[KeinFrachtartikel] [int] NULL,
	[AbholDirI3D] [int] NULL,
	[Kontoinhaber] [varchar](255) NULL,
	[OrdnerLink] [varchar](500) NULL,
	[AkqWichtig] [int] NULL,
	[AkqFreitext5] [varchar](100) NULL,
	[AkqFreitext6] [varchar](100) NULL,
	[AkqFreiDatum1] [datetime] NULL,
	[AkqFreiDatum2] [datetime] NULL,
	[EmailBenachrichtigungHelpdesk] [varchar](255) NULL,
	[EmailBenachrichtigungHelpdeskBCC] [varchar](255) NULL,
	[HRB] [varchar](255) NULL,
	[KundenArt5] [int] NULL,
	[Betreuer5I3D] [int] NULL,
	[Betreuer6I3D] [int] NULL,
	[LimitBerechnungsArt] [int] NULL,
	[FIBUSammelkonto] [varchar](24) NULL,
	[RechnungVersandArt] [int] NULL,
	[AbwMailRechnungEmpfaengerI3D] [int] NULL,
	[BillingInterval] [int] NULL,
	[VertriebssteuerungI3D2] [int] NULL,
	[VertriebssteuerungI3D] [int] NULL,
	[HDFreigabeWesen] [bit] NULL,
	[DeliveryOption] [int] NULL,
	[RiverbirdMsp] [nvarchar](32) NULL,
	[HelpdeskClosingDontNotifyCustomer] [bit] NULL,
	[RiverbirdCustomerReference] [int] NULL,
 CONSTRAINT [Kunden_pk] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AufKopf]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[ErstellungsArt] [varchar](50) NULL,
	[Version] [int] NOT NULL,
	[Datum] [datetime] NOT NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NOT NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlkondID] [int] NULL,
	[LieferbedID] [int] NULL,
	[Status] [int] NULL,
	[Lockuser] [nvarchar](50) NULL,
	[AusAng] [int] NULL,
	[BestNr] [varchar](50) NULL,
	[ProjNr] [varchar](50) NULL,
	[Zusatztext] [varchar](70) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[Service] [int] NULL,
	[Kommisioniert] [int] NULL,
	[KommisioniertAm] [datetime] NULL,
	[Produziert] [int] NULL,
	[ProduziertAm] [datetime] NULL,
	[WorkFlowI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[AufScanDocI3D] [int] NULL,
	[BestScanDocI3D] [int] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[ToDoI3D] [int] NULL,
	[ToDoKomI3D] [int] NULL,
	[ToDoMonI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[RechKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](255) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[ZahlKondRechI3D] [int] NULL,
	[Direktlieferung] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[hlpdsk_requestsI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](1000) NULL,
	[RechnungskonditionsText] [varchar](1000) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[Var1Auftrag] [datetime] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[Abholung] [int] NULL,
	[LiefEskDatum] [datetime] NULL,
	[TerminplanungI3D] [int] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[Rabatt] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[FinaleVersion] [int] NULL,
	[BestellSperre] [int] NULL,
	[CreatedFromObjectI3D] [int] NULL,
	[CreatedFromObjectKind] [int] NULL,
	[BillingInterval] [int] NULL,
	[BillingBlocked] [bit] NULL,
	[BillingBlockedReason] [nvarchar](4000) NULL,
	[IsPositionProvision] [bit] NULL,
	[LeasingMonate] [int] NULL,
	[LeasingSatz] [float] NULL,
	[LeasingRate] [float] NULL,
	[Leasing] [int] NULL,
	[LeasingGebuehr] [float] NULL,
	[ServiceMonate] [int] NULL,
	[ServiceSatz] [float] NULL,
	[ServiceRate] [float] NULL,
	[IsServiceShare] [int] NULL,
	[ServiceGebuehr] [float] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFCComplete] [decimal](19, 2) NOT NULL,
	[VertragsI3D] [int] NULL,
	[CreateHelpdesks] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[ContractTypeI3D] [int] NULL,
	[ContractPositionCombinationDecision] [int] NOT NULL,
	[TakeOnlyArticles] [bit] NOT NULL,
	[CommissionMailSetting] [int] NOT NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
 CONSTRAINT [PK_AufKopf] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [ixAufKopf_Status]    Script Date: 11.11.2025 11:20:25 ******/
CREATE CLUSTERED INDEX [ixAufKopf_Status] ON [dbo].[AufKopf]
(
	[Status] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountActivities]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountActivities](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsDone] [bit] NOT NULL,
	[Caption] [nvarchar](255) NOT NULL,
	[Text] [nvarchar](max) NOT NULL,
	[TextRtf] [nvarchar](max) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[AccountAddressContactI3D] [int] NOT NULL,
	[ActivityKind] [tinyint] NOT NULL,
	[EditorI3D] [int] NOT NULL,
	[Rating] [tinyint] NOT NULL,
	[ProjectNumber] [nvarchar](100) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedVersion] [varchar](16) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[ChangedVersion] [varchar](16) NOT NULL,
	[DateFrom] [datetime2](7) NULL,
	[DateTo] [datetime2](7) NULL,
	[RecurrenceDate] [datetime2](7) NULL,
	[DueDate] [datetime2](7) NULL,
	[DirectoryI3D] [int] NULL,
	[HasDocuments] [bit] NOT NULL,
	[TodoI3D] [int] NULL,
	[SyncWithOutlook] [bit] NOT NULL,
	[ReferenceObjectI3D] [int] NULL,
	[ReferenceObjectKind] [int] NULL,
	[OldReferenceI3D] [int] NULL,
	[CampaignI3D] [int] NULL,
	[ProcessActivityI3D] [int] NULL,
 CONSTRAINT [PK_AccountActivities] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RechKopf]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RechKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[Version] [int] NOT NULL,
	[Datum] [datetime] NOT NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NOT NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[LieferBedID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[AusAuf] [char](10) NULL,
	[Service] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[Garantie] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[FaelligAm] [datetime] NULL,
	[Mahnung1Datum] [datetime] NULL,
	[Mahnung1BearbeiterI3D] [int] NULL,
	[Mahnung2Datum] [datetime] NULL,
	[Mahnung2BearbeiterI3D] [int] NULL,
	[Mahnung3Datum] [datetime] NULL,
	[Mahnung3BearbeiterI3D] [int] NULL,
	[MahnStop] [int] NULL,
	[MahnInfo] [varchar](max) NULL,
	[Mahnstufe] [int] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[Bezahlt] [float] NULL,
	[AbwKundeI3D] [int] NULL,
	[AbwAnschriftI3D] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[Zusatztext] [varchar](70) NULL,
	[BestNr] [varchar](50) NULL,
	[ProjNr] [varchar](50) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[RechKundFremd] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](255) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[Bar] [int] NULL,
	[VertragsI3D] [int] NULL,
	[Archiviert] [int] NULL,
	[Nachkalkulation] [int] NULL,
	[Direktlieferung] [int] NULL,
	[ToDoI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[OposImportInfo] [varchar](255) NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](1000) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[DTinErstellt] [int] NULL,
	[DTinDatum] [datetime] NULL,
	[DTinBearbeiter] [int] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[Trackingnummer] [varchar](500) NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[ExportHaben] [float] NULL,
	[LiefEskDatum] [datetime] NULL,
	[Var1Rechnung] [datetime] NULL,
	[Rabatt] [float] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[ESRKodierzeileBetrag] [varchar](30) NULL,
	[ESRReferenznummer] [varchar](40) NULL,
	[ESRBetrag] [varchar](20) NULL,
	[SummeEKOriginal] [float] NULL,
	[BezahltDifferenz] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[EDIExport] [int] NULL,
	[EDIExportVonI3D] [int] NULL,
	[EDIExportAm] [datetime] NULL,
	[FIBUSammelkonto] [varchar](24) NULL,
	[IsPositionProvision] [bit] NULL,
	[SepaMandateI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFCComplete] [decimal](19, 2) NOT NULL,
	[IsFixed] [bit] NOT NULL,
	[ExternalInvoiceNumber] [nvarchar](50) NULL,
	[ExternalInvoiceDate] [datetime2](7) NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[TrackingNumberURL] [nvarchar](2000) NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[DunningStopBegin] [datetime2](0) NULL,
	[DunningStopEnd] [datetime2](0) NULL,
	[DownPaymentForOrderI3D] [int] NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
 CONSTRAINT [PK_RechKopf] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [ixRechKopf_Status]    Script Date: 11.11.2025 11:20:25 ******/
CREATE CLUSTERED INDEX [ixRechKopf_Status] ON [dbo].[RechKopf]
(
	[Status] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Accounts]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Accounts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Number] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Matchcode] [nvarchar](64) NULL,
	[Phone] [nvarchar](50) NULL,
	[Fax] [nvarchar](50) NULL,
	[Email] [nvarchar](255) NULL,
	[WebSite] [nvarchar](255) NULL,
	[FaxDistributor] [bit] NULL,
	[MailDistributor] [bit] NULL,
	[RevenueIdentificationNumber] [nvarchar](30) NULL,
	[TaxNumber] [nvarchar](80) NULL,
	[TermsAndConditionReceivedDate] [datetime2](7) NULL,
	[TermsAndConditionEmployeeI3D] [int] NULL,
	[CreatedByI3D] [int] NULL,
	[CreatedDate] [datetime2](7) NULL,
	[CreatedVersion] [varchar](16) NULL,
	[ChangedByI3D] [int] NULL,
	[ChangedDate] [datetime2](7) NULL,
	[ChangedVersion] [varchar](16) NULL,
	[IsActive] [bit] NOT NULL,
	[MandatorI3D] [int] NULL,
	[Adviser1I3D] [int] NULL,
	[Adviser2I3D] [int] NULL,
	[Adviser3I3D] [int] NULL,
	[Adviser4I3D] [int] NULL,
	[Adviser5I3D] [int] NULL,
	[Adviser6I3D] [int] NULL,
	[IsLocked] [bit] NOT NULL,
	[Comment] [nvarchar](max) NULL,
	[SalesAreaI3D] [int] NULL,
	[OriginI3D] [int] NULL,
	[CompanyGroupI3D] [int] NULL,
	[CreatedThrough] [int] NOT NULL,
	[FreeText01] [nvarchar](255) NULL,
	[AdvertisingNotAllowed] [bit] NOT NULL,
	[InstructionI3D] [int] NULL,
	[IsInstructionActive] [bit] NOT NULL,
	[CommercialRegisterPage] [nvarchar](255) NULL,
	[InvoiceMailBCCReceiver] [nvarchar](max) NULL,
	[AdvertisingNotAllowedInfo] [nvarchar](200) NULL,
	[UseSettingsFromCompanyGroupForReceipts] [bit] NOT NULL,
 CONSTRAINT [PK_Accounts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragKopf]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Abrede] [text] NULL,
	[Anrede] [text] NULL,
	[Beginn] [datetime] NULL,
	[Berechnungsart] [int] NULL,
	[Ende] [datetime] NULL,
	[FremdvertragText] [varchar](1000) NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[AutoVerlaengerung] [int] NULL,
	[Fremdvertrag] [int] NULL,
	[Stammblattbezogen] [int] NULL,
	[Kuendigungsart] [int] NULL,
	[KuendigungsDatum] [datetime] NULL,
	[KuendigungsGrund] [text] NULL,
	[Laufzeit] [int] NULL,
	[LetzteRechnungDatum] [datetime] NULL,
	[Empfaenger] [varchar](500) NULL,
	[Datum] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[GeaendertVon] [nvarchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[LieferantenI3D] [int] NULL,
	[VertragsArtI3D] [int] NULL,
	[ZahlKondI3D] [int] NULL,
	[KuendigungsFristDauer1] [int] NULL,
	[KuendigungsFristArt1] [int] NULL,
	[KuendigungsFristDauer2] [int] NULL,
	[KuendigungsFristArt2] [int] NULL,
	[AbrechnungIntervallDauer] [int] NULL,
	[AbrechnungIntervallArt] [int] NULL,
	[AutoAbrechnung] [int] NULL,
	[LaufzeitArt] [int] NULL,
	[LaufzeitDauer] [int] NULL,
	[WartungIntervallArt] [int] NULL,
	[WartungIntervallDauer] [int] NULL,
	[Status] [int] NULL,
	[LieferbedingungI3D] [int] NULL,
	[Strasse] [varchar](300) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](255) NULL,
	[Zusatztext] [varchar](70) NULL,
	[BestNr] [varchar](50) NULL,
	[ProjNr] [varchar](50) NULL,
	[WartungIntervallArt2] [int] NULL,
	[WartungIntervallDauer2] [int] NULL,
	[Sammelrechnung] [int] NULL,
	[SNPflicht] [int] NULL,
	[RechKopfI3D] [int] NULL,
	[ReferenzNr] [varchar](255) NULL,
	[Wartung1ToDoI3D] [int] NULL,
	[Wartung2ToDoI3D] [int] NULL,
	[RechnungNormieren] [int] NULL,
	[LieferantName] [varchar](240) NULL,
	[LieferantAnsprech] [varchar](60) NULL,
	[LieferantTelefon] [varchar](30) NULL,
	[LieferantFax] [varchar](30) NULL,
	[LieferantEMail] [varchar](255) NULL,
	[LieferantVertragsNr] [varchar](100) NULL,
	[Wartung1Personal] [int] NULL,
	[Wartung2Personal] [int] NULL,
	[AbrechnungBeginn] [datetime] NULL,
	[Rahmenvertrag] [int] NULL,
	[RechEmpfaenger] [varchar](500) NULL,
	[ReaktionszeitArt1] [int] NULL,
	[ReaktionszeitDauer1] [int] NULL,
	[ReaktionszeitArt2] [int] NULL,
	[ReaktionszeitDauer2] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUser] [varchar](50) NULL,
	[Version] [int] NULL,
	[AussendienstID] [int] NULL,
	[ErstelltDurch] [int] NULL,
	[Verlaengerung] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[VollerBetragBeiNormierung] [int] NULL,
	[VertragsEndeToDoI3D] [int] NULL,
	[VertragsEndeToDoVorlauf] [int] NULL,
	[VertragsRechToDoI3D] [int] NULL,
	[VertragsRechToDoVorlauf] [int] NULL,
	[DocDirI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[ErstelltDatum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[Info] [varchar](8000) NULL,
	[InnendienstID] [int] NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[Ersteller] [varchar](50) NULL,
	[Bereitstellung] [datetime] NULL,
	[FertigungskonfI3D] [int] NULL,
	[Direktlieferung] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[Lieferdatum] [datetime] NULL,
	[LiefKundFremd] [int] NULL,
	[LSuREvVersand] [int] NULL,
	[RechKundFremd] [int] NULL,
	[Teillieferung] [int] NULL,
	[WVorlage] [datetime] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundInfo] [varchar](500) NULL,
	[InfoAnzeigen] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[Ansprech] [varchar](128) NULL,
	[Brutto] [float] NULL,
	[Netto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[Freikopien] [int] NULL,
	[AbwAbrechnungIntervallDauer] [int] NULL,
	[AbwAbrechnungIntervallArt] [int] NULL,
	[AnfangsKosten] [float] NULL,
	[KontingentVertrag] [int] NULL,
	[KontingentArt] [int] NULL,
	[KontingentWert] [float] NULL,
	[KontingentMindMenge] [float] NULL,
	[KontingentAusgleichArtikelI3D] [int] NULL,
	[AbwKontingentIntervallDauer] [int] NULL,
	[AbwKontingentIntervallArt] [int] NULL,
	[KontingentAusgleichsArtikelVerwenden] [int] NULL,
	[KontingentVerbrauchtStunden] [float] NULL,
	[KontingentVerbrauchtBetrag] [float] NULL,
	[KontingentUeberbuchung] [int] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[FilialgeberI3D] [int] NULL,
	[RestMitnehmen] [int] NULL,
	[Rabatt] [float] NULL,
	[KontingentAusglVerbrauchtStunden] [float] NULL,
	[KontingentAusglVerbrauchtBetrag] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[LetztesNachberechnungsDatum] [datetime] NULL,
	[KontingentRestWertStartDatum] [datetime] NULL,
	[KostenstellenI3D] [int] NULL,
	[AbschlussDatum] [datetime] NULL,
	[KontingentRestWertStart] [float] NULL,
	[ClickBerechnungsArt] [int] NULL,
	[Versandart] [int] NULL,
	[Versandmail] [varchar](200) NULL,
	[AbwAnsprechI3D] [int] NULL,
	[KontingentUnterwarenGr] [varchar](200) NULL,
	[SLAPriorityI3D] [int] NULL,
	[IsPositionProvision] [bit] NULL,
	[SepaMandateI3D] [int] NULL,
	[isContingentLimitBilling] [bit] NULL,
	[ContingentLimitValue] [numeric](10, 4) NULL,
	[ContingentLimitKind] [int] NULL,
	[Name] [nvarchar](256) NULL,
	[WithStaffelPrice] [bit] NULL,
	[IsMonitoring] [bit] NULL,
	[MonitoringValue] [int] NULL,
	[CalcNeedKind] [int] NULL,
	[HourlySurchargeRateI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[ContingentBillingContractI3D] [int] NULL,
	[IsDisplayedOnWeb] [bit] NOT NULL,
	[WebReportI3D] [int] NULL,
	[DeliveryConditionText] [nvarchar](1000) NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[IsHiddenInHelpdesk] [bit] NOT NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
 CONSTRAINT [Pk_VertragKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountCustomers]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountCustomers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Number] [int] NOT NULL,
	[BookKeepingNumber] [nvarchar](64) NOT NULL,
	[ReceiptConditionOfferI3D] [int] NULL,
	[ReceiptConditionOrderI3D] [int] NULL,
	[ReceiptConditionDeliveryListI3D] [int] NULL,
	[ReceiptConditionPickupListI3D] [int] NULL,
	[ReceiptConditionInvoiceI3D] [int] NULL,
	[ReceiptConditionCreditVoucherI3D] [int] NULL,
	[ReceiptConditionDeliveryI3D] [int] NULL,
	[ReceiptConditionDeliveryOfferI3D] [int] NULL,
	[ReceiptConditionDeliveryOrderI3D] [int] NULL,
	[Discount] [decimal](9, 2) NOT NULL,
	[Limit] [decimal](18, 2) NOT NULL,
	[LimitCalculationKind] [int] NULL,
	[IsPurchaseOrderNumberRequired] [bit] NOT NULL,
	[ExtraChargeRetailPrice] [decimal](9, 2) NOT NULL,
	[DeliveryText] [nvarchar](500) NULL,
	[PriceList] [int] NULL,
	[DunningLetterRecipientPersonI3D] [int] NULL,
	[DunningLetterUseAlternativeInvoiceAddress] [bit] NOT NULL,
	[DunningLetterKind] [nvarchar](50) NULL,
	[DunningLetterAfterDays1] [int] NULL,
	[DunningLetterAfterDays2] [int] NULL,
	[DunningLetterAfterDays3] [int] NULL,
	[LockOrderAfterDunningLevel] [int] NULL,
	[AlternativeInvoiceAccountI3D] [int] NULL,
	[AlternativeInvoiceAddressI3D] [int] NULL,
	[AlternativeInvoiceAddressContactI3D] [int] NULL,
	[AlternativeInvoiceReceiver] [nvarchar](500) NULL,
	[AlternativeDeliveryAccountI3D] [int] NULL,
	[AlternativeDeliveryAddressI3D] [int] NULL,
	[AlternativeDeliveryAddressContactI3D] [int] NULL,
	[AlternativeDeliveryReceiver] [nvarchar](500) NULL,
	[ClassificationI3D] [int] NULL,
	[IsExclusiveOfVAT] [bit] NOT NULL,
	[CommentOffer] [nvarchar](max) NULL,
	[CommentOrder] [nvarchar](max) NULL,
	[CommentDeliveryList] [nvarchar](max) NULL,
	[CommentPickupList] [nvarchar](max) NULL,
	[CommentInvoice] [nvarchar](max) NULL,
	[CommentCreditVoucher] [nvarchar](max) NULL,
	[CommentHelpdesk] [nvarchar](max) NULL,
	[IsBookKeepingExportDone] [bit] NOT NULL,
	[BookKeepingExportEmployeeI3D] [int] NULL,
	[BookKeepingExportDate] [datetime2](7) NULL,
	[IsBookKeepingExportDeaktivated] [bit] NOT NULL,
	[BookKeepingCollectionAccount] [nvarchar](24) NULL,
	[SpecialAgreementI3D] [int] NULL,
	[IsProjectNumberRequired] [bit] NOT NULL,
	[IsDiscountTextVisibilityDeaktivated] [bit] NOT NULL,
	[IsProductionConfigurationMandatory] [bit] NOT NULL,
	[PrintProductionConfiguration] [bit] NOT NULL,
	[WarehouseI3D] [int] NULL,
	[PriceListFromDistributorI3D] [int] NULL,
	[ProductRecipientNumber] [nvarchar](50) NULL,
	[ShippingCostsDeaktivated] [bit] NOT NULL,
	[MailNotificationAtHelpdeskCC] [nvarchar](255) NULL,
	[MailNotificationAtHelpdeskBCC] [nvarchar](255) NULL,
	[InvoiceDeliveryKind] [int] NULL,
	[AlternativeInvoiceMailRecipientI3D] [int] NULL,
	[SalesControllingI3D] [int] NULL,
	[HasTicketApproval] [bit] NULL,
	[RootDirI3D] [int] NULL,
	[DeliveryOption] [int] NULL,
	[CountServer] [int] NULL,
	[CountPc] [int] NULL,
	[ServerManufacturor] [nvarchar](80) NULL,
	[PcManufacturor] [nvarchar](80) NULL,
	[PrinterManufacturor] [nvarchar](80) NULL,
	[BoughtByThusFar] [nvarchar](80) NULL,
	[CrmText1] [nvarchar](100) NULL,
	[CrmText2] [nvarchar](100) NULL,
	[CrmText3] [nvarchar](100) NULL,
	[CrmText4] [nvarchar](100) NULL,
	[CrmText5] [nvarchar](100) NULL,
	[CrmText6] [nvarchar](100) NULL,
	[AdditionalInformation] [nvarchar](max) NULL,
	[AcquisionComplete] [bit] NULL,
	[AcquisionImportant] [bit] NULL,
	[AcquisionFreeDate1] [datetime2](0) NULL,
	[AcquisionFreeDate2] [datetime2](0) NULL,
	[CoreDataComplete] [bit] NULL,
	[Vip] [bit] NULL,
	[RiverbirdMsp] [nvarchar](32) NULL,
	[HelpdeskClosingDontNotifyCustomer] [bit] NULL,
	[ExportZUGFeRDDocument] [bit] NULL,
	[LeitwegID] [nvarchar](50) NULL,
	[OwnSupplierNumber] [nvarchar](20) NULL,
	[ProvisionSchemaI3D] [int] NULL,
	[CanSeeTicketsSBO] [bit] NOT NULL,
	[TicketsVisibleFromDateSBO] [datetime2](0) NULL,
	[CustomerApprovalEnabledSBO] [bit] NOT NULL,
	[DunningStop] [bit] NULL,
	[DunningStopBegin] [datetime2](0) NULL,
	[DunningStopEnd] [datetime2](0) NULL,
	[DunningInfo] [varchar](max) NULL,
	[RiverbirdCustomerReference] [int] NULL,
	[TelekomReferenceNumber] [nvarchar](255) NULL,
	[TelekomDiveComment] [nvarchar](300) NULL,
	[IsTelekomDiveCommentActive] [bit] NULL,
	[MandatorBank] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
 CONSTRAINT [PK_AccountCustomers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [IX_AccountCustomers_UniqueNumber] UNIQUE NONCLUSTERED 
(
	[Number] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountSuppliers]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountSuppliers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Number] [int] NOT NULL,
	[BookKeepingNumber] [nvarchar](64) NOT NULL,
	[OwnCustomerNumber] [nvarchar](20) NULL,
	[ReceiptConditionOfferI3D] [int] NULL,
	[ReceiptConditionOrderI3D] [int] NULL,
	[ReceiptConditionInvoiceI3D] [int] NULL,
	[ReceiptConditionDeliveryOfferI3D] [int] NULL,
	[ReceiptConditionDeliveryOrderI3D] [int] NULL,
	[Discount] [decimal](9, 2) NOT NULL,
	[IsDiscountAtPriceBase] [bit] NOT NULL,
	[Limit] [decimal](18, 2) NOT NULL,
	[LimitCalculationKind] [int] NULL,
	[IsExclusiveOfVAT] [bit] NOT NULL,
	[CommentOffer] [nvarchar](max) NULL,
	[CommentOrder] [nvarchar](max) NULL,
	[CommentDeliveryList] [nvarchar](max) NULL,
	[CommentInvoice] [nvarchar](max) NULL,
	[CommentCreditVoucher] [nvarchar](max) NULL,
	[IsBookKeepingExportDone] [bit] NOT NULL,
	[BookKeepingExportEmployeeI3D] [int] NULL,
	[BookKeepingExportDate] [datetime2](7) NULL,
	[IsBookKeepingExportDeaktivated] [bit] NOT NULL,
	[BookKeepingCollectionAccount] [nvarchar](24) NULL,
	[WarehouseI3D] [int] NULL,
	[SupplierClassification] [int] NULL,
	[IsIsoCertified] [bit] NOT NULL,
	[IsManufacturer] [bit] NOT NULL,
	[IsCarrier] [bit] NOT NULL,
	[RMANeeded] [bit] NULL,
	[RMAInfo] [nvarchar](500) NULL,
	[EDIKind] [int] NULL,
	[FreightCost] [decimal](18, 2) NOT NULL,
	[FreightCostFree] [decimal](18, 2) NOT NULL,
	[MinimumOrderValue] [decimal](18, 2) NOT NULL,
	[SmallQuantitiesExtraCharge] [decimal](18, 2) NOT NULL,
	[WEEE] [nvarchar](100) NULL,
	[IsDirectDelivery] [bit] NOT NULL,
	[FreightCostDirectDelivery] [decimal](18, 2) NOT NULL,
	[FreightCostFreeAtDirectDelivery] [decimal](18, 2) NOT NULL,
	[MinimumOrderValueAtDirectDelivery] [decimal](18, 2) NOT NULL,
	[SmallQuantitiesExtraChargeAtDirectDelivery] [decimal](18, 2) NOT NULL,
	[EgisSupplierNumber] [nvarchar](50) NULL,
	[ItScopeSupplierNumber] [nvarchar](50) NULL,
	[IsAlkaSupplier] [bit] NOT NULL,
	[PbsEasySupplierNumber] [nvarchar](50) NULL,
	[PbsEasyX400MailAddress] [nvarchar](255) NULL,
	[TradersGuideSupplierI3D] [int] NULL,
	[CarrierShortSign] [nvarchar](10) NULL,
	[RootDirI3D] [int] NULL,
	[ReceiptConditionCreditVoucherI3D] [int] NULL,
	[IsDistributor] [bit] NOT NULL,
	[IsFavorite] [bit] NULL,
	[ConcertoSupplierNumber] [nvarchar](50) NULL,
 CONSTRAINT [PK_AccountSuppliers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [IX_AccountSuppliers_UniqueNumber] UNIQUE NONCLUSTERED 
(
	[Number] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountTypeToAccounts]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountTypeToAccounts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountTypeI3D] [int] NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[AccountCustomerI3D] [int] NULL,
	[AccountSupplierI3D] [int] NULL,
 CONSTRAINT [PK_AccountTypeToAccounts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AngKopf]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[Version] [int] NOT NULL,
	[Datum] [datetime] NOT NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NOT NULL,
	[AnschriftID] [int] NOT NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[LieferbedID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[Import] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[LeasingMonate] [int] NULL,
	[LeasingSatz] [float] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LeasingRate] [float] NULL,
	[Leasing] [int] NULL,
	[LeasingGebuehr] [float] NULL,
	[Angebotklasse] [int] NULL,
	[ProjektEnde] [datetime] NULL,
	[AngebKlassifI3D] [int] NULL,
	[Projektnummer] [varchar](50) NULL,
	[AngUeberschrift] [varchar](70) NULL,
	[ToDoI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](255) NULL,
	[Bar] [int] NULL,
	[AbschlGrund] [varchar](100) NULL,
	[AbschlI3D] [int] NULL,
	[ZahlKondRechI3D] [int] NULL,
	[DocDirI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](1000) NULL,
	[RechnungskonditionsText] [varchar](1000) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[BestNr] [varchar](50) NULL,
	[Zusatztext] [varchar](50) NULL,
	[Direktlieferung] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[Lieferdatum] [datetime] NULL,
	[LiefKundFremd] [int] NULL,
	[LSuREvVersand] [int] NULL,
	[ProjNr] [varchar](50) NULL,
	[RechKundFremd] [int] NULL,
	[Teillieferung] [int] NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[LcmStatus] [int] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[ErstelltAusI3D] [int] NULL,
	[ErstelltAusArt] [int] NULL,
	[ErstelltAusNummer] [int] NULL,
	[Rabatt] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[IsPositionProvision] [bit] NULL,
	[ServiceMonate] [int] NULL,
	[ServiceSatz] [float] NULL,
	[ServiceRate] [float] NULL,
	[IsServiceShare] [int] NULL,
	[ServiceGebuehr] [float] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[LeasingPosSatz] [numeric](5, 2) NULL,
	[ServicePosSatz] [numeric](5, 2) NULL,
	[CustomLeasingPosSatz] [bit] NULL,
	[CustomServicePosSatz] [bit] NULL,
	[CustomLeasingSatz] [bit] NULL,
	[CustomServiceSatz] [bit] NULL,
	[IsPosCalculation] [bit] NULL,
	[VertragsI3D] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[IsCart] [bit] NOT NULL,
	[CartName] [nvarchar](250) NULL,
	[CartDescription] [nvarchar](4000) NULL,
	[CartCreatorContactPersonI3D] [int] NULL,
	[ContractTypeI3D] [int] NULL,
	[ContractPositionCombinationDecision] [int] NOT NULL,
	[TakeOnlyArticles] [bit] NOT NULL,
	[CartAssembleArticles] [bit] NOT NULL,
	[CartState] [nvarchar](100) NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
 CONSTRAINT [PK_AngKopf] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [ixAngKopf_Status]    Script Date: 11.11.2025 11:20:25 ******/
CREATE CLUSTERED INDEX [ixAngKopf_Status] ON [dbo].[AngKopf]
(
	[Status] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ToDoListe]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ToDoListe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NULL,
	[Nummer] [int] NULL,
	[Datum] [datetime] NULL,
	[Termin] [datetime] NULL,
	[KundeI3D] [int] NULL,
	[Bereich] [varchar](50) NULL,
	[Kommentar] [varchar](500) NULL,
	[BearbeiterI3D] [int] NULL,
	[BearbeitungsDatum] [datetime] NULL,
	[ErstellDatum] [datetime] NULL,
	[ErstellerPersonalI3D] [int] NULL,
	[ObjektArt] [int] NULL,
	[ObjectI3D] [int] NULL,
	[Gelesen] [int] NULL,
	[Verworfen] [int] NULL,
	[Abteilung] [int] NULL,
	[Text] [varchar](100) NULL,
	[Bezeichnung] [varchar](50) NULL,
	[WorkFlowI3D] [int] NULL,
	[Erledigt] [int] NULL,
	[ErledigtAm] [datetime] NULL,
	[Beschreibung] [varchar](2000) NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[ItemCount] [int] NULL,
	[ObjektGruppe] [int] NULL,
	[PosI3D] [int] NULL,
	[AccountI3D] [int] NULL,
 CONSTRAINT [PK_ToDoListe] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleWorkItems]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleWorkItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SortOrder] [decimal](9, 6) NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[Caption] [nvarchar](1000) NOT NULL,
	[TextInRTF] [nvarchar](max) NULL,
	[DurationInHours] [float] NULL,
	[TicketPatternI3D] [int] NULL,
	[Price] [decimal](18, 7) NULL,
	[PriceIsIncluded] [bit] NOT NULL,
	[BillingArticleI3D] [int] NULL,
	[CategoryI3D] [int] NULL,
	[PurchasePrice] [decimal](18, 7) NULL,
	[OriginWorkItemI3D] [int] NULL,
	[FixDurationForServiceEmployee] [bit] NULL,
 CONSTRAINT [PK_ArticleWorkItems] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [CI_ArticleWorkItems]    Script Date: 11.11.2025 11:20:25 ******/
CREATE CLUSTERED INDEX [CI_ArticleWorkItems] ON [dbo].[ArticleWorkItems]
(
	[ObjectI3D] ASC,
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_typen]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_typen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](300) NULL,
	[Status] [int] NULL,
	[Farbe] [varchar](10) NULL,
	[Deactivated] [bit] NULL,
	[ServiceBoardWebColor] [varchar](30) NULL,
	[ServiceBoardWebIcon] [varchar](50) NULL,
 CONSTRAINT [PK_hlpdsk_typen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Rma]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Rma](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Number] [int] NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[AccountName] [nvarchar](510) NOT NULL,
	[AccountAddressI3D] [int] NOT NULL,
	[AccountAddressContactPersonI3D] [int] NOT NULL,
	[RmaKind] [int] NOT NULL,
	[HelpdeskI3D] [int] NOT NULL,
	[Description] [nvarchar](max) NULL,
	[IsClosed] [bit] NOT NULL,
	[SupplierAccountI3D] [int] NULL,
	[SupplierAccountName] [nvarchar](510) NULL,
	[SupplierAccountAddressI3D] [int] NULL,
	[SupplierAccountAddressContactPerson] [int] NULL,
	[RootDirI3D] [int] NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CreatedVersion] [varchar](25) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](2) NOT NULL,
	[ChangedVersion] [varchar](25) NOT NULL,
	[SupplierName] [nvarchar](100) NULL,
	[SupplierNumber] [int] NULL,
 CONSTRAINT [PK_Rma] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [CI_RMA_HelpdeskI3D]    Script Date: 11.11.2025 11:20:25 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_RMA_HelpdeskI3D] ON [dbo].[Rma]
(
	[HelpdeskI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Filiale]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Filiale](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MandantI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[Strasse] [varchar](255) NULL,
	[Postleitzahl] [varchar](10) NULL,
	[Stadt] [varchar](100) NULL,
	[Kommentar] [varchar](5000) NULL,
	[TelefonNummer] [varchar](30) NULL,
	[FaxNummer] [varchar](30) NULL,
	[EMail] [varchar](255) NULL,
	[WWW] [varchar](255) NULL,
	[SpracheI3D] [int] NULL,
	[FilialName] [varchar](255) NULL,
	[IsDefault] [int] NULL,
	[FilialStatus] [int] NULL,
	[FilialID] [varchar](255) NULL,
	[ErstellerI3D] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[GeloeschtVonI3D] [int] NULL,
	[GeloeschtAm] [datetime] NULL,
	[Status] [int] NULL,
	[BundeslandI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
	[Buchhaltungsnummer] [nvarchar](32) NULL,
	[Preisliste] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragsArt]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragsArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](300) NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
	[Farbe] [int] NULL,
	[Fremdvertrag] [int] NULL,
	[LaufzeitArt] [int] NULL,
	[LaufzeitDauer] [int] NULL,
	[WartungIntervallArt] [int] NULL,
	[WartungIntervallDauer] [int] NULL,
	[Berechnungsart] [int] NULL,
	[AbrechnungIntervallDauer] [int] NULL,
	[AbrechnungIntervallArt] [int] NULL,
	[ZahlKondI3D] [int] NULL,
	[AutoAbrechnung] [int] NULL,
	[KuendigungsFristDauer1] [int] NULL,
	[KuendigungsFristArt1] [int] NULL,
	[KuendigungsFristDauer2] [int] NULL,
	[KuendigungsFristArt2] [int] NULL,
	[Anrede] [varchar](8000) NULL,
	[Abrede] [varchar](8000) NULL,
	[LieferbedingungI3D] [int] NULL,
	[WartungIntervallArt2] [int] NULL,
	[WartungIntervallDauer2] [int] NULL,
	[Sammelrechnung] [int] NULL,
	[SNPflicht] [int] NULL,
	[Stammblattbezogen] [int] NULL,
	[RechnungNormieren] [int] NULL,
	[ReaktionszeitArt1] [int] NULL,
	[ReaktionszeitDauer1] [int] NULL,
	[ReaktionszeitArt2] [int] NULL,
	[ReaktionszeitDauer2] [int] NULL,
	[Verlaengerung] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[VertragsEndeToDoVorlauf] [int] NULL,
	[VertragsRechToDoVorlauf] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[VerlaengerungDauer] [int] NULL,
	[KontingentVertrag] [int] NULL,
	[VertragsArtKategorieI3D] [int] NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[AbrechnungsReportI3D] [int] NULL,
	[ShortSign] [nvarchar](20) NULL,
	[C2ReportI3D] [int] NULL,
	[WithStaffelPrice] [bit] NULL,
	[CalcNeedKind] [int] NULL,
	[HourlySurchargeRateI3D] [int] NULL,
	[CanChangeSendKind] [bit] NOT NULL,
	[SendKind] [int] NOT NULL,
	[CostCenterI3D] [int] NULL,
	[CostObjectI3D] [int] NULL,
	[IsDisplayedOnWeb] [bit] NULL,
	[WebReportI3D] [int] NULL,
	[CalculationPrio] [int] NULL,
 CONSTRAINT [PK_VertragsArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_kategorien]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_kategorien](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](300) NULL,
	[Status] [int] NULL,
	[ParentI3D] [int] NULL,
	[Deactivated] [bit] NULL,
	[ServiceBoardWebColor] [varchar](30) NULL,
	[ServiceBoardWebIcon] [varchar](50) NULL,
 CONSTRAINT [PK_hlpdsk_kategorien] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Personal]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Personal](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](60) NULL,
	[Vorname] [varchar](60) NULL,
	[Telefon1] [varchar](30) NULL,
	[Telefon2] [varchar](30) NULL,
	[Telefon3] [varchar](30) NULL,
	[Telefon4] [varchar](30) NULL,
	[Fax1] [varchar](30) NULL,
	[Fax2] [varchar](30) NULL,
	[EMail] [varchar](255) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[VerkText] [varchar](255) NULL,
	[Kommentar] [varchar](255) NULL,
	[Status] [int] NULL,
	[Unterschr] [image] NULL,
	[UnterschrExt] [varchar](4) NULL,
	[Foto] [image] NULL,
	[FotoExt] [varchar](4) NULL,
	[ServiceGruppe] [int] NULL,
	[Import] [int] NULL,
	[Vertriebsertrag] [float] NULL,
	[Abteilungen] [int] NULL,
	[Geburtstag] [datetime] NULL,
	[Pin] [varchar](4) NULL,
	[KeyCode] [varchar](50) NULL,
	[UeberstundenAnzeige] [int] NULL,
	[FehlstundenAnzeige] [int] NULL,
	[ResturlaubAnzeige] [int] NULL,
	[StundenMontag] [int] NULL,
	[StundenDienstag] [int] NULL,
	[StundenMittwoch] [int] NULL,
	[StundenDonnerstag] [int] NULL,
	[StundenFreitag] [int] NULL,
	[StundenSamstag] [int] NULL,
	[StundenSonntag] [int] NULL,
	[Ueberstunden] [int] NULL,
	[UeberstundenDatum] [datetime] NULL,
	[Ueberstundentoleranz] [int] NULL,
	[Ueberstundenverfall] [int] NULL,
	[Resturlaub] [float] NULL,
	[Urlaubsanspruch] [float] NULL,
	[Anwesend] [int] NULL,
	[Vertreter] [int] NULL,
	[RootDirI3D] [int] NULL,
	[BewDirI3D] [int] NULL,
	[GespDirI3D] [int] NULL,
	[VerDirI3D] [int] NULL,
	[ZertDirI3D] [int] NULL,
	[SonsDirI3D] [int] NULL,
	[MailPostfach] [varchar](50) NULL,
	[ErinnProbe] [int] NULL,
	[ErinnPersVertr] [int] NULL,
	[ErinnMAKosten] [int] NULL,
	[Eintritt] [datetime] NULL,
	[Austritt] [datetime] NULL,
	[Probezeit] [int] NULL,
	[Vertragslaufzeit] [int] NULL,
	[VertragsArt] [varchar](255) NULL,
	[PersonalGruppenI3D] [int] NULL,
	[MAKosten] [float] NULL,
	[ToDoProbeI3D] [int] NULL,
	[ToDoPersVertrI3D] [int] NULL,
	[ToDoMAKostenI3D] [int] NULL,
	[ErinnInTageProbe] [int] NULL,
	[ErinnInTageVertr] [int] NULL,
	[KostenstelleI3D] [int] NULL,
	[Signatur] [varchar](500) NULL,
	[VorgesetzterI3D] [int] NULL,
	[Personalnummer] [int] NULL,
	[StundenInFolgemonat] [float] NULL,
	[StartCursorKundenstamm] [int] NULL,
	[StartCursorLieferantenstamm] [int] NULL,
	[BranchI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[HelpdeskAnsicht] [int] NULL,
	[varFloat1] [float] NULL,
	[varFloat2] [float] NULL,
	[varFloat3] [float] NULL,
	[varFloat4] [float] NULL,
	[AbholscheinAnsicht] [int] NULL,
	[AngebotAnsicht] [int] NULL,
	[AuftragAnsicht] [int] NULL,
	[GutschriftAnsicht] [int] NULL,
	[LieferscheinAnsicht] [int] NULL,
	[RechnungAnsicht] [int] NULL,
	[ServiceAuftragAnsicht] [int] NULL,
	[HelpdeskToggleDropDowns] [int] NULL,
	[UserINI] [text] NULL,
	[ForumUsername] [varchar](25) NULL,
	[ForumPasswort] [varchar](30) NULL,
	[PortalUsername] [varchar](250) NULL,
	[PortalPasswort] [varchar](255) NULL,
	[QuickStartAnzeigen] [int] NULL,
	[ProxyausIE] [int] NULL,
	[ToDoAutoRefresh] [int] NULL,
	[ToDoAutoRefreshIntervall] [int] NULL,
	[TAPIAutoEvent] [int] NULL,
	[VertragAnsicht] [int] NULL,
	[HelpdeskZeit] [int] NULL,
	[Strasse] [varchar](200) NULL,
	[Plz] [varchar](10) NULL,
	[Wohnort] [varchar](30) NULL,
	[QmDirI3D] [int] NULL,
	[SkillsDirI3D] [int] NULL,
	[AutoRechDruck] [int] NULL,
	[AutoMarkHelpdeskZeiten] [int] NULL,
	[StandardLagerI3D] [int] NULL,
	[AutovervollstaendigungArtikelSuche] [int] NULL,
	[MailAgentVZEntryID] [varchar](500) NULL,
	[MailAgentVZStoreID] [varchar](500) NULL,
	[MailAgentDatumEinschraenken] [int] NULL,
	[MailAgentLetzteXTageAnzeigen] [int] NULL,
	[MailAgentBodyAlsPlaintextAnzeigen] [int] NULL,
	[UrlaubsInfo] [varchar](500) NULL,
	[Beruf] [varchar](255) NULL,
	[Sprachkenntnisse] [varchar](255) NULL,
	[SettingsXML] [text] NULL,
	[FilterActive] [int] NULL,
	[AnredeI3D] [int] NULL,
	[StammblattAnsicht] [int] NULL,
	[StartCursorAfterInsertArticle] [int] NULL,
	[VertretungSiehtToDoListe] [int] NULL,
	[HelpdeskWebLink] [varchar](500) NULL,
	[varFloat5] [float] NULL,
	[varFloat6] [float] NULL,
	[varFloat7] [float] NULL,
	[varFloat8] [float] NULL,
	[varFloat9] [float] NULL,
	[varFloat10] [float] NULL,
	[MailTyp] [int] NULL,
	[MailFontName] [varchar](100) NULL,
	[MailFontSize] [int] NULL,
	[MailFontColor] [int] NULL,
	[MailFontStyle] [int] NULL,
	[BeiFehlerArtikelsucheLeeren] [int] NULL,
	[Einstellungen] [text] NULL,
	[MailfinderUser] [varchar](50) NULL,
	[MailfinderPWD] [varchar](50) NULL,
	[SupportLevelI3D] [int] NULL,
	[IsActive]  AS (case when [Status]=(1) AND (isnull([Austritt],(0))<(3) OR [Austritt]>getdate()) then (1) else (0) end),
	[Dispatcher] [bit] NOT NULL,
	[SupplierI3D] [int] NULL,
	[Availability] [int] NOT NULL,
	[LastAvailabilityChange] [datetime2](7) NULL,
	[SignaturePicture] [varbinary](max) NULL,
	[SignaturePictureFileExtension] [nvarchar](4) NULL,
	[GraphOdataDeltaLink] [nvarchar](max) NULL,
	[GraphOdataNextLink] [nvarchar](max) NULL,
 CONSTRAINT [PK_Personal] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [ixI3D]    Script Date: 11.11.2025 11:20:25 ******/
CREATE CLUSTERED INDEX [ixI3D] ON [dbo].[Personal]
(
	[I3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_prioritaeten]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_prioritaeten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](300) NULL,
	[Beschreibung] [varchar](300) NULL,
	[Werktage] [float] NULL,
	[Stunde2] [float] NULL,
	[Stunde3] [float] NULL,
	[Status] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3d] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[EskalationSa] [int] NULL,
	[EskalationSo] [int] NULL,
	[GeschaeftsZeitVon] [datetime] NULL,
	[GeschaeftsZeitBis] [datetime] NULL,
	[Farbe] [varchar](10) NULL,
	[FaeligkeitVerzoegerung] [float] NULL,
	[IsSLA] [bit] NULL,
	[Deactivated] [bit] NULL,
	[Number] [int] NULL,
	[ServiceBoardWebColor] [varchar](30) NULL,
	[ServiceBoardWebIcon] [varchar](50) NULL,
 CONSTRAINT [PK_hlpdsk_prioritaeten] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_requests]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_requests](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Beschreibung] [nvarchar](1000) NULL,
	[Problem] [nvarchar](max) NULL,
	[HauptkategorieI3D] [int] NULL,
	[Unterkategorie1I3D] [int] NULL,
	[Unterkategorie2I3D] [int] NULL,
	[Prioritaet] [int] NULL,
	[hlpdsk_typenI3D] [int] NULL,
	[Status] [int] NULL,
	[VerantwortlicherI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[KundeI3D] [int] NULL,
	[AnsprechpartnerI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[KundeEMail] [varchar](255) NULL,
	[FaelligAm] [datetime] NULL,
	[AbgeschlossenAm] [datetime] NULL,
	[ErfasstAm] [datetime] NULL,
	[hlpdsk_loesungI3D] [int] NULL,
	[inFAQ] [int] NULL,
	[isTemplate] [int] NULL,
	[TemplateI3D] [int] NULL,
	[TemplatePos] [int] NULL,
	[LatestHistoryI3D] [int] NULL,
	[TodoI3D] [int] NULL,
	[ScanDocI3D] [int] NULL,
	[RechPosI3D] [int] NULL,
	[SerienNr] [varchar](50) NULL,
	[WebKundeI3D] [int] NULL,
	[Berechnet] [int] NULL,
	[VertragI3D] [int] NULL,
	[VertragArt] [int] NULL,
	[LizenzKopfI3D] [int] NULL,
	[ArtikTyp] [int] NULL,
	[Bearbeiter] [varchar](255) NULL,
	[BearbeiterI3D] [int] NULL,
	[OutlookModul] [varchar](250) NULL,
	[OutlookPrioritaet] [int] NULL,
	[ErstelltAus] [int] NULL,
	[Kennzeichen] [int] NULL,
	[Version] [varchar](100) NULL,
	[Verknuepfungsnummer] [int] NULL,
	[LockUserI3D] [int] NULL,
	[Zusatztext2] [varchar](100) NULL,
	[Dokumentation] [nvarchar](max) NULL,
	[ZuDokumentieren] [int] NULL,
	[IstDokumentiert] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUser] [nvarchar](50) NULL,
	[ErstelltDurch] [int] NULL,
	[IstRMAFall] [int] NULL,
	[AnsprechAnrede] [varchar](50) NULL,
	[AnsprechName] [varchar](255) NULL,
	[AnsprechTelefon] [varchar](50) NULL,
	[AnsprechEMail] [varchar](255) NULL,
	[KundeName] [varchar](500) NULL,
	[KundeStrasse] [varchar](200) NULL,
	[KundePLZ] [varchar](10) NULL,
	[KundeOrt] [varchar](50) NULL,
	[KundeInnendienst] [nvarchar](50) NULL,
	[KundeAussendienst] [nvarchar](50) NULL,
	[KundeTechniker] [nvarchar](50) NULL,
	[KundeTechniker2] [nvarchar](50) NULL,
	[AnsprechFax] [varchar](50) NULL,
	[hlpdsk_GruppenI3D] [int] NULL,
	[Freitext1] [varchar](250) NULL,
	[FehlerNr] [int] NULL,
	[AnlageAufforderung] [int] NULL,
	[Bewertung] [int] NULL,
	[BearbeitungszeitraumStart] [datetime] NULL,
	[BearbeitungszeitraumEnde] [datetime] NULL,
	[AnsprechMobil] [varchar](30) NULL,
	[ContactLocalChanges] [int] NULL,
	[GeplanteDauerInStd] [float] NULL,
	[CreatedFromObjectI3D] [int] NULL,
	[CreatedFromObjectKind] [int] NULL,
	[IsTicketRefused] [bit] NULL,
	[InternalNote] [nvarchar](max) NULL,
	[IsOnlyInternalVisible] [bit] NOT NULL,
	[ProjectNumber] [varchar](50) NULL,
	[CentronFingerprint] [nvarchar](100) NULL,
	[FilialI3D] [int] NULL,
	[CreatedFromTicketPatternI3D] [int] NULL,
	[ParentHelpdeskI3D] [int] NULL,
	[ProjectHelpdeskI3D] [int] NULL,
	[ArticleWorkItemI3D] [int] NULL,
	[EscalationLevel] [int] NOT NULL,
	[CFlowStateI3D] [int] NULL,
	[LastCommentDate] [datetime2](0) NULL,
	[LastEmailDate] [datetime2](0) NULL,
 CONSTRAINT [PK_hlpdsk_requests] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_status]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_status](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](300) NULL,
	[Beschreibung] [varchar](300) NULL,
	[Icon] [image] NULL,
	[Status] [int] NULL,
	[Deactivated] [bit] NULL,
	[InternalCompanyBillingActive] [bit] NULL,
	[Number] [int] NULL,
	[ServiceBoardWebColor] [varchar](30) NULL,
	[ServiceBoardWebIcon] [varchar](50) NULL,
 CONSTRAINT [PK_hlpdsk_status] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CacheTicketStatistic]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CacheTicketStatistic](
	[I3D] [int] NOT NULL,
	[Number] [int] NOT NULL,
	[ShortDescription] [nvarchar](1000) NOT NULL,
	[CreatedFrom] [int] NULL,
	[Description] [nvarchar](1000) NULL,
	[InternalNote] [nvarchar](1000) NULL,
	[AccountI3D] [int] NULL,
	[CustomerI3D] [int] NULL,
	[StatusI3D] [int] NULL,
	[ConnectionNumber] [int] NOT NULL,
	[StatusCaption] [nvarchar](300) NULL,
	[PriorityI3D] [int] NULL,
	[PriorityCaption] [nvarchar](300) NULL,
	[TypeI3D] [int] NULL,
	[TypeCaption] [nvarchar](50) NULL,
	[VariableFlag] [int] NULL,
	[DueTo] [datetime2](2) NULL,
	[PeriodFrom] [datetime2](2) NULL,
	[PeriodTo] [datetime2](2) NULL,
	[LockUserI3D] [int] NULL,
	[LockUserShortSign] [nvarchar](50) NULL,
	[CustomerName] [nvarchar](240) NULL,
	[CustomerStreet] [nvarchar](200) NULL,
	[CustomerZip] [nvarchar](10) NULL,
	[CustomerCity] [nvarchar](50) NULL,
	[AddressI3D] [int] NULL,
	[AddressContactI3D] [int] NULL,
	[AddressContactTitle] [nvarchar](50) NULL,
	[AddressContactName] [nvarchar](255) NULL,
	[AddressContactTelephoneNumber] [nvarchar](50) NULL,
	[AddressContactEmail] [nvarchar](255) NULL,
	[CreatedFromObjectI3D] [int] NULL,
	[CreatedFromObjectKind] [int] NULL,
	[ResponsiblePersonI3D] [int] NULL,
	[ChangedDate] [datetime2](2) NULL,
	[ResponsiblePersonFirstName] [nvarchar](60) NULL,
	[ResponsiblePersonLastName] [nvarchar](60) NULL,
	[ResponsiblePersonShortSign] [nvarchar](50) NULL,
	[ResponsiblePersonFullName] [nvarchar](175) NULL,
	[ResponsiblePersonEMail] [nvarchar](255) NULL,
	[CreatedByI3D] [int] NULL,
	[CreatedByFirstName] [nvarchar](60) NULL,
	[CreatedByLastName] [nvarchar](60) NULL,
	[CreatedByShortSign] [nvarchar](50) NULL,
	[CreatedByFullName] [nvarchar](175) NULL,
	[CreatedByEMail] [nvarchar](255) NULL,
	[CreatedDate] [datetime2](2) NULL,
	[PlannedDurationInHours] [float] NULL,
	[ContractI3D] [int] NULL,
	[MainCategoryI3D] [int] NULL,
	[MainCategoryCaption] [nvarchar](50) NULL,
	[SubCategory1I3D] [int] NULL,
	[SubCategory1Caption] [nvarchar](50) NULL,
	[SubCategory2I3D] [int] NULL,
	[SubCategory2Caption] [nvarchar](50) NULL,
	[SolutionI3D] [int] NULL,
	[HasCalculableTimes] [bit] NOT NULL,
	[CalculableTimesInSeconds] [int] NOT NULL,
	[NotCalculableTimesInSeconds] [int] NOT NULL,
	[PlannedTimesInSeconds] [int] NOT NULL,
	[CalculableNotPlannedTimesInSeconds] [int] NOT NULL,
	[NotCalculableNotPlannedTimesInSeconds] [int] NOT NULL,
	[LastTicketAction] [nvarchar](500) NULL,
	[IsRMACase] [bit] NOT NULL,
	[RmaNumber] [int] NULL,
	[IsTicketRefused] [bit] NULL,
	[ClosedDate] [datetime2](2) NULL,
	[SalesAreaI3D] [int] NULL,
	[IsOnlyInternalVisible] [bit] NOT NULL,
	[IsSLA] [bit] NOT NULL,
	[TimerCount] [int] NOT NULL,
	[CalculableTimersCount] [int] NOT NULL,
	[ContractName] [nvarchar](256) NULL,
	[AdditionalText2] [nvarchar](100) NULL,
	[Version] [nvarchar](100) NULL,
	[FirstTimerDate] [datetime2](2) NULL,
	[LastTimerDate] [datetime2](2) NULL,
	[Matchcode] [nvarchar](30) NULL,
	[NotBilledCalculableNotPlannedTimesInSeconds] [int] NOT NULL,
	[BilledCalculableNotPlannedTimesInSeconds] [int] NOT NULL,
	[BranchI3D] [int] NULL,
	[BranchName] [nvarchar](255) NULL,
	[ContractNumber] [int] NULL,
	[ContractTypeCaption] [nvarchar](300) NULL,
	[HistoryCount] [int] NOT NULL,
	[CreatedFromTicketPatternI3D] [int] NULL,
	[ProjectNumber] [nvarchar](50) NULL,
	[ParentHelpdeskI3D] [int] NULL,
	[Adviser1] [nvarchar](50) NULL,
	[Adviser2] [nvarchar](50) NULL,
	[Adviser3] [nvarchar](50) NULL,
	[Adviser4] [nvarchar](50) NULL,
	[ArticleWorkItemI3D] [int] NULL,
	[ArticleWorkItemCaption] [nvarchar](1000) NULL,
	[EscalationLevel] [int] NULL,
	[LastCommentDate] [datetime2](2) NULL,
	[LastEmailDate] [datetime2](2) NULL,
	[AccountOrderProcessingContractState] [tinyint] NULL,
	[Editors] [nvarchar](4000) NULL,
	[EditorI3Ds] [nvarchar](4000) NULL,
	[IsClosed] [bit] NOT NULL,
 CONSTRAINT [PK_CacheTicketStatistic] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_Tickets]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_Tickets]
AS
SELECT hr.I3D
	,hr.Nummer AS Number
	,hr.Beschreibung AS ShortDescription
	,hr.ErstelltAus AS CreatedFrom
	,CASE WHEN LEN(Problem) > 750 THEN SUBSTRING(Problem, 1, 746) + ' […]' ELSE Problem END AS Description
	,CASE WHEN LEN(hr.InternalNote) > 750 THEN SUBSTRING(hr.InternalNote,1,746) + ' […]' ELSE hr.InternalNote END AS InternalNote
	,CASE 
		WHEN hr.KundeI3D <= 0
			THEN NULL
		ELSE hr.KundeI3D
		END AS CustomerI3D
	,hs.I3D AS StatusI3D
	,ISNULL(hr.Verknuepfungsnummer,0) AS ConnectionNumber
	,hs.Bezeichnung AS StatusCaption
	,hp.I3D AS PriorityI3D
	,hp.Bezeichnung AS PriorityCaption
	,ht.I3D AS TypeI3D
	,ht.Bezeichnung AS TypeCaption
	,hr.Kennzeichen AS VariableFlag
	,CASE WHEN YEAR(ISNULL(hr.FaelligAm,0)) < 1910 THEN NULL ELSE hr.FaelligAm END AS DueTo
	,CASE WHEN YEAR(ISNULL(hr.BearbeitungszeitraumStart,0)) < 1910 THEN NULL ELSE hr.BearbeitungszeitraumStart END AS PeriodFrom
	,CASE WHEN YEAR(ISNULL(hr.BearbeitungszeitraumEnde,0)) < 1910 THEN NULL ELSE hr.BearbeitungszeitraumEnde END AS PeriodTo
	,CASE 
		WHEN hr.LockUserI3D <= 0
			THEN NULL
		ELSE hr.LockUserI3D
		END AS LockUserI3D
	,hr.LockUser AS LockUserShortSign
	,ISNULL(k.Name,hr.KundeName) AS CustomerName
	,hr.KundeStrasse AS CustomerStreet
	,hr.KundePLZ AS CustomerZip
	,hr.KundeOrt AS CustomerCity
	,CASE 
		WHEN hr.AnschriftI3D <= 0
			THEN NULL
		ELSE hr.AnschriftI3D
		END AS AddressI3D
	,CASE 
		WHEN hr.AnsprechpartnerI3D <= 0
			THEN NULL
		ELSE hr.AnsprechpartnerI3D
		END AS AddressContactI3D
	,hr.AnsprechAnrede AS AddressContactTitle
	,hr.AnsprechName AS AddressContactName
	,hr.AnsprechTelefon AS AddressContactTelephoneNumber
	,hr.AnsprechEMail AS AddressContactEmail
	,CASE 
		WHEN hr.CreatedFromObjectI3D <= 0
			THEN NULL
		ELSE hr.CreatedFromObjectI3D
		END AS CreatedFromObjectI3D
	,hr.CreatedFromObjectKind
	,CASE 
		WHEN hr.VerantwortlicherI3D <= 0
			THEN NULL
		ELSE hr.VerantwortlicherI3D
		END AS ResponsiblePersonI3D
    , hr.GeaendertDatum AS ChangedDate
	,p.Vorname AS ResponsiblePersonFirstName
	,p.Name AS ResponsiblePersonLastName
	,p.KurzZeich AS ResponsiblePersonShortSign
	,CASE WHEN p.I3D IS NULL THEN NULL ELSE ISNULL(p.Name,'') + ', ' + ISNULL(p.Vorname,'') + ' (' + ISNULL(p.KurzZeich,'') + ')' END AS ResponsiblePersonFullName
	,p.EMail AS ResponsiblePersonEMail
	,pc.I3D AS CreatedByI3D
	,pc.Vorname AS CreatedByFirstName
	,pc.NAME AS CreatedByLastName
	,pc.KurzZeich AS CreatedByShortSign
	,CASE WHEN pc.I3D IS NULL THEN NULL ELSE ISNULL(pc.Name,'') + ', ' + ISNULL(pc.Vorname,'') + ' (' + ISNULL(pc.KurzZeich,'') + ')' END AS CreatedByFullName
	,pc.EMail AS CreatedByEMail
	,hr.ErfasstAm AS CreatedDate
	,hr.GeplanteDauerInStd AS PlannedDurationInHours
	,CASE 
		WHEN hr.VertragI3D <= 0
			THEN NULL
		ELSE hr.VertragI3D
		END AS ContractI3D
	,hk1.I3D AS MainCategoryI3D
	,hk1.Bezeichnung AS MainCategoryCaption
	,hk2.I3D AS SubCategory1I3D
	,hk2.Bezeichnung AS SubCategory1Caption
	,hk3.I3D AS SubCategory2I3D
	,hk3.Bezeichnung AS SubCategory2Caption
	,CASE 
		WHEN hr.hlpdsk_loesungI3D <= 0
			THEN NULL
		ELSE hr.hlpdsk_loesungI3D
		END AS SolutionI3D
	,cacheTickets.HasCalculableTimes
	,cacheTickets.CalculableTimesInSeconds
	,cacheTickets.NotCalculableTimesInSeconds
	,cacheTickets.PlannedTimesInSeconds
	,cacheTickets.CalculableNotPlannedTimesInSeconds
	,cacheTickets.NotCalculableNotPlannedTimesInSeconds
	,cacheTickets.LastTicketAction
	,SIGN(IsNull(R.Number,0)) AS IsRMACase
	,R.Number RmaNumber
	,hr.IsTicketRefused
	,CASE WHEN ISNULL(hr.AbgeschlossenAm,0) < 10 THEN NULL ELSE hr.AbgeschlossenAm END AS ClosedDate
	,IIF(ISNULL(K.VertriebsgebietI3D,0) <= 0,NULL, K.VertriebsgebietI3D) AS SalesAreaI3D
	,hr.IsOnlyInternalVisible
	,CAST(ISNULL(hp.IsSLA,0) AS BIT) AS IsSLA
	,cacheTickets.TimerCount
	,cacheTickets.CalculableTimersCount AS CalcuableTimersCount
	,vertKopf.Name AS ContractName
	,hr.Zusatztext2 AS AdditionalText2
	,hr.Version AS Version
	,cacheTickets.FirstTimerDate
	,cacheTickets.LastTimerDate
	,K.Kurzbezeichnung AS Matchcode
	,cacheTickets.NotBilledCalculableNotPlannedTimesInSeconds
	,cacheTickets.BilledCalculableNotPlannedTimesInSeconds
	,hr.FilialI3D AS BranchI3D
	,fil.FilialName AS BranchName
	,vertKopf.Nummer AS ContractNumber
	,vertArt.Bezeichnung AS ContractTypeCaption
	,cacheTickets.HistoryCount
	,hr.CreatedFromTicketPatternI3D
	,hr.ProjectNumber
	,hr.ParentHelpdeskI3D
	,CASE WHEN ISNULL(hr.KundeInnendienst, '') <> '' THEN hr.KundeInnendienst ELSE adviser1.KurzZeich END AS Adviser1
	,CASE WHEN ISNULL(hr.KundeAussendienst, '') <> '' THEN hr.KundeAussendienst ELSE adviser2.KurzZeich END AS Adviser2
	,CASE WHEN ISNULL(hr.KundeTechniker, '') <> '' THEN hr.KundeTechniker ELSE adviser3.KurzZeich END AS Adviser3
	,CASE WHEN ISNULL(hr.KundeTechniker2, '') <> '' THEN hr.KundeTechniker2 ELSE adviser4.KurzZeich END AS Adviser4
	,hr.ArticleWorkItemI3D
	,awi.Caption AS ArticleWorkItemCaption
	,hr.EscalationLevel
	,hr.LastCommentDate
	,hr.LastEmailDate
	,cacheTickets.AccountOrderProcessingContractState
	,cacheTickets.Editors
	,cacheTickets.EditorI3Ds
FROM dbo.hlpdsk_requests AS hr
LEFT OUTER JOIN CacheTicketStatistic cacheTickets ON cacheTickets.I3D = hr.I3D
INNER JOIN dbo.Kunden K ON K.I3D = hr.KundeI3D
LEFT OUTER JOIN dbo.hlpdsk_status AS hs ON hs.I3D = hr.Status
LEFT OUTER JOIN dbo.hlpdsk_prioritaeten AS hp ON hp.I3D = hr.Prioritaet
LEFT OUTER JOIN dbo.hlpdsk_typen AS ht ON ht.I3D = hr.hlpdsk_typenI3D
LEFT OUTER JOIN dbo.Personal AS p ON p.I3D = hr.VerantwortlicherI3D
LEFT OUTER JOIN dbo.Personal AS pc ON pc.I3D = hr.ErstellerI3D
LEFT OUTER JOIN dbo.Personal AS adviser1 ON adviser1.I3D = K.InnendienstID
LEFT OUTER JOIN dbo.Personal AS adviser2 ON adviser2.I3D = K.AussendienstID
LEFT OUTER JOIN dbo.Personal AS adviser3 ON adviser3.I3D = K.TechnikerID
LEFT OUTER JOIN dbo.Personal AS adviser4 ON adviser4.I3D = K.Techniker2ID
LEFT OUTER JOIN dbo.hlpdsk_kategorien AS hk1 ON hk1.I3D = hr.HauptkategorieI3D
LEFT OUTER JOIN dbo.hlpdsk_kategorien AS hk2 ON hk2.I3D = hr.Unterkategorie1I3D
LEFT OUTER JOIN dbo.hlpdsk_kategorien AS hk3 ON hk3.I3D = hr.Unterkategorie2I3D
LEFT OUTER JOIN RMA R on R.HelpdeskI3D = hr.I3D AND R.IsClosed < 2
LEFT OUTER JOIN dbo.VertragKopf as vertKopf on vertKopf.I3D = hr.VertragI3D
LEFT OUTER JOIN dbo.VertragsArt as vertArt on vertArt.I3D = vertKopf.VertragsArtI3D
LEFT OUTER JOIN dbo.Filiale fil on fil.I3D = hr.FilialI3D
LEFT OUTER JOIN dbo.ArticleWorkItems awi ON awi.I3D = hr.ArticleWorkItemI3D
GO
/****** Object:  View [dbo].[cvw_TodoList]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_TodoList] AS
SELECT 
	I3D = t.I3D,
	RawType = t.Art,
	Number = t.Nummer,
	Date = t.Datum,
	DueDate = t.Termin,
	CustomerI3D = K.I3D,
	Customer = COALESCE(K.Name, Kred.Name, ''),
	Area = CASE 
				WHEN Activity.ActivityKIND = 0 THEN 'Aktivität (Telefonnotiz)'
				WHEN Activity.ActivityKIND = 1 THEN 'Aktivität (Termin)'
				WHEN Activity.ActivityKIND = 2 THEN 'Aktivität (Besuchbericht)'
				WHEN Activity.ActivityKIND = 3 THEN 'Aktivität (Notiz)'
				WHEN Activity.ActivityKind = 7 THEN 'Aktivität (Mail)'
				WHEN Activity.ActivityKind = 19 THEN 'Aktivität (Benachrichtigung)'				
				WHEN Activity.ActivityKind = 20 THEN 'Aktivität (CRM)'
				ELSE t.Bereich END,
	Comment = t.Kommentar,
	EditorI3D = t.BearbeiterI3D,
	Editor = CONCAT(Peditor.Vorname, ' ', Peditor.Name, ' (', Peditor.KurzZeich, ')'),
	ChangedBy = CONCAT(PchangedBy.Vorname, ' ', PchangedBy.Name, ' (', PchangedBy.KurzZeich, ')'),
	ChangedDate = t.BearbeitungsDatum,
	ChangedByI3D = t.BearbeiterI3D,
	ChangedVersion = t.GeaendertVersion,
	CreatedBy = CONCAT(PcreatedBy.Vorname, ' ', PcreatedBy.Name, ' (', PcreatedBy.KurzZeich, ')'),
	CreatedDate = t.ErstellDatum,
	CreatedByI3D = t.ErstellerPersonalI3D,
	CreatedVersion = t.ErstelltVersion,
	ObjectRawType = t.ObjektArt,
	ObjectI3D = t.ObjectI3D,
	IsRead = CONVERT(BIT, ISNULL(t.Gelesen, 0)),
	Discarded = CONVERT(BIT, ISNULL(t.Verworfen, 0)),
	Description = t.Beschreibung,
	AccountI3D = COALESCE(t.AccountI3D, ATTC.AccountI3D, ATTS.AccountI3D),
	AccountName = COALESCE(A.Name, K.NAme, Kred.Name, ''),
	HelpdeskStateI3D = h.StatusI3D,
	ReceiptUserStateI3D = COALESCE(Ang.ReceiptUserStateI3D, Auf.ReceiptUserStateI3D, Lief.ReceiptUserStateI3D, Rech.ReceiptUserStateI3D, Vertrag.ReceiptUserStateI3D),
	ReceiptContactPerson = COALESCE(Ang.Ansprech, Auf.Ansprech, Lief.Ansprech, Rech.Ansprech, Vertrag.Ansprech),
	ReceiptContactEmail = COALESCE(Ang.Mail, Auf.Mail, Lief.Mail, Rech.Mail, Vertrag.Mail),
	ReceiptContactPhoneNumber = COALESCE(Ang.Tel, Auf.Tel, Lief.Tel, Rech.Tel, Vertrag.Tel),
	ReceiptGrossPriceComplete = COALESCE(Ang.Brutto, Auf.Brutto, Lief.Brutto, Rech.Brutto, Vertrag.Brutto),
	ReceiptAdditionalText = COALESCE(Ang.AngUeberschrift, Auf.Zusatztext, Lief.Zusatztext, Rech.Zusatztext, Vertrag.Zusatztext)
FROM dbo.ToDoListe AS t
LEFT OUTER JOIN Kunden K ON K.I3D = t.KundeI3D
LEFT OUTER JOIN Kreditor Kred ON Kred.I3D = t.KundeI3D
LEFT OUTER JOIN Personal Peditor ON Peditor.I3D = T.BearbeiterI3D
LEFT OUTER JOIN Personal PchangedBy ON PchangedBy.I3D = T.GeaendertVonI3D
LEFT OUTER JOIN Personal PcreatedBy ON PcreatedBy.I3D = T.ErstellerPersonalI3D
LEFT OUTER JOIN Accounts A ON A.I3D = t.AccountI3D
LEFT OUTER JOIN AccountCustomers AC ON AC.Number = t.KundeI3D
LEFT OUTER JOIN AccountTypeToAccounts ATTC ON ATTC.AccountCustomerI3D = AC.I3D
LEFT OUTER JOIN AccountSuppliers ASup ON ASup.Number = t.KundeI3D
LEFT OUTER JOIN AccountTypeToAccounts ATTS ON ATTS.AccountSupplierI3D = ASup.I3D
LEFT OUTER JOIN cvw_tickets h ON h.I3D = t.ObjectI3D AND t.Art = 8
LEFT OUTER JOIN AngKopf Ang ON Ang.I3D = t.ObjectI3D AND t.ObjektArt = 1
LEFT OUTER JOIN AufKopf Auf ON Auf.I3D = t.ObjectI3D AND t.ObjektArt = 2
LEFT OUTER JOIN LiefKopf Lief ON Lief.I3D = t.ObjectI3D AND t.ObjektArt = 3
LEFT OUTER JOIN RechKopf Rech ON  Rech.I3D = t.ObjectI3D AND t.ObjektArt = 4
LEFT OUTER Join VertragKopf Vertrag ON Vertrag.I3D = t.ObjectI3D AND t.ObjektArt = 22
LEFT OUTER JOIN AccountActivities Activity ON Activity.I3D = t.ObjectI3D AND t.ObjektArt = 7600072
    
GO
/****** Object:  Table [dbo].[BestKopf2]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BestKopf2](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[AktuelleVersion] [int] NULL,
	[Datum] [datetime] NULL,
	[Lieferdatum] [datetime] NULL,
	[WiedervorlageDatum] [datetime] NULL,
	[WiedervorlageToDoI3D] [int] NULL,
	[Empfanger] [varchar](500) NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[LieferEmpfanger] [varchar](500) NULL,
	[LieferKundenI3D] [int] NULL,
	[LieferAnschriftI3D] [int] NULL,
	[LieferPersonI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[LandI3D] [int] NULL,
	[WaehrungI3D] [int] NULL,
	[Notiz] [text] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[Lockuser] [nvarchar](50) NULL,
	[Status] [int] NULL,
	[Gesperrt] [int] NULL,
	[ZahlKondI3D] [int] NULL,
	[ZahlKondText] [varchar](255) NULL,
	[AuftragBestaetigt] [int] NULL,
	[ABestaetigNr] [varchar](100) NULL,
	[Fracht] [float] NULL,
	[FrachtFreiAb] [float] NULL,
	[Mindestbestellwert] [float] NULL,
	[Mindermengenzuschlag] [float] NULL,
	[BVLGenerated] [int] NULL,
	[Direktlieferung] [int] NULL,
	[SummeNetto] [float] NULL,
	[EOrderFlag] [int] NULL,
	[EOrderDatum] [datetime] NULL,
	[EOrderKreditorNummer] [varchar](20) NULL,
	[EOrderTrackingID] [varchar](60) NULL,
	[EOrderXMLDokument] [text] NULL,
	[EOrderLieferanschrift] [text] NULL,
	[EOrderABPruefstatus] [int] NULL,
	[EOrderAusgeblendet] [int] NULL,
	[EOrderAusgeblendetHinweis] [varchar](150) NULL,
	[EOrderABDatenUebernommen] [int] NULL,
	[DocDirI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[MwStAusweisen] [int] NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[EOrderInterface] [int] NULL,
	[LieferEmpfaengerInfo] [varchar](500) NULL,
	[GlobalerRabatt] [float] NULL,
	[BestellungGrundI3D] [int] NULL,
	[BestellungGrundText] [varchar](500) NULL,
	[LieferbedingungI3D] [int] NULL,
	[LieferbedingungText] [varchar](255) NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[RabattVKBasis] [int] NULL,
	[VarFeld1] [varchar](40) NULL,
	[Bestellt] [int] NULL,
	[RACcode] [varchar](50) NULL,
	[LizenzBemerkung] [varchar](255) NULL,
	[isLizenz] [int] NULL,
	[isMietPortal] [int] NULL,
	[BranchI3D] [int] NULL,
	[BranchOrigin] [int] NULL,
	[Street] [nvarchar](50) NULL,
	[HasPostOfficeBox] [int] NULL,
	[PostOfficeBox] [nvarchar](50) NULL,
	[Zip] [nvarchar](50) NULL,
	[City] [nvarchar](50) NULL,
	[ContactName] [nvarchar](128) NULL,
	[ChangedThroughApplication] [int] NULL,
	[ConcurrencyControlGuid] [uniqueidentifier] NULL,
	[KdNrBeiLieferant] [varchar](20) NULL,
	[BranchNumberrange] [bit] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BestPos2]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BestPos2](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BestKopfI3D] [int] NULL,
	[Version] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[Text] [varchar](5000) NULL,
	[Kreditorcode] [varchar](100) NULL,
	[Hersteller] [varchar](100) NULL,
	[Herstellercode] [varchar](100) NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[BlockID] [int] NULL,
	[Stk] [float] NULL,
	[StkGeliefert] [float] NULL,
	[Menge] [float] NULL,
	[Preis] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[MwStSatz] [float] NULL,
	[Kostentraeger] [int] NULL,
	[Kostenstelle] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Art] [int] NULL,
	[Freitext] [varchar](5000) NULL,
	[LieferDatumSoll] [datetime] NULL,
	[LieferDatumIst] [datetime] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[UebernommenAusI3D] [int] NULL,
	[UebernommenAusArt] [int] NULL,
	[UebernommenInI3D] [int] NULL,
	[UebernommenInArt] [int] NULL,
	[Status] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[EKAusAufPosI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[Masseinheit] [int] NULL,
	[Dimension] [int] NULL,
	[GewProEinheit] [float] NULL,
	[MwStI3D] [int] NULL,
	[Beschaffenheit] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[Abbuchung] [varchar](1) NULL,
	[EANCode] [varchar](70) NULL,
	[EOrderPos] [varchar](10) NULL,
	[TestDatum] [datetime] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[StkBenoetigt] [float] NULL,
	[Zulauf] [float] NULL,
	[LieferantenCodeI3D] [int] NULL,
	[BestellnrKunde] [varchar](50) NULL,
	[AuftProj] [varchar](50) NULL,
	[RMAPosI3D] [int] NULL,
	[AbsageGrund] [varchar](500) NULL,
	[RabattArt] [int] NULL,
	[RabattGrundbetrag] [float] NULL,
	[RabattSatz] [float] NULL,
	[RabattBetrag] [float] NULL,
	[RabattTextAnzeigen] [int] NULL,
	[RabattText] [varchar](255) NULL,
	[Bestellinformation] [varchar](200) NULL,
	[EKBasis] [float] NULL,
	[Verpackungsmenge] [float] NULL,
	[AufPosI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ARTIK]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ARTIK](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Artikelcode] [varchar](60) NULL,
	[Sortierkriterium] [smallint] NULL,
	[Kurzbegriff] [varchar](150) NULL,
	[Artikelbeschreibung] [varchar](5000) NULL,
	[VK_1] [float] NULL,
	[VK_2] [float] NULL,
	[VK_3] [float] NULL,
	[VK_4] [float] NULL,
	[EK] [float] NULL,
	[MWStI3D] [int] NULL,
	[Mwst_Satz] [float] NULL,
	[Warengruppe] [smallint] NULL,
	[Barcode_Selector] [smallint] NULL,
	[Kalkulationsfaktor] [float] NULL,
	[Beschreibung_1] [varchar](60) NULL,
	[Beschreibung_2] [varchar](60) NULL,
	[Beschreibung_3] [varchar](60) NULL,
	[Abbuchung] [varchar](1) NULL,
	[Menge] [float] NULL,
	[Mindestbestand] [float] NULL,
	[Zulauf] [float] NULL,
	[Angelegt_am] [datetime] NULL,
	[Angelegt_von] [int] NULL,
	[Geandert_am] [datetime] NULL,
	[Geandert_von] [int] NULL,
	[Usersystem] [varchar](8) NULL,
	[Benutzer] [varchar](8) NULL,
	[Bestandskontrolle] [datetime] NULL,
	[Reparaturmenge] [float] NULL,
	[Defektbestand] [float] NULL,
	[Ausleihe_Bestand] [float] NULL,
	[Produktionsbestand] [float] NULL,
	[Status] [varchar](1) NULL,
	[RohEK1] [float] NULL,
	[RohEK1Datum] [datetime] NULL,
	[RohEk2] [float] NULL,
	[RohEK2Datum] [datetime] NULL,
	[Zusatzinfo1] [varchar](55) NULL,
	[Zusatzinfo2] [varchar](55) NULL,
	[Zusatzinfo3] [varchar](55) NULL,
	[Hersteller] [varchar](100) NULL,
	[InBearbeitung] [float] NULL,
	[VertriebsInfoAnzeigen] [int] NULL,
	[FertigungsInfoAnzeigen] [int] NULL,
	[KreditorI3D] [int] NULL,
	[StatistikText] [int] NULL,
	[TextAenderbar] [int] NULL,
	[EOL] [int] NULL,
	[Farbe] [int] NULL,
	[MailTo] [varchar](80) NULL,
	[Mindestpreis] [float] NULL,
	[EKGleichVK] [int] NULL,
	[WEBArtik] [int] NULL,
	[FolgeArtikel] [varchar](60) NULL,
	[Bild1] [image] NULL,
	[Bild1Ext] [varchar](4) NULL,
	[Bild2] [image] NULL,
	[Bild2Ext] [varchar](4) NULL,
	[Bild3] [image] NULL,
	[Bild3Ext] [varchar](4) NULL,
	[Bild4] [image] NULL,
	[Bild4Ext] [varchar](4) NULL,
	[Bild1Uploaded] [int] NULL,
	[Bild2Uploaded] [int] NULL,
	[Bild3Uploaded] [int] NULL,
	[Bild4Uploaded] [int] NULL,
	[EVK] [float] NULL,
	[WEBKategorie] [int] NULL,
	[VPE] [float] NULL,
	[Lieferbar] [int] NULL,
	[Kommisionieren] [int] NULL,
	[Montieren] [int] NULL,
	[BarcodeScanen] [int] NULL,
	[BarcodeScanenOld] [int] NULL,
	[DocI3D] [int] NULL,
	[Lieferzeit] [int] NULL,
	[Import] [int] NULL,
	[Kundenbestand] [float] NULL,
	[Fremdbestand] [float] NULL,
	[Teilbar] [int] NULL,
	[StkListe] [int] NULL,
	[Reparaturbestand] [float] NULL,
	[ALieferantI3D] [int] NULL,
	[BLieferantI3D] [int] NULL,
	[CLieferantI3D] [int] NULL,
	[LagerortI3D] [int] NULL,
	[LagerplatzI3D] [int] NULL,
	[EinkInfo] [varchar](max) NULL,
	[GespInfo] [varchar](max) NULL,
	[Gesperrt] [int] NULL,
	[Nettogewicht] [float] NULL,
	[Bruttogewicht] [float] NULL,
	[SpezGewicht] [float] NULL,
	[Volumen] [float] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[EKgiltBis] [datetime] NULL,
	[UrsprungsLandI3d] [int] NULL,
	[Warennummer] [varchar](50) NULL,
	[GarantieZeit] [int] NULL,
	[FertigungsInfo] [varchar](max) NULL,
	[VertriebsInfo] [varchar](max) NULL,
	[Fertigungsware] [int] NULL,
	[M_GemKostenProz] [float] NULL,
	[F_GemKosten_IProz] [float] NULL,
	[F_GemKosten_IIProz] [float] NULL,
	[M_GemKosten] [float] NULL,
	[F_GemKosten_I] [float] NULL,
	[ToDoEKI3D] [int] NULL,
	[ToDoBenachI3D] [int] NULL,
	[Nachkommastellen] [int] NULL,
	[Einheit] [int] NULL,
	[ErloesKTO] [int] NULL,
	[AufwandKTO] [int] NULL,
	[QSInfo] [varchar](500) NULL,
	[Beschaffenheit] [int] NULL,
	[GewichtEinheit] [int] NULL,
	[MassEinheit] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[BeschLaenge] [int] NULL,
	[BeschHoehe] [int] NULL,
	[BeschBreite] [int] NULL,
	[BeschBruttoGewicht] [int] NULL,
	[BeschNettoGewicht] [int] NULL,
	[BeschSpezGewicht] [int] NULL,
	[MaxSperre] [int] NULL,
	[MaxLaenge] [float] NULL,
	[MaxBreite] [float] NULL,
	[MaxHoehe] [float] NULL,
	[MaxLaengeE] [int] NULL,
	[MaxBreiteE] [int] NULL,
	[MaxHoeheE] [int] NULL,
	[VorLaenge] [float] NULL,
	[VorBreite] [float] NULL,
	[VorHoehe] [float] NULL,
	[EinLaenge] [float] NULL,
	[EinBreite] [float] NULL,
	[EinHoehe] [float] NULL,
	[EinLaengeE] [int] NULL,
	[EinBreiteE] [int] NULL,
	[EinHoeheE] [int] NULL,
	[LagerLaenge] [float] NULL,
	[LagerBreite] [float] NULL,
	[LagerHoehe] [float] NULL,
	[LagerLaengeE] [int] NULL,
	[LagerBreiteE] [int] NULL,
	[LagerHoeheE] [int] NULL,
	[VerkaufLaenge] [float] NULL,
	[VerkaufBreite] [float] NULL,
	[VerkaufHoehe] [float] NULL,
	[VerkaufLaengeE] [int] NULL,
	[VerkaufBreiteE] [int] NULL,
	[VerkaufHoeheE] [int] NULL,
	[GewEinheit] [int] NULL,
	[MasEinheit] [int] NULL,
	[GewProEinheit] [float] NULL,
	[PreisAnzeige] [int] NULL,
	[Dimension] [int] NULL,
	[MassPro] [int] NULL,
	[GewichtPro] [int] NULL,
	[KTOPriority] [int] NULL,
	[KostenstelleI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[HinweisBei] [int] NULL,
	[Garantie1Wert] [int] NULL,
	[Garantie1Art] [int] NULL,
	[Garantie2Wert] [int] NULL,
	[Garantie2Art] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[SondervereinbarungsPflichtig] [int] NULL,
	[SondervereinbarungsEK] [float] NULL,
	[SondervereinbarungsI3D] [int] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[RohEK1I3D] [int] NULL,
	[RohEK1Art] [int] NULL,
	[RohEK2I3D] [int] NULL,
	[RohEK2Art] [int] NULL,
	[FrachtfuehrerI3D] [int] NULL,
	[FrachtfuehrerLimit] [float] NULL,
	[KlassenI3D] [int] NULL,
	[KlassenI3D1] [int] NULL,
	[KlassenI3D2] [int] NULL,
	[EOLauto] [int] NULL,
	[Preisupdate] [int] NULL,
	[EUErloesKTO] [int] NULL,
	[AuslandErloesKTO] [int] NULL,
	[VarAttributes] [int] NULL,
	[AutoPreisDatum] [datetime] NULL,
	[KeinMischEK] [int] NULL,
	[VKDatum] [datetime] NULL,
	[HinweisText] [varchar](1000) NULL,
	[FremdwaehrungLandI3D] [int] NULL,
	[FremdwaehrungFaktor] [float] NULL,
	[IsArbeitswert] [int] NULL,
	[AWFaktor] [int] NULL,
	[AWRundung] [int] NULL,
	[NichtRabattierbar] [int] NULL,
	[SNStueckliste] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[RMALieferantI3D] [int] NULL,
	[RMAAnschriftI3D] [int] NULL,
	[RMAPersonI3D] [int] NULL,
	[RMAAnschrift] [varchar](500) NULL,
	[RMACustomAnschrift] [int] NULL,
	[VKfix] [int] NULL,
	[ProduktfamilieI3D] [int] NULL,
	[ProjektI3D] [int] NULL,
	[SystemIdentNr] [int] NULL,
	[LizenznehmerEintragen] [int] NULL,
	[LagerStkListe] [int] NULL,
	[WEUeberpruefung] [varchar](500) NULL,
	[ZaehlerArtikel] [int] NULL,
	[TonerArtikel] [int] NULL,
	[TonerArtikelSeiten] [int] NULL,
	[TonerArtikelDeckung] [int] NULL,
	[KeineProduktfamilienPflicht] [int] NULL,
	[Mindestbestellmenge] [float] NULL,
	[EUAufwandKTO] [int] NULL,
	[AuslandAufwandKTO] [int] NULL,
	[StkListeFesteVKs] [int] NULL,
	[ZubehoerArtikAutoEinfuegen] [int] NULL,
	[Carepack] [int] NULL,
	[VK1_ErtragBasis] [int] NULL,
	[VK2_ErtragBasis] [int] NULL,
	[VK3_ErtragBasis] [int] NULL,
	[VK4_ErtragBasis] [int] NULL,
	[AuftragsBestand_alt] [float] NULL,
	[LieferBestand_alt] [float] NULL,
	[isReverseCharge] [bit] NULL,
	[RCAufwandKTO] [int] NULL,
	[RCErloesKTO] [int] NULL,
	[LieferBestand]  AS ([dbo].[cfn_LieferBestand]([I3D],(-1))),
	[IsWithCounter] [bit] NULL,
	[VKDatumDyn]  AS ([dbo].[cfn_LastSaleDate]([I3D])),
	[isMietPortal] [bit] NULL,
	[ProjectOffersText] [nvarchar](max) NULL,
	[CustomsNumber] [nvarchar](200) NULL,
	[IntrastatNumber] [nvarchar](200) NULL,
	[Maintenance] [decimal](19, 7) NULL,
	[MaintenanceKind] [int] NOT NULL,
	[IsServiceArticle] [bit] NULL,
	[CombineAdditionalItemsToPartList] [bit] NULL,
	[AdditionalItemsPartListI3D] [int] NULL,
	[IsContractArticle] [bit] NOT NULL,
	[ContractArticleDurationTime] [int] NOT NULL,
	[ContractArticleDurationKind] [int] NOT NULL,
	[DefaultArticleSearchQuantity] [decimal](19, 7) NOT NULL,
	[NoEarlyPaymentDiscountAllowed] [bit] NULL,
	[HasWorkItems] [bit] NULL,
	[UpdateVKsInPartList] [bit] NOT NULL,
	[MaintenanceArticleI3D] [int] NULL,
	[WebCartAdditionalInfo] [nvarchar](1000) NULL,
	[WebCartDataSheetUrl] [nvarchar](1000) NULL,
	[IsMspArticle] [bit] NULL,
	[AuftragsBestand]  AS ([dbo].[cfn_AuftragsBestand]([I3D],(-1))),
	[IsAIEdited] [bit] NULL,
	[IsObligatoryBooking] [bit] NULL,
	[ParentArticleI3D] [int] NULL,
 CONSTRAINT [PK_ARTIK] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[SupplierOrderItems]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[SupplierOrderItems] AS
SELECT
	I3D = P.I3D,
				
	Kind = P.Art,
	ReceiptI3D = P.BestKopfI3D,
					
	Text = ISNULL(CASE WHEN P.Art IN (1,3,4,5) THEN P.Text ELSE P.Freitext END, ''),
			
	FontStyle = P.FontStyle,
	FontSize = P.FontSize,
	FontName = P.FontName,
	FontColor = P.FontColor,
				
	InternalPosition = P.Pos,
			
	ArticleI3D = P.ArtikelI3D,
	ArticleCode = P.Artikelcode,
	EANCode = P.EANCode,
	ManufacturerCode = P.Herstellercode,
	Manufacturer = P.Hersteller,
	SupplierManufacturerCode = P.Kreditorcode,
	ChangeStock = CASE WHEN P.Art = 1 THEN TRY_CAST(IIF(ISNULL(A.Abbuchung, 'N')='J' OR ISNULL(A.Abbuchung, 'N')='1',1,0) AS bit) 
		ELSE TRY_CAST(IIF(ISNULL(P.Abbuchung, 'N')='J' OR ISNULL(P.Abbuchung, 'N')='1',1,0) AS bit) END,
	ISNULL(P.Indent, 0) AS Indent,
	CASE WHEN P.Expanded IS NULL OR P.Expanded IN (0, 1) THEN P.Expanded ELSE 1 END AS Expanded,
				
	CONVERT(DECIMAL(19,7), ROUND(P.Stk,7)) AS QuantityComplete,
	CONVERT(DECIMAL(19,7), ROUND(P.StkGeliefert,7)) AS QuantityProcessed,
	CONVERT(DECIMAL(19,7), ROUND(P.StkBenoetigt,7)) AS QuantityNeeded,
				
	BasePrice = P.Preis,
	VATI3D = P.MwStI3D,
	VATRate = P.MwStSatz,
				
	SpecialAgreementI3D = P.SondervereinbarungI3D,
	CostCenterI3D = P.Kostenstelle,
	CostObjectI3D = P.Kostentraeger,
	WarehouseI3D = P.NebenlagerI3D,
	WEEE = P.WEEE,
			
	--Anderes
	ExpenseAccount = P.AufwandKTO,
			
	ReceiptOrderItemI3D = p.EKAusAufPosI3D,
	ReceiptOrderI3D = p.AuftragI3D,
	DeliveryDatePlanned = P.LieferDatumSoll,
	DeliveryDate = P.LieferDatumIst,
	PurchaseInformations = P.Bestellinformation,
	PurchaseOrderNumber = P.BestellnrKunde,
	RMAItemI3D = P.RMAPosI3D
FROM dbo.BestPos2 P
INNER JOIN dbo.BestKopf2 h ON h.I3D = p.BestKopfI3D
LEFT OUTER JOIN dbo.ARTIK A ON A.I3D = P.ArtikelI3D
WHERE ISNULL(h.AktuelleVersion,1) = 1
GO
/****** Object:  View [dbo].[SupplierOrders]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[SupplierOrders] AS
SELECT
	I3D = K.I3D,

	Number = K.Nummer,
	Date = K.Datum,
	Version = K.Version,
	State = K.Status,
	EditorI3D = IIF(K.PersonalI3D <= 0, NULL, K.PersonalI3D),
	DirectoryI3D = IIF(K.DocDirI3D <= 0, NULL, K.DocDirI3D),

	BranchI3D = IIF(K.BranchI3D <= 0, NULL, K.BranchI3D),
	BranchOrigin = ISNULL(K.BranchOrigin, 0),

	CurrencyI3D = IIF(ISNULL(K.CurrencyI3D, 0) <= 0, NULL, K.CurrencyI3D),
	CurrencyFactor = ISNULL(K.CurrencyFactor, 1),
	CurrencyString = ISNULL(K.CurrencyString, '€'),
	ExclusiveOfVat = ISNULL(K.MwStAusweisen, 0),

	Receiver = ISNULL(K.Empfanger, ''),
	Phone = ISNULL(K.Tel, ''),
	Fax = ISNULL(K.Fax, ''),
	Email = ISNULL(K.Mail, ''),

	SupplierI3D = IIF(ISNULL(K.KreditorI3D, 0) <= 0, 0, K.KreditorI3D),
	AddressI3D = IIF(K.AnschriftI3D <= 0, NULL, K.AnschriftI3D),
	ContactPersonI3D = IIF(K.PersonI3D <= 0, NULL, K.PersonI3D),
	Street = ISNULL(K.Street, ''),
	HasPostOfficeBox = ISNULL(K.HasPostOfficeBox, 0),
	PostOfficeBox = ISNULL(K.PostOfficeBox, ''),
	Zip = ISNULL(K.Zip, ''),
	City = ISNULL(K.City, ''),
	ContactName = ISNULL(K.ContactName, ''),
	CountryI3D = IIF(ISNULL(K.LandI3D, 0) <= 0, NULL, K.LandI3D),

	CreatedByI3D = IIF(K.ErstelltVonI3D <= 0, NULL, K.ErstelltVonI3D),
	CreatedAt = IIF(YEAR(ISNULL(K.ErstelltDatum,0)) < 1905, NULL, K.ErstelltDatum),
	CreatedThroughApplicationVersion = ISNULL(K.ErstelltVersion, ''),
	ChangedByI3D = IIF(K.GeaendertVonI3D <= 0, NULL, K.GeaendertVonI3D),
	ChangedAt = IIF(YEAR(ISNULL(K.GeaendertDatum,0)) < 1905, NULL, K.GeaendertDatum),
	ChangedThroughApplicationVersion = ISNULL(K.GeaendertVersion, ''),
	ChangedThroughApplication = ISNULL(K.ChangedThroughApplication, 0),

	ConcurrencyControlGuid = K.ConcurrencyControlGuid,

	SupplierPaymentConditionI3D = IIF(K.ZahlKondI3D <= 0, NULL, K.ZahlKondI3D),
	SupplierPaymentConditionText = K.ZahlKondText,

	IsLocked = CAST(ISNULL(K.Gesperrt,0) AS BIT),
	IsOrderConfirmed = CAST(ISNULL(K.AuftragBestaetigt,0) AS BIT),
	OrderConfirmationNumber = K.ABestaetigNr,

	IsDirectDelivery = CAST(ISNULL(K.Direktlieferung,0) AS BIT),
	VariableField1 = K.VarFeld1,

	IsPurchased = CAST(ISNULL(K.Bestellt, 0) AS BIT),

	IsOrderedThroughEdi = CAST(ISNULL(K.EOrderFlag, 0) AS BIT),
	EdiOrderDate = IIF(YEAR(ISNULL(K.EOrderDatum,0)) < 1905, NULL, K.EOrderDatum),
	EdiOrderSupplierNumber = K.EOrderKreditorNummer,
	EdiOrderTrackingID = K.EOrderTrackingID,
	EdiOrderXmlDocument = K.EOrderXMLDokument,
	EdiOrderDeliveryAddress = K.EOrderLieferanschrift,
	EdiOrderOrderConfirmationState = CAST(ISNULL(K.EOrderABPruefstatus,0) AS BIT),
	EdiOrderIsHidden = CAST(ISNULL(K.EOrderAusgeblendet,0) AS BIT),
	EdiOrderHiddenInfo = K.EOrderAusgeblendetHinweis,
	EdiOrderDataSynced = CAST(ISNULL(K.EOrderABDatenUebernommen,0) AS BIT),
	EdiOrderInterface = K.EOrderInterface,

	CreatedThroughBVL = CAST(ISNULL(K.BVLGenerated,0) AS BIT),
	ReceiptReasonI3D = IIF(ISNULL(K.BestellungGrundI3D,0) <= 0, NULL, K.BestellungGrundI3D),
	ReceiptReasonText = K.BestellungGrundText,
	FreightAmount = K.Fracht,
	FreightFreeAfterAmount = K.FrachtFreiAb,
	CustomerNumberAtSupplier = K.KdNrBeiLieferant,
	DeliveryDate = K.Lieferdatum,
	DeliveryConditionI3D = IIF(ISNULL(K.LieferbedingungI3D,0) <= 0, NULL, K.LieferbedingungI3D),
	DeliveryConditionText = K.LieferbedingungText,
	Information = K.Notiz,
	IsLicense = CAST(ISNULL(K.isLizenz,0) AS BIT),
	LicenseInfo = K.LizenzBemerkung,
	IsRentPortal = CAST(ISNULL(K.isMietPortal,0) AS BIT),

	DeliveryAddress = K.LieferEmpfanger,
	DeliveryAddressSupplierI3D = IIF(ISNULL(K.LieferKundenI3D,0) <= 0, NULL, K.LieferKundenI3D),
	DeliveryAddressAddressI3D = IIF(ISNULL(K.LieferAnschriftI3D,0) <= 0, NULL, K.LieferAnschriftI3D),
	DeliveryAddressContactPersonI3D = IIF(ISNULL(K.LieferPersonI3D,0) <= 0, NULL, K.LieferPersonI3D),
	DeliveryAddressInformation = K.LieferEmpfaengerInfo,

	ReminderDate = CASE WHEN YEAR(ISNULL(K.WiedervorlageDatum,0)) < 1905 THEN NULL ELSE K.WiedervorlageDatum END,

	LicenseeAddress = K.LizenznehmerKundEmpfaenger,
	LicenseeAddressCustomerI3D = IIF(ISNULL(K.LizenznehmerKundI3D,0) <= 0, NULL, K.LizenznehmerKundI3D),
	LicenseeAddressAddressI3D = IIF(ISNULL(K.LizenznehmerKundAnschriftI3D,0) <= 0, NULL, K.LizenznehmerKundAnschriftI3D),
	LicenseeAddressContactPersonI3D = IIF(ISNULL(K.LizenznehmerKundPersonI3D,0) <= 0, NULL, K.LizenznehmerKundPersonI3D),
	LicenseeAddressInformation = K.LizenznehmerKundInfo,
	ReceiptReceiverI3D = K.ReceiptReceiverI3D,
	ReceiptReceiverInvoiceI3D = K.ReceiptReceiverInvoiceI3D,
	ReceiptReceiverDeliveryI3D = K.ReceiptReceiverDeliveryI3D,
	ReceiptReceiverLicenseI3D = K.ReceiptReceiverLicenseI3D
FROM dbo.BestKopf2 K
WHERE K.AktuelleVersion = 1
GO
/****** Object:  View [dbo].[ContractContingentInfo]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ContractContingentInfo]
AS
SELECT 
VK.I3D AS ContractI3D, 
VK.KontingentArt AS Kind, 
VK.KontingentWert Value, 
VK.AbwKontingentIntervallDauer As DifferContingentIntervalDuration, 
VK.RestMitnehmen AS RestTake, 
VK.KontingentUeberbuchung AS Overbooking, 
VK.KontingentUnterwarenGr AS ToSecondaryMaterialGroup
,VK.ContingentLimitKind
,VK.ContingentLimitValue
,VK.isContingentLimitBilling
,VK.AutoAbrechnung AS CalculationKind
 from vertragkopf VK
where VK.KontingentVertrag = 1
      
GO
/****** Object:  Table [dbo].[Kostentraeger]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kostentraeger](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [varchar](50) NULL,
	[Beschreibung] [varchar](255) NULL,
	[Status] [int] NULL,
	[NummerAlt] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragPos]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](8000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNr] [int] NULL,
	[GutAbholArt] [int] NULL,
	[GutAbholNr] [int] NULL,
	[numGutAbhol] [float] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[StkStorno] [float] NULL,
	[SummeKalkStorno] [float] NULL,
	[VertragI3DAutoRechnung] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[StkStaffelpreis] [float] NULL,
	[VKKalkStaffelpreis] [float] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[OriginalI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Status] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Artikelpositionsart] [int] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[IsBillingPartList] [int] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[BillingDateFrom] [datetime2](0) NULL,
	[BillingDateTo] [datetime2](0) NULL,
	[MspEvaluationDecision] [int] NULL,
 CONSTRAINT [Pk_VertragPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ApplicationSettings]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ApplicationSettings](
	[I3D] [int] NOT NULL,
	[Description] [nvarchar](1000) NOT NULL,
	[ValueInt] [int] NULL,
	[ValueFloat] [float] NULL,
	[ValueDecimal] [decimal](24, 7) NULL,
	[ValueBool] [bit] NULL,
	[ValueDateTime] [datetime] NULL,
	[ValueText] [nvarchar](4000) NULL,
	[ValueLargeText] [nvarchar](max) NULL,
 CONSTRAINT [PK_ApplicationSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[ContractItems]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 
CREATE VIEW [dbo].[ContractItems] AS
SELECT
	VP.I3D
	,ISNULL(CASE WHEN VP.Art IN (2, 6) THEN VP.Freitext ELSE VP.Text END, '') AS Text
	,VP.Richtext AS RichText
	,VP.ArtikelI3D AS ArticleI3D
	,ISNULL(VP.Pos, 0) AS InternalPosition
	,ISNULL(VP.Indent, 0) AS Indent
	,ISNULL(VP.GrpID,0) AS GroupID
	,ABS(VP.Expanded) AS Expanded	
	,CASE 
		WHEN A.HasWorkItems = 1 THEN 1 -- Article with workitems are always kind article, even when GeraeteKopfI3D is > 0
	 	WHEN ISNULL(ap.ValueInt,0) = 0 and ISNULL(VP.GeraeteKopfI3D, 0) > 0 THEN 7 
		ELSE ISNULL(VP.Art, 0) END AS Kind	
	,ISNULL(VP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN VP.MwstI3d <= 0 THEN NULL ELSE VP.MwstI3d END AS VATI3D
	,ISNULL(VP.VertragKopfI3D, 0) AS ReceiptI3D
	,CONVERT(DECIMAL(19,7), ISNULL(VP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(VP.numGutAbhol, 0)) AS QuantityProcessed
	,VP.ErloesKTO AS RevenueAccount
	,CASE WHEN UPPER(A.Abbuchung) LIKE 'J' THEN 1 ELSE 0 END AS ChangeStock
	,VP.VKBasisWert AS BasePrice
	,VP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), VP.Rabatt) AS Discount
	,CASE WHEN VP.SondervereinbarungI3D <= 0 THEN NULL ELSE VP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(VP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN VP.Kostenstelle <= 0 THEN NULL ELSE VP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN VP.Kostentraeger <= 0 THEN NULL ELSE VP.Kostentraeger END AS CostObjectI3D
	,ISNULL(VP.Visible, 1) AS Visible
	,VP.FontStyle
	,VP.FontSize
	,VP.FontName
	,VP.FontColor
	,VP.EANCode AS EANCode
	,0 AS ShowImage
	,CONVERT(DECIMAL(19,7), ISNULL(VP.UrsprungEK, 0)) AS OriginalPurchasePrice
	,CASE WHEN ISNULL(VP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE VP.NebenlagerI3D END AS WarehouseI3D
	,VP.WEEE AS WEEE 
	,'' AS PurchaseInformations
	,VP.Kundenkostenstelle AS CustomerCostCenter
	,VertragI3D AS ContractI3D
	,VP.BestellNr AS PurchaseOrderNumber
	,ISNULL(VP.IsBillingPartList, 0) AS IsBillingPartList
	,VP.Ursprung AS OriginReceiptItemI3D
	,VP.UrsprungI3D AS OriginReceiptI3D
	,VP.UrsprungArt AS OriginKind
	,CASE WHEN ISNULL(VP.Lieferdatum, 0) < 1905 THEN NULL ELSE VP.Lieferdatum END AS DeliveryDate
	,CASE WHEN ISNULL(VP.Benachrichtigungsdatum, 0) < 1905 THEN NULL ELSE VP.Benachrichtigungsdatum END AS NotificationDate
	,ISNULL(VP.Status, 0) AS State
	,VP.UniqAusgleichsArtikelID AS BalanceID
	,VP.GeraeteKopfI3D MasterDataListI3D
	,VP.Code AS ArticleCode
	,VP.HerstCode AS ManufacturerCode
	,VP.EKGrund AS ReasonForCustomPurchasePrice
	,VP.BillingDateFrom
	,VP.BillingDateTo
	,VP.MspEvaluationDecision
FROM dbo.VertragPos VP
LEFT OUTER JOIN ARTIK A ON A.I3D = vp.ArtikelI3D
LEFT OUTER JOIN ApplicationSettings ap ON ap.I3D = 10328
GO
/****** Object:  Table [dbo].[Kostenstellen]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kostenstellen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KostentraegerI3D] [int] NULL,
	[Nummer] [varchar](50) NULL,
	[Beschreibung] [varchar](255) NULL,
	[Status] [int] NULL,
	[ParentI3D] [int] NULL,
	[Text] [varchar](50) NULL,
	[Name] [varchar](100) NULL,
	[SollDB] [float] NULL,
	[NummerAlt] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_ContractPos]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_ContractPos]
AS
SELECT CI.I3D
	,CI.Text
	,CI.RichText
	,CI.ArticleI3D
	,CI.InternalPosition
	,CI.Indent
	,CI.GroupID
	,CI.Expanded
	,CI.Kind
	,CI.ArticlePositionKind
	,CI.VATI3D
	,CI.ReceiptI3D
	,CI.QuantityComplete AS Quantity
	,CI.QuantityComplete As QuantityComplete
    ,CI.QuantityProcessed AS QuantityProcessed
    ,CI.DeliveryDate
    ,CI.NotificationDate
    ,CI.RevenueAccount
    ,CI.ChangeStock
	,VP.VKBasisWert AS BasePrice
	,CI.PurchaseBasePrice
	,CI.Discount
	,CI.SpecialAgreementI3D
	,CI.VATRate
	,CI.CostCenterI3D
	,KS.Nummer AS CostCenterNummer
	,KS.Beschreibung AS CostCenterDescription
	,CI.CostObjectI3D
	,KT.Nummer AS CostObjectNummer
	,KT.Beschreibung AS CostObjectDescription
	,CI.Visible
	,CI.FontStyle
	,CI.FontSize
	,CI.FontName
	,CI.FontColor
	,CI.ArticleCode
	,CI.EANCode
	,CI.ManufacturerCode
	,CI.ShowImage
	,CI.OriginalPurchasePrice
	,CI.ReasonForCustomPurchasePrice
	,CI.WarehouseI3D
    ,CI.WEEE AS WEEE	
	,VP.CalculatedNetPrice         AS NetPrice
	,VP.CalculatedTaxPrice         AS TaxPrice
	,VP.CalculatedNetPriceFC       AS NetPriceFC
	,VP.CalculatedTaxPriceFC       AS TaxPriceFC
	,VP.CalculatedNetPriceTotal    AS NetPriceTotal
	,VP.CalculatedTaxPriceTotal    AS TaxPriceTotal
	,VP.CalculatedNetPriceTotal    AS NetPriceTotalComplete
	,VP.CalculatedTaxPriceTotal    AS TaxPriceTotalComplete
	,VP.CalculatedNetPriceTotalFC  AS NetPriceTotalFC
	,VP.CalculatedTaxPriceTotalFC  AS TaxPriceTotalFC
	,VP.CalculatedNetPriceTotalFC  AS NetPriceTotalFCComplete
	,VP.CalculatedTaxPriceTotalFC  AS TaxPriceTotalFCComplete
	,VP.CalculatedNetPurchasePrice AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,VP.CalculatedNetPurchasePriceFC AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,VP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotal
	,VP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotalComplete
	,NULL AS TaxPurchasePriceTotal
	,VP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFC
	,VP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFCComplete
	,VP.GeraeteKopfI3D AS MasterDataListI3D
	,NULL AS TaxPurchasePriceTotalFC
	,CI.ReceiptI3D AS ContractHeadI3D
	,CI.ReceiptI3D AS HeadI3D
	,CI.ContractI3D
	,CI.BillingDateFrom
	,CI.BillingDateTo
	,CI.MspEvaluationDecision
FROM [dbo].[ContractItems] CI
INNER JOIN VertragPos VP ON VP.I3D = CI.I3D
LEFT OUTER JOIN Kostenstellen KS ON KS.I3D = CI.CostCenterI3D
LEFT OUTER JOIN Kostentraeger KT ON KT.I3D = CI.CostObjectI3D
GO
/****** Object:  View [dbo].[cvw_ContractHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ContractHeadVATPriceSplit]
AS
SELECT 
	ContractHeadI3D,
	HeadI3D,
	VATI3D,
	VATRate,
	SUM(NetPriceTotal) AS NetPriceTotal,
	CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal,
	SUM(NetPriceTotalComplete) AS NetPriceTotalComplete,
	CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete,
	SUM(NetPriceTotalFC) AS NetPriceTotalFC,
	CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC,
	SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete,
	CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete,
	SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal,
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal,
	SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete,
	SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC,
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC,
	SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
FROM dbo.cvw_ContractPos
WHERE 
	Kind IN (1, 3)
	AND ISNULL(ArticlePositionKind, 0) IN (0, 50)
	AND Expanded IS NULL
GROUP BY
	ContractHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
      
GO
/****** Object:  Table [dbo].[AssetManagementDevices]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDevices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ParentI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[ShortName] [nvarchar](256) NULL,
	[LongName] [nvarchar](256) NULL,
	[DeviceId] [nvarchar](256) NULL,
	[WarrantyExpiryDate] [datetime] NULL,
	[CreatedOn] [datetime] NULL,
	[DocumentationCategoryI3D] [int] NULL,
	[Deleted] [bit] NOT NULL,
	[DeviceClass] [nvarchar](256) NULL,
	[Uri] [nvarchar](500) NULL,
	[IsOnline] [bit] NULL,
	[LastUpdate] [datetime] NULL,
	[Status] [int] NULL,
	[SystemCrawlerNeedToInstall] [bit] NULL,
	[IsSystemCralwerInstalled] [bit] NULL,
	[SystemCrawlerVersion] [nvarchar](20) NULL,
	[VendorName] [nvarchar](500) NULL,
	[SerialNumber] [nvarchar](60) NULL,
	[SystemSKU] [nvarchar](60) NULL,
	[SystemProductName] [nvarchar](256) NULL,
	[SystemCrawlerInstalledDate] [datetime] NULL,
	[SystemCrawlerUpdatedDate] [datetime] NULL,
	[LastActionDate] [datetime] NULL,
	[SystemCrawlerStatus] [int] NULL,
	[Model] [nvarchar](512) NULL,
	[UserName] [nvarchar](256) NULL,
	[TotalPhysicalMemory] [bigint] NULL,
	[ThermalState] [int] NULL,
	[SystemType] [nvarchar](256) NULL,
	[SystemSKUNumber] [nvarchar](256) NULL,
	[PowerSupplyState] [int] NULL,
	[PowerState] [int] NULL,
	[Domain] [nvarchar](256) NULL,
	[DNSHostName] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[AdminPasswordStatus] [int] NULL,
	[SystemCrawlerNeedToUnInstall] [bit] NOT NULL,
	[IsSystemCrawlerRestart] [bit] NOT NULL,
	[SystemCrawlerRestartLog] [nvarchar](max) NULL,
	[IsDeviceRestart] [bit] NOT NULL,
	[DeviceUptime] [datetime2](7) NULL,
	[IsDownloadLogs] [bit] NOT NULL,
	[IsScheduleDeviceRestart] [bit] NULL,
	[DeviceRestartDateTime] [date] NULL,
	[Manufacturer] [nvarchar](255) NULL,
	[RiverviewerClientId] [nvarchar](100) NULL,
	[ServiceWorkStatus] [int] NOT NULL,
	[IsSystemCrawlerReinstall] [bit] NOT NULL,
	[IsSystemCrawlerInstallingTimestamp] [datetime] NULL,
	[IsSystemCrawlerUnInstallingTimestamp] [datetime] NULL,
	[DeviceGuid] [uniqueidentifier] NULL,
	[HasTpmModule] [bit] NULL,
	[IsSystemCrawlerInstalling] [bit] NULL,
	[IsSystemCrawlerUnInstalling] [bit] NULL,
	[BitlockerPassword] [nvarchar](256) NULL,
	[BitlockerEncryption] [int] NULL,
	[CustomerSiteI3D] [int] NULL,
	[ExecuteChecksImmediately] [bit] NOT NULL,
	[PublicIpAddress] [nvarchar](80) NULL,
	[TpmVersion] [nvarchar](10) NULL,
	[TeamviewerClientId] [nvarchar](64) NULL,
	[RebootPending] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPatch]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPatch](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Title] [nvarchar](512) NULL,
	[InstallationResult] [nvarchar](256) NULL,
	[Category] [nvarchar](max) NULL,
	[InstalledDate] [datetime] NULL,
	[NeedToInstall] [bit] NOT NULL,
	[InstallMessage] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementPatchOverview]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementPatchOverview]
        AS
        SELECT        K.I3D AS CustomerI3D, K.Name AS CustomerName, Dev.ShortName AS DeviceName, P.I3D, P.DeviceI3D, P.Title, P.InstallationResult, P.Category, P.InstalledDate, P.NeedToInstall, P.InstallMessage
        FROM            dbo.AssetManagementPatch AS P LEFT OUTER JOIN
                                 dbo.AssetManagementDevices AS Dev ON P.DeviceI3D = Dev.I3D LEFT OUTER JOIN
                                 dbo.Kunden AS K ON Dev.KundenI3D = K.I3D
        WHERE        (P.InstallationResult = 'Not Installed')
      
GO
/****** Object:  Table [dbo].[VertragRechKopfZuordnung]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragRechKopfZuordnung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragI3D] [int] NULL,
	[RechKopfI3D] [int] NULL,
	[VertragNr] [int] NULL,
	[RechnungNr] [int] NULL,
	[BerechnungszeitraumVon] [datetime] NULL,
	[BerechnungszeitraumBis] [datetime] NULL,
	[Status] [int] NULL,
	[KontingentWert] [float] NULL,
	[KontingentUeberbuchung] [int] NULL,
	[KontingentRestMitnehmen] [int] NULL,
	[Zwischenrechnung] [int] NULL,
	[AnlageArt] [int] NULL,
	[NachBerechnung] [int] NULL,
	[ZwischenBetrag] [float] NULL,
	[KontingentRestWert] [float] NULL,
	[GebuchtVon] [datetime] NULL,
	[GebuchtBis] [datetime] NULL,
	[SammelRechnung] [int] NULL,
	[KontingentArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[ContractContingentBooked]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 CREATE View [dbo].[ContractContingentBooked] AS 
  SELECT   
VZ.I3D, 
VZ.VertragI3D AS ContractI3D, 
VZ.RechkopfI3D AS InvoiceI3D, 
VZ.Status As State, 
VZ.KontingentWert AS ContingentValue, 
VZ.KontingentRestMitnehmen AS RestTake, 
CASE WHEN IsNull(VZ.KontingentRestMitnehmen,0) = 0 OR VZ.Zwischenrechnung in (1,4)  THEN 0 ELSE [dbo].[cfn_RestValue](VZ.VertragI3D, VZ.GebuchtVon) END  AS RestValue, 
VZ.KontingentUeberbuchung AS Overbooking, 
VZ.Zwischenrechnung AS InterimInvoiceKind, 
VZ.ZwischenBetrag AS InterimContingentValue, 
VZ.GebuchtVon AS BookedFrom, 
VZ.GebuchtBis AS BookedTo, 
VZ.NachBerechnung AS AddContingent, 
VZ.AnlageArt As BelegKind, 
VZ.KontingentArt AS ContingentKind 
FROM VertragRechKopfZuordnung VZ  
INNER JOIN VertragKopf VK ON VK.I3D = VZ.VertragI3D 
WHERE VK.KontingentVertrag = 1 
       AND VZ.KontingentWert <> 0  
       AND ISNULL(VZ.Zwischenrechnung,0) < 4 
       AND VZ.Status > 0
GO
/****** Object:  View [dbo].[Contracts]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[Contracts] AS
 SELECT A.I3D
	,A.Nummer AS Number
    ,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfaenger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
	,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
	,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondI3D <= 0 THEN NULL ELSE A.ZahlKondI3D END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentConditionText
	,CASE WHEN A.LieferbedingungI3D <= 0 THEN NULL ELSE A.LieferbedingungI3D END AS DeliveryConditionI3D
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,LTRIM(A.LiefKundInfo) AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,ISNULL(A.Teillieferung, 0) AS IsPartialDeliveryPossible
	,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
	,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
	,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
	,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
	,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
	,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.SepaMandateI3D AS MandatI3D
 	,A.GUI3D AS ConcurrencyControlGuid
	,A.VertragsArtI3D AS ContractKindI3D
	,A.AbrechnungIntervallDauer AS BillingIntervalDuration
	,A.AbrechnungIntervallArt AS BillingIntervalKind
	,A.AbwAbrechnungIntervallArt AS CounterIntervalKind
	,A.AbwAbrechnungIntervallDauer AS CounterIntervalDuration
	,ISNULL(A.ClickBerechnungsart,0) AS CounterBillingKind
	,A.Sammelrechnung AS CollectInvoice
	,A.AbrechnungBeginn AS FirstPaidDate
	,CASE WHEN A.Ende > 10 THEN A.Ende ELSE NULL END AS ContractEnd
	,CASE WHEN A.KuendigungsDatum > 10 THEN A.KuendigungsDatum ELSE NULL END AS ContractTermination
	,A.AutoAbrechnung AS AutomatedBilling
	,A.AutoAbrechnung AS CalculationKind
	,A.AutoVerlaengerung AS AutomatedProlongation
	,A.CalcNeedKind AS CalcNeedKind
	,ABS(A.Berechnungsart) AS BillingKind
	,ISNULL(A.Versandart, 0) AS SendKind
	,A.RechnungNormieren AS IsNormalize
	,ISNULL(A.VollerBetragBeiNormierung, 0) AS IsFullNormalizeAmount
	,A.Fremdvertrag AS ForeignContract
	,A.FremdvertragText AS ForeignContractText
	,A.ReferenzNr AS ReferenceNumber
	,A.Mail AS MailRecipient
	,CASE WHEN ISNULL(A.AbwAnsprechI3D, 0) <= 0 THEN NULL ELSE A.AbwAnsprechI3D END AS AlternativeMailRecipientI3D
	,A.Versandmail AS AlternativeMailCCRecipients
	,A.Beginn AS ContractBegin
	,A.RestMitnehmen AS TakeRest
	,A.KontingentUeberbuchung AS Overbooking
	,ISNULL(A.KontingentArt, 0) AS ContingentKind
	,CASE
     WHEN  A.Stammblattbezogen = 1 AND  A.KontingentVertrag = 1 THEN 3
     WHEN  A.Stammblattbezogen = 1 AND  A.KontingentVertrag = 0  THEN 1
     WHEN  A.Stammblattbezogen = 0 AND  A.KontingentVertrag = 1  THEN 2
	 ELSE 0 END AS ExtraKind
	,A.Name AS Name
	,A.VertragsRechToDoVorlauf AS ContractBillingToDoOffset 
	,A.Verlaengerung As Prolongation
	,A.KuendigungsFristArt1 AS TerminationDeadlineKind1  
	,A.KuendigungsFristArt2 AS TerminationDeadlineKind2  
	,A.KuendigungsFristDauer1 AS TerminationDeadlineDuration1 
	,A.KuendigungsFristDauer2 AS TerminationDeadlineDuration2 
	,A.Abrede AS Agreement
	,A.Anrede AS Salutation
	,A.Kuendigungsart AS TerminationKind
	,ISNULL(A.KuendigungsGrund, '') AS TerminationReason
	,A.Laufzeit AS Duration
	,A.LetzteRechnungDatum AS LastInvoiceDate
	,A.LieferantenI3D AS SupplierI3D
	,A.LaufzeitArt AS DurationKind
	,ISNULL(A.LaufzeitDauer, 0) AS DurationTIme
	,A.WartungIntervallArt AS MaintenanceIntervalKind
	,A.WartungIntervallArt2 AS MaintenanceIntervalKind2
	,ISNULL(A.WartungIntervallDauer, 0) AS MaintenanceDuration
	,ISNULL(A.WartungIntervallDauer2, 0) AS MaintenanceDuration2
	,ISNULL(A.SNPflicht, 0) AS IsSerialNumberRequiered
	,CASE WHEN A.RechKopfI3D <= 0 THEN NULL ELSE A.RechKopfI3D END AS InvoiceHeadI3D
	,CASE WHEN A.Wartung1ToDoI3D <= 0 THEN NULL ELSE A.Wartung1ToDoI3D END AS Maintenance1ToDoI3D
	,CASE WHEN A.Wartung2ToDoI3D <= 0 THEN NULL ELSE A.Wartung2ToDoI3D END AS Maintenance2ToDoI3D
	,ISNULL(A.LieferantName, '') AS SupplierName
	,ISNULL(A.LieferantAnsprech, '') AS SupplierContactPerson
	,ISNULL(A.LieferantTelefon, '') AS SupplierPhone
	,ISNULL(A.LieferantFax, '') AS SupplierFax
	,ISNULL(A.LieferantEMail, '') AS SupplierMail
	,ISNULL(A.LieferantVertragsNr, '') AS SupplierContractNumber
	,CASE WHEN A.Wartung1Personal <= 0 THEN NULL ELSE A.Wartung1Personal END AS Maintenance1Personal
	,CASE WHEN A.Wartung2Personal <= 0 THEN NULL ELSE A.Wartung2Personal END AS Maintenance2Personal
	,ISNULL(A.Rahmenvertrag, 0) AS IsBasicContract
	,ISNULL(A.RechEmpfaenger, '') AS InvoiceRecipient
	,A.ReaktionszeitArt1 AS ReactionTimeKind1
	,A.ReaktionszeitArt2 AS ReactionTimeKind2
	,ISNULL(A.ReaktionszeitDauer1, 0) AS ReactionTimeDuration1
	,ISNULL(A.ReaktionszeitDauer2, 0) AS ReactionTimeDuration2
	,ISNULL(A.ErstelltVersion, '') AS CreatedVersion
	,CASE WHEN A.VertragsEndeToDoI3D <= 0 THEN NULL ELSE A.VertragsEndeToDoI3D END AS ContractEndToDoI3D
	,ISNULL(A.VertragsEndeToDoVorlauf, 0) AS ContractEndToDoOffset
	,CASE WHEN A.VertragsRechToDoI3D <= 0 THEN NULL ELSE A.VertragsRechToDoI3D END AS ContractBillingInvoiceToDoI3D
	,ISNULL(A.Direktlieferung, 0) AS IsDirectDeliveryPossible
	,ISNULL(A.Freikopien, 0) AS FreeCopies
	,CONVERT(DECIMAL(19,7), ISNULL(A.AnfangsKosten, 0)) AS StartingCosts
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentWert, 0)) AS ContingentValue
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentMindMenge, 0)) AS ContingentMinimalOrderAmount
	,CASE WHEN A.KontingentAusgleichArtikelI3D <= 0 THEN NULL ELSE A.KontingentAusgleichArtikelI3D END AS ContingentBalanceArticleI3D
	,CASE WHEN ISNULL(A.AbwKontingentIntervallDauer, 0) <= 0 THEN 0 ELSE A.AbwKontingentIntervallDauer END AS DeviationgContingentIntervalDuration
	,ISNULL(A.AbwKontingentIntervallArt, 0) AS DeviationContingentIntervallKind
	,ISNULL(A.KontingentAusgleichsArtikelVerwenden, 0) AS UseContingentBalanceArticle
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentVerbrauchtStunden, 0)) AS ContingentUsedHours
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentVerbrauchtBetrag, 0)) AS ContingentUsedAmount
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentAusglVerbrauchtStunden, 0)) AS ContingentBalanceUsedHours
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentAusglVerbrauchtBetrag , 0))AS ContingentBalanceUsedAmount
	,CONVERT(DECIMAL(19,7), ISNULL(A.SummeEKOriginal, 0)) AS OriginalNetPurchasePriceTotalComplete
	,CASE WHEN YEAR(ISNULL(A.LetztesNachberechnungsDatum, 0)) < 1905 THEN NULL ELSE A.LetztesNachberechnungsDatum END AS LastSubsequentBillingDate
	,CASE WHEN YEAR(ISNULL(A.KontingentRestWertStartDatum, 0)) < 1905 THEN NULL ELSE A.KontingentRestWertStartDatum END AS ContingentResidualValueStartDate
	,CASE WHEN YEAR(ISNULL(A.AbschlussDatum, 0)) < 1905 THEN NULL ELSE A.AbschlussDatum END AS FinishDate
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentRestWertStart, 0)) AS ContingentResidualValueStart
	,ISNULL(A.KontingentUnterwarenGr, '') AS ContingentSubmaterialGroups
	,CASE WHEN ISNULL(A.SLAPriorityI3D, 0) <= 0 THEN NULL ELSE A.SLAPriorityI3D END AS SLAPriority
	,ISNULL(A.isContingentLimitBilling, 0) AS IsContingentLimitBilling
	,ISNULL(A.ContingentLimitValue, 0) AS ContingentLimitValue
	,A.ContingentLimitKind AS ContingentLimitKind
	,ISNULL(A.WithStaffelPrice, 0) AS WithStaffelPrice
	,ISNULL(A.IsMonitoring, 0) AS IsMonitoring
	,ISNULL(A.MonitoringValue, 0) AS MonitoringValue
	,A.HourlySurchargeRateI3D
	,A.ReceiptUserStateI3D
	,A.ContingentBillingContractI3D
	,A.IsDisplayedOnWeb
	,A.WebReportI3D
    ,A.DeliveryConditionText AS DeliveryConditionText
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
	,A.IsHiddenInHelpdesk
FROM dbo.VertragKopf AS A
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_CalculateReceiptAmounts]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_CalculateReceiptAmounts]
(	
	@IsArticle bit,
	@CalculatePrices bit,
	@BasePrice float,
	@PurchasePriceBasePrice float,
	@Precision int,
	@Discount float,
	@CurrencyFactor float = 1,
	@DontAssignTax bit = 0,
	@TaxRate float,
	@IsCashReceipt bit,
	@Quantity float,
	@QuantityProcessed float
)
RETURNS TABLE
AS
RETURN 
(
	SELECT 
		NetPrice = CASE WHEN @IsArticle = 0 THEN CAST(NULL AS DECIMAL(24,7)) ELSE ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice, @Precision) * ((100 - @Discount) / 100)), @Precision) END,
		TaxPrice = CASE WHEN @IsArticle = 0 THEN CAST(NULL AS DECIMAL(19,7)) ELSE CONVERT(DECIMAL(19, 7) , CASE WHEN @DontAssignTax = 0 THEN CASE 
			WHEN @IsCashReceipt = 1 THEN
				ROUND(CONVERT(DECIMAL(24,7),(@BasePrice * ((100 - @Discount) / 100)) * (@TaxRate / 100)), 2)
			ELSE
				ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice, @Precision) * ((100 - @Discount) / 100)), @Precision) * (@TaxRate / 100)
			END ELSE 0 END) END,
		NetPriceFC = CASE WHEN @IsArticle = 0 THEN CAST(NULL AS DECIMAL(24,7)) ELSE ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * @CurrencyFactor, @Precision) * ((100 - @Discount) / 100)), @Precision) END,
		TaxPriceFC = CASE WHEN @IsArticle = 0 THEN CAST(NULL AS DECIMAL(19,7)) ELSE CONVERT(DECIMAL(19, 7) , CASE WHEN @DontAssignTax = 0 THEN CASE 
			WHEN @IsCashReceipt = 1 THEN
				ROUND(CONVERT(DECIMAL(24,7),(@BasePrice * @CurrencyFactor * ((100 - @Discount) / 100)) * (@TaxRate / 100)), 2)
			ELSE
				ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * @CurrencyFactor, @Precision) * ((100 - @Discount) / 100)), @Precision) * (@TaxRate / 100)
			END ELSE 0 END) END,
		NetPriceTotal = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,2)) ELSE CONVERT(DECIMAL(19, 2),ROUND( 
			ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice, @Precision) * ((100 - @Discount) / 100)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity - @QuantityProcessed),2)) END,
		TaxPriceTotal = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,4)) ELSE CONVERT(DECIMAL(19,4), CASE WHEN @DontAssignTax = 0 THEN
			CASE WHEN @IsCashReceipt = 1 THEN
				ROUND(CONVERT(DECIMAL(19,4),CASE 
					WHEN @IsCashReceipt = 1 THEN
						ROUND(CONVERT(DECIMAL(24,7),(@BasePrice * ((100 - @Discount) / 100)) * (@TaxRate / 100)), 2)
					ELSE
						ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice, @Precision) * ((100 - @Discount) / 100)), @Precision) * (@TaxRate / 100)
					END * CONVERT(DECIMAL(24,7),@Quantity - @QuantityProcessed)), 2)
			ELSE
				ROUND(CONVERT(DECIMAL(24, 7), 
					ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice, @Precision) * ((100 - @Discount) / 100)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity - @QuantityProcessed)),2) * (@TaxRate / 100)
			END ELSE 0 END) END,
		NetPriceTotalComplete = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,2)) ELSE CONVERT(DECIMAL(19, 2),ROUND( 
			ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice, @Precision) * ((100 - @Discount) / 100)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity),2)) END,
		TaxPriceTotalComplete = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,4)) ELSE CONVERT(DECIMAL(19,4), CASE WHEN @DontAssignTax = 0 THEN
			CASE WHEN @IsCashReceipt = 1 THEN
				ROUND(CONVERT(DECIMAL(19,4),CASE 
					WHEN @IsCashReceipt = 1 THEN
						ROUND(CONVERT(DECIMAL(24,7),(@BasePrice * ((100 - @Discount) / 100)) * (@TaxRate / 100)), 2)
					ELSE
						ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice, @Precision) * ((100 - @Discount) / 100)), @Precision) * (@TaxRate / 100)
					END * CONVERT(DECIMAL(24,7),@Quantity)), 2)
			ELSE
				ROUND(CONVERT(DECIMAL(24, 7), 
					ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice, @Precision) * ((100 - @Discount) / 100)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity)),2) * (@TaxRate / 100)
			END ELSE 0 END) END,
		NetPriceTotalFC = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,2)) ELSE CONVERT(DECIMAL(19, 2),ROUND( 
			ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * @CurrencyFactor, @Precision) * ((100 - @Discount) / 100)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity - @QuantityProcessed),2)) END,
		TaxPriceTotalFC = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,4)) ELSE CONVERT(DECIMAL(19,4), CASE WHEN @DontAssignTax = 0 THEN
			CASE WHEN @IsCashReceipt = 1 THEN
				ROUND(CONVERT(DECIMAL(19,4), CASE 
						WHEN @IsCashReceipt = 1 THEN
							ROUND(CONVERT(DECIMAL(24,7),(@BasePrice * @CurrencyFactor * ((100 - @Discount) / 100)) * (@TaxRate / 100)), 2)
						ELSE
							ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * @CurrencyFactor, @Precision) * ((100 - @Discount) / 100)), @Precision) * (@TaxRate / 100)
						END * CONVERT(DECIMAL(24,7),@Quantity - @QuantityProcessed)), 2)
			ELSE
				ROUND(CONVERT(DECIMAL(24, 7), 
					ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * @CurrencyFactor, @Precision) * ((100 - @Discount) / 100)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity - @QuantityProcessed)),2) * (@TaxRate / 100)
			END ELSE 0 END) END,
		NetPriceTotalFCComplete = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,2)) ELSE CONVERT(DECIMAL(19, 2),ROUND( 
			ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * @CurrencyFactor, @Precision) * ((100 - @Discount) / 100)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity),2)) END,
		TaxPriceTotalFCComplete = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,4)) ELSE CONVERT(DECIMAL(19,4), CASE WHEN @DontAssignTax = 0 THEN
			CASE WHEN @IsCashReceipt = 1 THEN
				ROUND(CONVERT(DECIMAL(19,4), CASE 
						WHEN @IsCashReceipt = 1 THEN
							ROUND(CONVERT(DECIMAL(24,7),(@BasePrice * @CurrencyFactor * ((100 - @Discount) / 100)) * (@TaxRate / 100)), 2)
						ELSE
							ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * @CurrencyFactor, @Precision) * ((100 - @Discount) / 100)), @Precision) * (@TaxRate / 100)
						END * CONVERT(DECIMAL(24,7),@Quantity)), 2)
			ELSE
				ROUND(CONVERT(DECIMAL(24, 7), 
					ROUND(CONVERT(DECIMAL(24, 7), ROUND(@BasePrice * @CurrencyFactor, @Precision) * ((100 - @Discount) / 100)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity)),2) * (@TaxRate / 100)
			END ELSE 0 END) END,
		NetPurchasePrice = CASE WHEN @IsArticle = 0 THEN CAST(NULL AS DECIMAL(24,7)) ELSE ROUND(CONVERT(DECIMAL(24, 7), ROUND(@PurchasePriceBasePrice, @Precision)), @Precision) END,
		TaxPurchasePrice = CONVERT(DECIMAL(19, 7) , NULL),
		NetPurchasePriceFC = CASE WHEN @IsArticle = 0 THEN CAST(NULL AS DECIMAL(24,7)) ELSE ROUND(CONVERT(DECIMAL(24, 7), ROUND(@PurchasePriceBasePrice * @CurrencyFactor, @Precision)), @Precision) END,
		TaxPurchasePriceFC = CONVERT(DECIMAL(19, 7) , NULL),
		NetPurchasePriceTotal = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,2)) ELSE CONVERT(DECIMAL(19, 2),ROUND( 
			ROUND(CONVERT(DECIMAL(24, 7), ROUND(@PurchasePriceBasePrice, @Precision)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity - @QuantityProcessed),2)) END,
		TaxPurchasePriceTotal = CONVERT(DECIMAL(19,4), NULL),
		NetPurchasePriceTotalComplete = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,2)) ELSE CONVERT(DECIMAL(19, 2),ROUND( 
			ROUND(CONVERT(DECIMAL(24, 7), ROUND(@PurchasePriceBasePrice, @Precision)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity),2)) END,
		TaxPurchasePriceTotalComplete = CONVERT(DECIMAL(19,4), NULL),
		NetPurchasePriceTotalFC = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,2)) ELSE CONVERT(DECIMAL(19, 2),ROUND( 
			ROUND(CONVERT(DECIMAL(24, 7), ROUND(@PurchasePriceBasePrice * @CurrencyFactor, @Precision)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity - @QuantityProcessed),2)) END,
		TaxPurchasePriceTotalFC = CONVERT(DECIMAL(19,4), NULL),
		NetPurchasePriceTotalFCComplete = CASE WHEN @IsArticle = 0 OR @CalculatePrices = 0 THEN CAST(NULL AS DECIMAL(19,2)) ELSE CONVERT(DECIMAL(19, 2),ROUND( 
			ROUND(CONVERT(DECIMAL(24, 7), ROUND(@PurchasePriceBasePrice * @CurrencyFactor, @Precision)), @Precision) * CONVERT(DECIMAL(24,7),@Quantity),2)) END,
		TaxPurchasePriceTotalFCComplete = CONVERT(DECIMAL(19,4), NULL))
GO
/****** Object:  View [dbo].[cvw_ContractPosLC]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ContractPosLC] AS
SELECT 
	CI.I3D
	,CI.InternalPosition
	,CI.Indent
	,CI.GroupID
	,CI.Expanded
	,CI.Kind
	,CI.ArticlePositionKind
	,CI.VATI3D
	,CI.ReceiptI3D AS HeadI3D
	,CI.QuantityComplete AS Quantity
	,CI.QuantityComplete As QuantityComplete
    ,CI.QuantityProcessed AS QuantityProcessed
    ,Calc.NetPrice
	,Calc.TaxPrice
	,Calc.NetPriceFC
	,Calc.TaxPriceFC
	,Calc.NetPriceTotal
	,Calc.TaxPriceTotal
	,Calc.NetPriceTotalComplete
	,Calc.TaxPriceTotalComplete
	,Calc.NetPriceTotalFC
	,Calc.TaxPriceTotalFC
	,Calc.NetPriceTotalFCComplete
	,Calc.TaxPriceTotalFCComplete
	,Calc.NetPurchasePrice
	,Calc.NetPurchasePriceFC
	,Calc.NetPurchasePriceTotal
	,Calc.NetPurchasePriceTotalComplete
	,Calc.NetPurchasePriceTotalFC
	,Calc.NetPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(CI.Discount,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN C.ExclusiveOfVAT = 1 THEN 0 ELSE ROUND(ISNULL(CI.VATRate,0),2)END) AS VATRate
FROM [dbo].[ContractItems] CI
INNER JOIN dbo.Contracts C ON C.I3D = CI.ReceiptI3D
LEFT OUTER JOIN dbo.ARTIK A ON A.I3D = CI.ArticleI3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts
(
	CASE WHEN CI.Kind IN (1, 3) THEN 1 ELSE 0 END,
	CASE WHEN CI.Kind IN (1, 3) AND CI.ArticlePositionKind IN (0, 50) THEN 1 ELSE 0 END,
	CI.BasePrice,
	CI.PurchaseBasePrice,
	ISNULL(A.Nachkommastellen, 2),
	ISNULL(CI.Discount, 0),
	C.CurrencyFactor,
	CONVERT(bit, C.ExclusiveOfVAT),
	CI.VATRate,
	C.IsCashAsset,
	CI.QuantityComplete,
	CI.QuantityProcessed
) AS CALC
      
GO
/****** Object:  View [dbo].[cvw_ContractHeadVATPriceSplitLC]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ContractHeadVATPriceSplitLC] AS
SELECT 
	 HeadI3D
	,VATI3D
	,VATRate
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
FROM dbo.cvw_ContractPosLC
WHERE 
	Kind IN (1, 3)
	AND ISNULL(ArticlePositionKind, 0) IN (0, 50)
	AND Expanded IS NULL
GROUP BY
	HeadI3D
	,VATI3D
	,VATRate
      
GO
/****** Object:  Table [dbo].[AnfrKopf]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnfrKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[AktuelleVersion] [int] NULL,
	[Datum] [datetime] NULL,
	[Lieferdatum] [datetime] NULL,
	[WiedervorlageDatum] [datetime] NULL,
	[WiedervorlageToDoI3D] [int] NULL,
	[Empfanger] [varchar](500) NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[LieferEmpfanger] [varchar](500) NULL,
	[LieferKundenI3D] [int] NULL,
	[LieferAnschriftI3D] [int] NULL,
	[LieferPersonI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Notiz] [text] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[LandI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[Lockuser] [nvarchar](50) NULL,
	[Status] [int] NULL,
	[ZahlKondI3D] [int] NULL,
	[ZahlKondText] [varchar](255) NULL,
	[LieferKreditorI3D] [int] NULL,
	[WaehrungI3D] [int] NULL,
	[WaehrungsKursZuEuro] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[Fracht] [float] NULL,
	[FrachtFreiAb] [float] NULL,
	[Mindestbestellwert] [float] NULL,
	[Mindermengenzuschlag] [float] NULL,
	[BVLGenerated] [int] NULL,
	[Direktlieferung] [int] NULL,
	[SummeNetto] [float] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[MwStAusweisen] [int] NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[DocDirI3D] [int] NULL,
	[LieferEmpfaengerInfo] [varchar](500) NULL,
	[LieferbedingungI3D] [int] NULL,
	[LieferbedingungText] [varchar](255) NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[VarFeld1] [varchar](40) NULL,
	[BranchI3D] [int] NULL,
	[BranchOrigin] [int] NULL,
	[Street] [nvarchar](50) NULL,
	[HasPostOfficeBox] [int] NULL,
	[PostOfficeBox] [nvarchar](50) NULL,
	[Zip] [nvarchar](50) NULL,
	[City] [nvarchar](50) NULL,
	[ContactName] [nvarchar](128) NULL,
	[ChangedThroughApplication] [int] NULL,
	[ConcurrencyControlGuid] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnfrPos]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnfrPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnfrKopfI3D] [int] NULL,
	[Version] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[Text] [varchar](5000) NULL,
	[Kreditorcode] [varchar](100) NULL,
	[Hersteller] [varchar](100) NULL,
	[Herstellercode] [varchar](100) NULL,
	[Expanded] [int] NULL,
	[Indent] [int] NULL,
	[Visible] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[BlockID] [int] NULL,
	[Stk] [float] NULL,
	[Menge] [float] NULL,
	[Preis] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[MwStSatz] [float] NULL,
	[Freitext] [varchar](5000) NULL,
	[LieferDatumSoll] [datetime] NULL,
	[LieferDatumIst] [datetime] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[Fontcolor] [int] NULL,
	[UebernommenInI3D] [int] NULL,
	[UebernommenInArt] [int] NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[AufwandKTO] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[EKAusAufPosI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[MassEinheit] [int] NULL,
	[Dimension] [int] NULL,
	[GewProEinheit] [float] NULL,
	[MwStI3D] [int] NULL,
	[Artikeltext] [varchar](1000) NULL,
	[VK_Druck] [float] NULL,
	[PositionArt] [int] NULL,
	[EKAusAufKopfI3D] [int] NULL,
	[Beschaffenheit] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[Abbuchung] [varchar](1) NULL,
	[EANCode] [varchar](70) NULL,
	[UebernommenAusI3D] [int] NULL,
	[UebernommenAusArt] [int] NULL,
	[ErloesKTO] [int] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[StkBenoetigt] [int] NULL,
	[Zulauf] [int] NULL,
	[LieferantenCodeI3D] [int] NULL,
	[BestellnrKunde] [varchar](50) NULL,
	[AuftProj] [varchar](50) NULL,
	[Bestellinformation] [varchar](200) NULL,
	[Verpackungsmenge] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_SupplierOfferPos]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierOfferPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END AS Text
	,NULL AS RichText
	,AP.BestellNrKunde AS PurchaseOrderNumber
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.LieferdatumSoll AS DeliveryDate
	,0 AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,NULL AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,AP.AnfrKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotalComplete AS NetPriceTotal
	, Calc.TaxPriceTotalComplete AS TaxPriceTotal
	, Calc.NetPriceTotalFCComplete AS NetPriceTotalFC
	, Calc.TaxPriceTotalFCComplete AS TaxPriceTotalFC
	,0 AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStAusweisen = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.AnfrPos AS AP
INNER JOIN dbo.AnfrKopf AS A ON AP.AnfrKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Art IN (1,3) THEN 1 ELSE 0 END
	,CASE WHEN AP.Art IN (1,3) AND AP.Expanded IS NULL THEN 1 ELSE 0 END
	,AP.Preis, 0, ISNULL(AR.Nachkommastellen,2), 0, A.CurrencyFactor, CONVERT(bit,ISNULL(A.MwStAusweisen,0)), AP.MwstSatz, ISNULL(A.Bar,0), ISNULL(AP.Stk,0), 0) AS Calc
GO
/****** Object:  Table [dbo].[Stammdat]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Stammdat](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](30) NULL,
	[Wert] [int] NULL,
	[WertText] [varchar](100) NULL,
	[WertMemo] [text] NULL,
	[WertNum] [float] NULL,
 CONSTRAINT [PK_Stammdat] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Zahkond]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Zahkond](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kurztext] [nvarchar](250) NULL,
	[LaenPer1] [smallint] NULL,
	[Skonto1] [float] NULL,
	[LaenPer2] [smallint] NULL,
	[Skonto2] [float] NULL,
	[LaenPer3] [smallint] NULL,
	[GltAnge] [int] NULL,
	[GltAuf] [int] NULL,
	[GltSer] [int] NULL,
	[GltLief] [int] NULL,
	[GltRech] [int] NULL,
	[GltProf] [int] NULL,
	[GltLeih] [int] NULL,
	[Bezahlt] [int] NULL,
	[Status] [int] NULL,
	[GltMiet] [int] NULL,
	[GltMiAn] [int] NULL,
	[GltGuts] [int] NULL,
	[GltAbhol] [int] NULL,
	[GltLieferbedingung] [int] NULL,
	[GltBarverkauf] [int] NULL,
	[DatevExport] [int] NULL,
	[MinBetrag] [money] NULL,
	[Auslieferung] [int] NULL,
	[FaelligArt] [int] NULL,
	[FaelligPlusTage] [int] NULL,
	[FaelligAmTag] [int] NULL,
	[FaelligPlusMonate] [int] NULL,
	[SofortBezahlt] [int] NULL,
	[GltAnfrage] [int] NULL,
	[GltBestellung] [int] NULL,
	[GltWareneingang] [int] NULL,
	[GltKalkulation] [int] NULL,
	[AendertKassenbestand] [int] NULL,
	[Zahlungstyp] [varchar](50) NULL,
	[Bar] [int] NULL,
	[Kredit] [int] NULL,
	[EC] [int] NULL,
	[Scheck] [int] NULL,
	[ZahlungAnweisen] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FrachtfuehrerI3D] [int] NULL,
	[Nachname] [int] NULL,
	[DTALastschrift] [int] NULL,
	[GltLieferbedingungLieferant] [int] NULL,
	[GltLiefgutschrift] [int] NULL,
	[DTAAuswahl] [int] NULL,
	[ESRBelegartCode] [varchar](10) NULL,
	[VersandTarif] [varchar](24) NULL,
	[VersandTarifVariante] [varchar](24) NULL,
	[Untdid4461] [nvarchar](3) NULL,
	[IsProformaInvoice] [bit] NOT NULL,
 CONSTRAINT [PK_Zahkond] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_ContractHead]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ContractHead] AS
SELECT CL.I3D
	,CL.Number
	,CL.Date
	,CL.AdditionalText
	,CL.Version
	,CL.PurchaseOrderNumber
	,CL.Receiver
	,CL.Phone
	,CL.Fax
	,CL.Email
	,CL.BranchI3D
	,CASE WHEN fl.I3D IS Null THEN 'Zentrale' ELSE fl.FilialName END AS Branch 
	,CL.BranchOrigin
	,CL.CustomerI3D
	,k.Name Customer
	,k.RechnungVersandArt SendKindCustomer
	,CL.AddressI3D
	,CL.ContactPersonI3D
	,CL.EditorI3D
	,CL.ExclusiveOfVAT
	,CL.ProjectNumber
	,CL.SalesRepresentativeI3D
	,pAdm.KurzZeich SalesRepresentative
	,CL.OfficeStaffI3D
	,pIdm.KurzZeich OfficeStaff
	,CL.CreatedByI3D
	,CL.CreatedAt
	,CL.CreatedThroughApplicationVersion
	,CL.ChangedByI3D
	,CL.ChangedAt
	,CL.ChangedThroughApplicationVersion
	,CL.ChangedThroughApplication
	,CL.State
	,CL.PaymentConditionI3D AS ReceiptConditionI3D
	,ZK.Kurztext AS ReceiptConditionText    
	,CL.DeliveryConditionI3D
	,LK.Kurztext AS DeliveryConditionText    
	,CL.CostCenterI3D
	,CL.CostObjectI3D
	,CL.IsPartialDeliveryPossible
	,CL.InvoiceAddress
	,CL.InvoiceAddressCustomerI3D
	,CL.InvoiceAddressAddressI3D
	,CL.InvoiceAddressContactPersonI3D
	,CL.InvoiceAddressInformation
	,CL.ReminderDate	
	,CL.CurrencyI3D
	,CL.CurrencyFactor
	,CL.CurrencyString
	,CL.IsCashAsset
	,CL.CountryI3D
	,CL.Information
	,CL.ShowInformation
	,CL.Street
	,CL.HasPostOfficeBox
	,CL.PostOfficeBox
	,CL.Zip
	,CL.City
	,CL.ContactName
	,CL.DirectoryI3D
	,CL.LicenseeAddress
	,CL.LicenseeAddressCustomerI3D
	,CL.LicenseeAddressAddressI3D
	,CL.LicenseeAddressContactPersonI3D
	,CL.LicenseeAddressInformation
	,CL.ContractKindI3D
	,CL.BillingIntervalDuration
	,CL.BillingIntervalKind
	,CL.CounterIntervalDuration
	,CL.CounterIntervalKind
	,CL.CounterBillingKind   
	,CL.CollectInvoice
	,CL.FirstPaidDate
	,CASE WHEN ExtraKind = 4 THEN null ELSE ap.lastdate END LastPaidDate 
	,CL.ContractEnd
	,CL.ContractTermination
	,CL.AutomatedBilling
	,CL.CalculationKind
	,CL.CalcNeedKind
	,CL.AutomatedProlongation
	,CL.BillingKind
	,CL.SendKind
	,CL.IsNormalize
	,CL.IsFullNormalizeAmount
	,CL.ForeignContract
	,CL.Name  AS NAME
	,CL.ReferenceNumber
	,CL.Email AS MailRecipient
	,CL.AlternativeMailRecipientI3D
	,CL.AlternativeMailCCRecipients
	,CL.ExtraKind
	,CL.ContractBegin
  ,CL.ContractBillingToDoOffset AS BillingToDoOffset 
	,CL.Prolongation
	,CL.TerminationDeadlineKind1  
	,CL.TerminationDeadlineKind2  
	,CL.TerminationDeadlineDuration1 
	,CL.TerminationDeadlineDuration2
 	,CL.MandatI3D
	,VA.C2ReportI3D AlternativeReportI3D
	,VA.Bezeichnung ContractKindName
	,VA.CalculationPrio
	,IsNull(ap.I3D,0) LastInvoiceID
	,ap.AddContingent
	,SUM(ISNULL(Split.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(Split.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(Split.NetPriceTotal,0)) + SUM(ISNULL(Split.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(Split.NetPriceTotal,0)) + SUM(ISNULL(Split.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(Split.NetPriceTotal,0)) AS NetPriceComplete
	,SUM(ISNULL(Split.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(Split.NetPriceTotal,0)) + SUM(ISNULL(Split.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(Split.NetPriceTotal,0)) + SUM(ISNULL(Split.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(Split.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(Split.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(Split.NetPriceTotalFC,0)) + SUM(ISNULL(Split.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(Split.NetPriceTotalFC,0)) + SUM(ISNULL(Split.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(Split.NetPriceTotalFC,0)) AS NetPriceFCComplete
	,SUM(ISNULL(Split.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(Split.NetPriceTotalFC,0)) + SUM(ISNULL(Split.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(Split.NetPriceTotalFC,0)) + SUM(ISNULL(Split.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(Split.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(Split.NetPurchasePriceTotal,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(Split.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(Split.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFCComplete
	,CL.ContingentBillingContractI3D
	,CL.IsDisplayedOnWeb
	,CL.WebReportI3D
FROM [dbo].[Contracts] CL
INNER JOIN VertragsArt VA ON VA.I3D = CL.ContractKindI3D
INNER JOIN Kunden K ON k.I3d = CL.CustomerI3D
OUTER APPLY (select top 1 vz.BerechnungszeitraumBis lastdate, vz.I3D, IsNull(vz.NachBerechnung,0) AddContingent  from VertragRechKopfZuordnung vz 
			where vz.VertragI3D = CL.I3D  AND vz.Status = 1 AND IsNull(vz.NachBerechnung,0) in (0,2)
			order by vz.BerechnungszeitraumBis desc, vz.I3D desc) ap
LEFT OUTER JOIN Zahkond ZK ON ZK.I3D = CL.PaymentConditionI3D      
LEFT OUTER JOIN Zahkond LK ON LK.I3D = CL.DeliveryConditionI3D    
LEFT OUTER JOIN Personal pAdm ON pAdm.I3D = cl.SalesRepresentativeI3D
LEFT OUTER JOIN Personal pIdm ON pIdm.I3D = cl.OfficeStaffI3D
LEFT OUTER JOIN Filiale fl ON fl.I3D = CL.BranchI3D
LEFT OUTER JOIN dbo.cvw_ContractHeadVATPriceSplit Split ON Split.HeadI3D = CL.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY
	CL.I3D
	,CL.Number
	,CL.Date
	,CL.AdditionalText
	,CL.Version
	,CL.PurchaseOrderNumber
	,CL.Receiver
	,CL.Phone
	,CL.Fax
	,CL.Email
	,CL.BranchI3D
	,fl.I3D 
	,fl.FilialName
	,CL.BranchOrigin
	,CL.CustomerI3D
	,k.Name
	,k.RechnungVersandArt
	,CL.AddressI3D
	,CL.ContactPersonI3D
	,CL.EditorI3D
	,CL.ExclusiveOfVAT
	,CL.ProjectNumber
	,CL.SalesRepresentativeI3D
	,pAdm.KurzZeich
	,CL.OfficeStaffI3D
	,pIdm.KurzZeich
	,CL.CreatedByI3D
	,CL.CreatedAt
	,CL.CreatedThroughApplicationVersion
	,CL.ChangedByI3D
	,CL.ChangedAt
	,CL.ChangedThroughApplicationVersion
	,CL.ChangedThroughApplication
	,CL.State
	,CL.PaymentConditionI3D 
	,ZK.Kurztext 
	,CL.DeliveryConditionI3D
	,LK.Kurztext 
	,CL.CostCenterI3D
	,CL.CostObjectI3D
	,CL.IsPartialDeliveryPossible
	,CL.InvoiceAddress
	,CL.InvoiceAddressCustomerI3D
	,CL.InvoiceAddressAddressI3D
	,CL.InvoiceAddressContactPersonI3D
	,CL.InvoiceAddressInformation
	,CL.ReminderDate	
	,CL.CurrencyI3D
	,CL.CurrencyFactor
	,CL.CurrencyString
	,CL.IsCashAsset
	,CL.CountryI3D
	,CL.Information
	,CL.ShowInformation
	,CL.Street
	,CL.HasPostOfficeBox
	,CL.PostOfficeBox
	,CL.Zip
	,CL.City
	,CL.ContactName
	,CL.DirectoryI3D
	,CL.LicenseeAddress
	,CL.LicenseeAddressCustomerI3D
	,CL.LicenseeAddressAddressI3D
	,CL.LicenseeAddressContactPersonI3D
	,CL.LicenseeAddressInformation
	,CL.ContractKindI3D
	,CL.BillingIntervalDuration
	,CL.BillingIntervalKind
	,CL.CounterIntervalDuration
	,CL.CounterIntervalKind
	,CL.CounterBillingKind   
	,CL.CollectInvoice
	,CL.FirstPaidDate
	,ExtraKind
	,ap.lastdate
	,ap.AddContingent
	,CL.ContractEnd
	,CL.ContractTermination
	,CL.AutomatedBilling
	,CL.CalculationKind
	,CL.CalcNeedKind
	,CL.AutomatedProlongation
	,CL.BillingKind
	,CL.SendKind
	,CL.IsNormalize
	,CL.IsFullNormalizeAmount
	,CL.ForeignContract
	,CL.Name 
	,CL.ReferenceNumber
	,CL.Email 
	,CL.AlternativeMailRecipientI3D
	,CL.AlternativeMailCCRecipients
	,CL.ExtraKind
	,CL.ContractBegin
    ,CL.ContractBillingToDoOffset
	,CL.Prolongation
	,CL.TerminationDeadlineKind1  
	,CL.TerminationDeadlineKind2  
	,CL.TerminationDeadlineDuration1 
	,CL.TerminationDeadlineDuration2 
    ,CL.MandatI3D
	,VA.C2ReportI3D
	,VA.Bezeichnung
	,VA.CalculationPrio
	,ap.I3D
	,SD.Wert
	,CL.ContingentBillingContractI3D
	,CL.IsDisplayedOnWeb
	,CL.WebReportI3D
GO
/****** Object:  View [dbo].[cvw_ContractHeadLC]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ContractHeadLC] AS
SELECT 
	 C.I3D
	,C.Number
	,C.Date
	,C.CustomerI3D
	,C.CurrencyI3D
	,C.CurrencyFactor
	,C.CurrencyString
	,C.IsCashAsset
	,C.CountryI3D
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFCComplete
FROM [dbo].[Contracts] C
LEFT OUTER JOIN dbo.cvw_ContractHeadVATPriceSplitLC AP ON AP.HeadI3D = C.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY 
	  C.I3D
	 ,C.Number
	 ,C.Date
	 ,C.CustomerI3D
	 ,C.CurrencyI3D
	 ,C.CurrencyFactor
	 ,C.CurrencyString
	 ,C.IsCashAsset
	 ,C.CountryI3D
	 ,SD.Wert
      
GO
/****** Object:  View [dbo].[cvw_SupplierOfferHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierOfferHeadVATPriceSplit]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
FROM dbo.cvw_SupplierOfferPos
WHERE Kind IN (1,3)
AND Expanded IS NULL
GROUP BY HeadI3D
	,VATI3D
	,VATRate
GO
/****** Object:  Table [dbo].[AccountDevices]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountDevices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[ShortName] [nvarchar](256) NOT NULL,
	[DescriptionRTF] [nvarchar](max) NULL,
	[Description] [nvarchar](max) NOT NULL,
	[DeviceId] [nvarchar](256) NULL,
	[WarrantyExpiryDate] [datetime2](0) NULL,
	[CreatedDate] [datetime2](2) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](2) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[SerialNumber] [nvarchar](60) NULL,
	[Model] [nvarchar](512) NOT NULL,
	[Manufacturer] [nvarchar](255) NOT NULL,
	[Location] [nvarchar](255) NOT NULL,
	[IsDeleted] [bit] NOT NULL,
	[DeletedDate] [datetime2](2) NULL,
	[DeletedByI3D] [int] NULL,
	[OriginKind] [int] NOT NULL,
	[BranchI3D] [int] NOT NULL,
 CONSTRAINT [PK_AccountDevices] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountDevicesToTickets]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountDevicesToTickets](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountDeviceI3D] [int] NOT NULL,
	[TicketI3D] [int] NOT NULL,
 CONSTRAINT [PK_AccountDevicesToTickets] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AccountDeviceOverview]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_AccountDeviceOverview]
AS
SELECT dev.I3D
, dev.AccountI3D
, acc.Name AS AccountName
, dev.ShortName
, dev.Description
, dev.DeviceId
, dev.WarrantyExpiryDate
, dev.CreatedDate
, dev.CreatedByI3D
, createdBy.KurzZeich AS CreatedByShortSign
, dev.ChangedDate
, dev.ChangedByI3D
, changedBy.KurzZeich AS ChangedByShortSign
, dev.SerialNumber
, dev.Model
, dev.Manufacturer
, dev.Location
, dev.IsDeleted
, dev.BranchI3D
, branch.FilialName AS BranchName
, ticketCount.AllTicketsCount
, ticketCount.ActiveTicketsCount
, dev.OriginKind
FROM AccountDevices dev
INNER JOIN Accounts acc ON acc.I3D = dev.AccountI3D
LEFT OUTER JOIN Personal createdBy ON createdBy.I3D = dev.CreatedByI3D
LEFT OUTER JOIN Personal changedBy ON changedBy.I3D = dev.ChangedByI3D
LEFT OUTER JOIN Filiale branch ON branch.I3D = dev.BranchI3D
LEFT OUTER JOIN (
SELECT dev.AccountDeviceI3D, COUNT(t.I3D) AS AllTicketsCount, COUNT(IIF(t.ClosedDate IS NULL, 1, null)) AS ActiveTicketsCount
FROM AccountDevicesToTickets dev
INNER JOIN cvw_Tickets t ON t.I3D = dev.TicketI3D
GROUP BY dev.AccountDeviceI3D
) ticketCount ON ticketCount.AccountDeviceI3D = dev.I3D
GO
/****** Object:  Table [dbo].[Personen]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Personen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnschriftID] [int] NULL,
	[Ansprech] [varchar](60) NULL,
	[AnsprechVorname] [varchar](60) NULL,
	[Beruf] [varchar](100) NULL,
	[Tel1] [varchar](30) NULL,
	[Tel2] [varchar](30) NULL,
	[Tel3] [varchar](30) NULL,
	[Tel4] [varchar](30) NULL,
	[Tel5] [varchar](30) NULL,
	[Fax1] [varchar](30) NULL,
	[Fax2] [varchar](30) NULL,
	[Email1] [varchar](255) NULL,
	[Email2] [varchar](255) NULL,
	[Kommentar] [varchar](2000) NULL,
	[Abteilung] [int] NULL,
	[PersDomain] [varchar](255) NULL,
	[PersWWW] [varchar](255) NULL,
	[Faxverteiler] [int] NULL,
	[Mailverteiler] [int] NULL,
	[AgbErhaDatu] [datetime] NULL,
	[AgbErhaBenu] [int] NULL,
	[AnlaDatum] [datetime] NULL,
	[AnlaBenu] [int] NULL,
	[Status] [int] NULL,
	[KredImport] [int] NULL,
	[Import] [int] NULL,
	[Vertriebsertrag] [float] NULL,
	[Bild] [image] NULL,
	[BildExt] [varchar](5) NULL,
	[AnredeI3D] [int] NULL,
	[Mailing1] [int] NULL,
	[Mailing2] [int] NULL,
	[TitelI3D] [int] NULL,
	[ExterneI3D] [varchar](50) NULL,
	[WebBenutzername] [varchar](50) NULL,
	[WebKennwort] [varchar](50) NULL,
	[LastWebLogin] [datetime] NULL,
	[Geburtsdatum] [datetime] NULL,
	[Standard] [int] NULL,
	[AbteilungText] [varchar](255) NULL,
	[ActUniqueID] [varchar](12) NULL,
	[ActETime] [datetime] NULL,
	[ReferenzKundenI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[ErstelltDurch] [int] NULL,
	[LeadAnsprechpartnerI3D] [int] NULL,
	[Kommentar2] [varchar](255) NULL,
	[Kommentar3] [varchar](255) NULL,
	[RechCCEmpfaenger] [int] NULL,
	[DefaultSubstitute] [bit] NULL,
	[ActiveDirectorySID] [nvarchar](255) NULL,
	[IsDsgvoDeleted] [bit] NULL,
	[DsgvoDeletedEmployeeI3D] [int] NULL,
	[DsgvoDeletedDate] [datetime2](0) NULL,
 CONSTRAINT [PK_Personen] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Anschrif]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Anschrif](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kunde] [int] NULL,
	[Kreditor] [int] NULL,
	[Strasse] [varchar](300) NULL,
	[Plz] [varchar](10) NULL,
	[Ort] [varchar](30) NULL,
	[Land] [int] NULL,
	[Kommentar] [varchar](500) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[AnscEMail] [varchar](255) NULL,
	[AnscDomain] [varchar](255) NULL,
	[AnscWWW] [varchar](255) NULL,
	[Faxverteiler] [int] NULL,
	[Mailverteiler] [int] NULL,
	[Mwstkz] [int] NULL,
	[EG] [int] NULL,
	[UmsaIdentNr] [varchar](30) NULL,
	[Bank] [varchar](60) NULL,
	[BLZ] [varchar](20) NULL,
	[KtoNr] [varchar](20) NULL,
	[ZahlKond] [int] NULL,
	[AgbErhaDatu] [datetime] NULL,
	[AgbErhaBenu] [int] NULL,
	[AnlaDatum] [datetime] NULL,
	[AnlaBenu] [int] NULL,
	[Status] [int] NULL,
	[AnschriftArt] [int] NULL,
	[DruckArt] [int] NULL,
	[DruckAnsprech] [int] NULL,
	[KredRMA] [int] NULL,
	[KredImport] [int] NULL,
	[Import] [int] NULL,
	[KundeDefault] [int] NULL,
	[KreditorDefault] [int] NULL,
	[ExterneI3D] [varchar](50) NULL,
	[AnfahrtZone] [int] NULL,
	[AnfahrtKm] [int] NULL,
	[AnfahrtArt] [int] NULL,
	[AnfahrtPreis] [float] NULL,
	[AnfahrtArtikelI3D] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](255) NULL,
	[Sprache] [int] NULL,
	[Waehrung] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[ErstelltDurch] [int] NULL,
	[VarAnschrift] [int] NULL,
	[MwStNichtAusweisen] [int] NULL,
	[LeadAnschriftI3D] [int] NULL,
	[FibuNummer] [int] NULL,
	[DruckAbteilung] [int] NULL,
	[DruckAbteilungAnsprech] [int] NULL,
 CONSTRAINT [PK_Anschrif] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_SupplierOfferHead]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierOfferHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.Datum AS Date
	,K.Name AS AddressName
	,NULL AS SupplierReceiptNumber
	,NULL AS SupplierReceiptDate
	,A.Lieferdatum AS DeliveryDate
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,NULL AS BranchI3D
	,CASE WHEN A.KreditorI3D <= 0 THEN NULL ELSE A.KreditorI3D END AS AddressI3D
	,CASE WHEN A.PersonalI3D <= 0 THEN NULL ELSE A.PersonalI3D END AS EditorI3D
	,A.MwStAusweisen AS ExclusiveOfVAT
	,A.Status AS State
	,ZK.I3D AS PaymentConditionI3D
	,ZK.Kurztext AS PaymentCondition
	,A.Empfanger AS DeliveryAddress
	,A.Empfanger AS InvoiceAddress
	,SUM(AP.NetPriceTotal) AS NetPrice
	,SUM(AP.TaxPriceTotal) AS TaxPrice
	,SUM(AP.NetPriceTotalFC) AS NetPriceFC
	,SUM(AP.TaxPriceTotalFC) AS TaxPriceFC
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(A.Bar,0) AS IsCashAsset
FROM dbo.AnfrKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftI3D = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonI3D = Pers.I3D
LEFT OUTER JOIN dbo.cvw_SupplierOfferHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kreditor AS K ON A.KreditorI3D = K.I3D
LEFT OUTER JOIN dbo.Zahkond AS ZK ON ZK.I3D = A.ZahlKondI3D
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.Empfanger
	,ZK.Kurztext
	,A.Status
	,A.Lieferdatum
	,A.Version
	,A.KreditorI3D
	,A.PersonalI3D
	,A.MwStAusweisen
	,K.Name
	,ZK.I3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
GO
/****** Object:  View [dbo].[cvw_SupplierOrderPos]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierOrderPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END AS Text
	,NULL AS RichText
	,AP.BestellNrKunde AS PurchaseOrderNumber
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.LieferdatumSoll AS DeliveryDate
	,0 AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,NULL AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,AP.BestKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0) - ISNULL(AP.StkGeliefert, 0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.StkGeliefert,0)) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotal
	, Calc.TaxPriceTotal
	, Calc.NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete
	, Calc.NetPriceTotalFC
	, Calc.TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete
	,0 AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStAusweisen = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.BestPos2 AS AP
INNER JOIN dbo.BestKopf2 AS A ON AP.BestKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Art IN (1,3) THEN 1 ELSE 0 END
	,CASE WHEN AP.Art IN (1,3) AND AP.Expanded IS NULL THEN 1 ELSE 0 END
	,AP.Preis, 0, ISNULL(AR.Nachkommastellen,2), 0, A.CurrencyFactor, CONVERT(bit,ISNULL(A.MwStAusweisen,0)), AP.MwstSatz, ISNULL(A.Bar,0), ISNULL(AP.Stk,0), ISNULL(AP.StkGeliefert,0)) AS Calc
GO
/****** Object:  View [dbo].[cvw_SupplierOrderHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierOrderHeadVATPriceSplit]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
FROM dbo.cvw_SupplierOrderPos
WHERE Kind IN (1,3)
AND Expanded IS NULL
GROUP BY HeadI3D
	,VATI3D
	,VATRate
GO
/****** Object:  View [dbo].[cvw_AssetManagementDeviceOverview]    Script Date: 11.11.2025 11:20:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementDeviceOverview]
        AS
	      SELECT Dev.I3D, Dev.KundenI3D AS CustomerI3D, K.Name AS CustomerName, Dev.ShortName, Dev.LastUpdate, Dev.DeviceClass, Dev.IsSystemCralwerInstalled, 
	      Dev.SystemCrawlerStatus, Dev.IsOnline, Dev.SystemCrawlerNeedToInstall, Dev.SystemCrawlerVersion, Dev.SystemCrawlerInstalledDate, Dev.SystemCrawlerUpdatedDate, 
	      Dev.IsSystemCrawlerInstalling, Dev.SystemCrawlerNeedToUnInstall, Dev.IsSystemCrawlerUnInstalling, T.LastActionDate, T.LastActionResult, Dev.IsSystemCrawlerRestart, 
	      Dev.SystemCrawlerRestartLog 
	      FROM dbo.AssetManagementDevices AS Dev INNER JOIN
	      dbo.Kunden AS K ON K.I3D = dev.KundenI3D INNER JOIN
	      (SELECT DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator FROM 
		      dbo.cfn_LastActionCheckResultStatusDetails() AS cfn_LastActionCheckResultStatusDetails_1) AS T ON Dev.I3D = T.DeviceI3D
	      WHERE (K.Status = 1) AND (K.Gesperrt IS NULL OR K.Gesperrt = 0)
      
GO
/****** Object:  View [dbo].[cvw_SupplierOrderHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierOrderHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.Datum AS Date
	,K.Name AS AddressName
	,NULL AS SupplierReceiptNumber
	,NULL AS SupplierReceiptDate
	,A.Lieferdatum AS DeliveryDate
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,NULL AS BranchI3D
	,CASE WHEN A.KreditorI3D <= 0 THEN NULL ELSE A.KreditorI3D END AS AddressI3D
	,CASE WHEN A.PersonalI3D <= 0 THEN NULL ELSE A.PersonalI3D END AS EditorI3D
	,A.MwStAusweisen AS ExclusiveOfVAT
	,A.Status AS State
	,ZK.I3D AS PaymentConditionI3D
	,ZK.Kurztext AS PaymentCondition
	,A.Empfanger AS DeliveryAddress
	,A.Empfanger AS InvoiceAddress
	,SUM(AP.NetPriceTotal) AS NetPrice
	,SUM(AP.TaxPriceTotal) AS TaxPrice
	,SUM(AP.NetPriceTotalComplete) AS NetPriceComplete
	,SUM(AP.TaxPriceTotalComplete) AS TaxPriceComplete
	,SUM(AP.NetPriceTotalFC) AS NetPriceFC
	,SUM(AP.TaxPriceTotalFC) AS TaxPriceFC
	,SUM(AP.NetPriceTotalFCComplete) AS NetPriceFCComplete
	,SUM(AP.TaxPriceTotalFCComplete) AS TaxPriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(A.Bar,0) AS IsCashAsset
FROM dbo.BestKopf2 AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftI3D = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonI3D = Pers.I3D
LEFT OUTER JOIN dbo.cvw_SupplierOrderHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kreditor AS K ON A.KreditorI3D = K.I3D
LEFT OUTER JOIN dbo.Zahkond AS ZK ON ZK.I3D = A.ZahlKondI3D
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.Empfanger
	,ZK.Kurztext
	,A.Status
	,A.Lieferdatum
	,A.Version
	,A.KreditorI3D
	,A.PersonalI3D
	,A.MwStAusweisen
	,K.Name
	,ZK.I3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
GO
/****** Object:  Table [dbo].[AssetManagementCheckConfigurations]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCheckConfigurations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CheckID] [int] NOT NULL,
	[Status] [bit] NOT NULL,
	[StartTime] [datetime] NULL,
	[IntervalKind] [int] NOT NULL,
	[IntervalInMinutes] [int] NULL,
	[DeviceId] [int] NOT NULL,
	[IsNewCheck] [bit] NOT NULL,
	[CheckType] [int] NULL,
	[NoAlertFrom] [datetime] NULL,
	[NoAlertTo] [datetime] NULL,
	[IsPicked] [bit] NULL,
	[PickedDateTime] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementCheckConfigurationsOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementCheckConfigurationsOverview]
        AS
	      SELECT dbo.AssetManagementCheckConfigurations.I3D, dbo.AssetManagementCheckConfigurations.CheckID, dbo.AssetManagementCheckConfigurations.Status, 
			      dbo.AssetManagementCheckConfigurations.StartTime, dbo.AssetManagementCheckConfigurations.IntervalKind, dbo.AssetManagementCheckConfigurations.IntervalInMinutes, 
			      dbo.AssetManagementCheckConfigurations.DeviceId, dbo.AssetManagementCheckConfigurations.IsNewCheck, dbo.AssetManagementCheckConfigurations.CheckType, 
			      dbo.AssetManagementCheckConfigurations.NoAlertFrom, dbo.AssetManagementCheckConfigurations.NoAlertTo, dbo.AssetManagementCheckConfigurations.IsPicked, 
			      dbo.AssetManagementCheckConfigurations.PickedDateTime, dbo.AssetManagementDevices.KundenI3D AS CustomerI3D, dbo.AssetManagementDevices.ShortName AS DeviceName, 
			      dbo.AssetManagementDevices.DeviceClass, dbo.AssetManagementDevices.IsOnline, dbo.Kunden.Name AS CustomerName
	      FROM dbo.AssetManagementCheckConfigurations INNER JOIN
		      dbo.AssetManagementDevices ON dbo.AssetManagementCheckConfigurations.DeviceId = dbo.AssetManagementDevices.I3D INNER JOIN
		      dbo.Kunden ON dbo.AssetManagementDevices.KundenI3D = dbo.Kunden.I3D
		      WHERE (dbo.Kunden.Status = 1) AND (dbo.Kunden.Gesperrt IS NULL OR dbo.Kunden.Gesperrt = 0)
      
GO
/****** Object:  Table [dbo].[WareKopf]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WareKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[AktuelleVersion] [int] NULL,
	[Datum] [datetime] NULL,
	[Lieferdatum] [datetime] NULL,
	[WiedervorlageDatum] [datetime] NULL,
	[WiedervorlageToDoI3D] [int] NULL,
	[Empfanger] [varchar](500) NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[LieferEmpfanger] [varchar](500) NULL,
	[LieferKundenI3D] [int] NULL,
	[LieferAnschriftI3D] [int] NULL,
	[LieferPersonI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[LandI3D] [int] NULL,
	[WaehrungI3D] [int] NULL,
	[Notiz] [text] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[Lockuser] [nvarchar](50) NULL,
	[Status] [int] NULL,
	[ZahlKondI3D] [int] NULL,
	[ZahlKondText] [varchar](255) NULL,
	[LieferscheinNr] [varchar](50) NULL,
	[LieferscheinDatum] [datetime] NULL,
	[Fracht] [float] NULL,
	[FrachtFreiAb] [float] NULL,
	[Mindestbestellwert] [float] NULL,
	[Mindermengenzuschlag] [float] NULL,
	[SummeNetto] [float] NULL,
	[SpaeteBuchung] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[MwStAusweisen] [int] NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[LieferEmpfaengerInfo] [varchar](500) NULL,
	[WareneingangGrundI3D] [int] NULL,
	[WareneingangGrundText] [varchar](500) NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[DocDirI3D] [int] NULL,
	[VarFeld1] [varchar](40) NULL,
	[IsNotAssignToOrder] [bit] NULL,
	[FrachtVerteilung] [int] NULL,
	[Versicherung] [float] NULL,
	[VersicherungsVerteilung] [int] NULL,
	[SeparateVersicherung] [bit] NULL,
	[SeparateFracht] [bit] NULL,
	[BranchI3D] [int] NULL,
	[BranchOrigin] [int] NULL,
	[Street] [nvarchar](50) NULL,
	[HasPostOfficeBox] [int] NULL,
	[PostOfficeBox] [nvarchar](50) NULL,
	[Zip] [nvarchar](50) NULL,
	[City] [nvarchar](50) NULL,
	[ContactName] [nvarchar](128) NULL,
	[ChangedThroughApplication] [int] NULL,
	[ConcurrencyControlGuid] [uniqueidentifier] NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WarePos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WarePos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WareKopfI3D] [int] NULL,
	[Version] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[Text] [varchar](5000) NULL,
	[Kreditorcode] [varchar](100) NULL,
	[Hersteller] [varchar](100) NULL,
	[Herstellercode] [varchar](100) NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[BlockID] [int] NULL,
	[Stk] [float] NULL,
	[Menge] [float] NULL,
	[StkBestellt] [float] NULL,
	[StkKalkuliert] [float] NULL,
	[MengeBestellt] [float] NULL,
	[Preis] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[MwStSatz] [float] NULL,
	[Kostentraeger] [int] NULL,
	[Kostenstelle] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Art] [int] NULL,
	[Freitext] [varchar](5000) NULL,
	[LieferDatumSoll] [datetime] NULL,
	[LieferDatumIst] [datetime] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[UebernommenAusI3D] [int] NULL,
	[UebernommenAusArt] [int] NULL,
	[UebernommenInI3D] [int] NULL,
	[UebernommenInArt] [int] NULL,
	[Status] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[BarcodeStatus] [int] NULL,
	[NumBarcodes] [int] NULL,
	[Gebucht] [int] NULL,
	[LieferscheinNr] [varchar](500) NULL,
	[Lieferdatum] [datetime] NULL,
	[EKAusAufPosI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[EDI1PosI3D] [int] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[Masseinheit] [int] NULL,
	[Dimension] [int] NULL,
	[GewProEinheit] [float] NULL,
	[MwStI3D] [int] NULL,
	[Beschaffenheit] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[Abbuchung] [varchar](1) NULL,
	[EANCode] [varchar](70) NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[BestellnrKunde] [varchar](50) NULL,
	[AuftProj] [varchar](50) NULL,
	[RMAPosI3D] [int] NULL,
	[IsReverseCharge] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_SupplierDeliveryListPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierDeliveryListPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5,11,12) THEN AP.Text ELSE AP.Freitext END AS Text
	,NULL AS RichText
	,AP.BestellNrKunde AS PurchaseOrderNumber
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.LieferdatumSoll AS DeliveryDate
	,0 AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,NULL AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,AP.WareKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0) - ISNULL(AP.StkKalkuliert, 0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.StkKalkuliert,0)) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotal
	, Calc.TaxPriceTotal
	, Calc.NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete
	, Calc.NetPriceTotalFC
	, Calc.TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete
	,0 AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStAusweisen = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.WarePos AS AP
INNER JOIN dbo.WareKopf AS A ON AP.WareKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
CASE WHEN AP.Art IN (1,3) THEN 1 ELSE 0 END
,CASE WHEN AP.Art IN (1,3) AND AP.Expanded IS NULL THEN 1 ELSE 0 END
,AP.Preis, 0, ISNULL(AR.Nachkommastellen,2), 0, A.CurrencyFactor, CONVERT(bit,ISNULL(A.MwStAusweisen,0)), AP.MwstSatz, ISNULL(A.Bar,0), ISNULL(AP.Stk,0), ISNULL(AP.StkKalkuliert,0)) AS Calc
GO
/****** Object:  Table [dbo].[AssetManagementServiceConnectorLogs]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementServiceConnectorLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[LogType] [nvarchar](50) NOT NULL,
	[LogMessage] [nvarchar](max) NOT NULL,
	[Exception] [nvarchar](max) NULL,
	[LogDate] [datetime] NOT NULL,
 CONSTRAINT [PK_CSI_AssetManagementServiceConnectorLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementServiceConnectorLogOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementServiceConnectorLogOverview]
        AS
	      SELECT DISTINCT SCL.I3D, SCL.DeviceI3D, SCL.CustomerI3D, SCL.LogType, SCL.LogMessage, SCL.Exception, COALESCE (REPLACE(CONVERT(VARCHAR(16), 
			      SCL.LogDate, 120), '-' + RIGHT('0' + RTRIM(MONTH(SCL.LogDate)), 2) + '-', ' ' + DATENAME(MM, SCL.LogDate) + ' '), 'Not Run') AS LogDate, 
			      Cust.Name AS CustomerName, CASE WHEN SCL.DeviceI3D > 0 THEN Device.ShortName ELSE ' ' END AS DeviceName
	      FROM dbo.AssetManagementServiceConnectorLogs AS SCL INNER JOIN
		      dbo.Kunden AS Cust ON SCL.CustomerI3D = Cust.I3D INNER JOIN
		      dbo.AssetManagementDevices AS Device ON SCL.DeviceI3D = Device.I3D OR SCL.DeviceI3D = 0
	      WHERE (Cust.Status = 1) AND (Cust.Gesperrt IS NULL OR Cust.Gesperrt = 0)
      
GO
/****** Object:  Table [dbo].[SocialMediaAction]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SocialMediaAction](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SocialMediaStreamI3D] [int] NOT NULL,
	[Text] [ntext] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[EmployeeI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SocialMediaComment]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SocialMediaComment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [ntext] NOT NULL,
	[SocialMediaStreamI3D] [int] NULL,
	[SocialMediaActionI3D] [int] NULL,
	[EmployeeI3D] [int] NULL,
	[CreatedDate] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SocialMediaLike]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SocialMediaLike](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[SocialMediaStreamI3D] [int] NULL,
	[SocialMediaActionI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SocialMediaStream]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SocialMediaStream](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DisplayText] [nvarchar](512) NOT NULL,
	[Description] [ntext] NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_SocialMediaFeed]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_SocialMediaFeed]
AS
SELECT        s.I3D AS StreamI3D, s.I3D AS SocialMediaI3D, 0 AS SocialMediaKind, s.DisplayText AS Name, CONVERT(nvarchar(max),s.Description) AS Text, s.CreatedDate AS CreatedDate, MAX(c.CreatedDate) AS LastCommentDate, 
                         ISNULL(MAX(c.CreatedDate), s.CreatedDate) AS SortDate, NULL AS EmployeeI3D, COUNT(c.I3D) AS CommentCount, ISNULL
                             ((SELECT        COUNT(*) AS Expr1
                                 FROM            dbo.SocialMediaLike AS SL
                                 WHERE        (s.I3D = SocialMediaStreamI3D)), 0) AS LikeCount, s.ObjectI3D, s.ObjectKind
FROM            dbo.SocialMediaStream AS s LEFT OUTER JOIN
                         dbo.SocialMediaComment AS c ON c.SocialMediaStreamI3D = s.I3D
GROUP BY s.DisplayText, CONVERT(nvarchar(max),s.Description), s.CreatedDate, s.I3D, s.ObjectI3D, s.ObjectKind
UNION ALL
SELECT        s.I3D AS StreamI3D, a.I3D AS ActionI3D, 1 AS SocialMediaKind, s.DisplayText AS Name, CONVERT(nvarchar(max),a.Text), a.CreatedDate, MAX(c.CreatedDate) AS LastCommentDate, ISNULL(MAX(c.CreatedDate), a.CreatedDate) AS SortDate,
                          a.EmployeeI3D, COUNT(c.I3D) AS CommentCount, ISNULL
                             ((SELECT        COUNT(*) AS Expr1
                                 FROM            dbo.SocialMediaLike AS SL
                                 WHERE        (a.I3D = SocialMediaActionI3D)), 0) AS LikeCount, s.ObjectI3D, s.ObjectKind
FROM            dbo.SocialMediaStream AS s INNER JOIN
                         dbo.SocialMediaAction AS a ON a.SocialMediaStreamI3D = s.I3D LEFT OUTER JOIN
                         dbo.SocialMediaComment AS c ON c.SocialMediaActionI3D = a.I3D
GROUP BY s.DisplayText, CONVERT(nvarchar(max),a.Text), a.CreatedDate, a.EmployeeI3D, s.I3D, a.I3D, s.ObjectI3D, s.ObjectKind
      
GO
/****** Object:  View [dbo].[cvw_SupplierDeliveryListHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierDeliveryListHeadVATPriceSplit]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
FROM dbo.cvw_SupplierDeliveryListPos
WHERE Kind IN (1,3)
AND Expanded IS NULL
GROUP BY HeadI3D
	,VATI3D
	,VATRate
GO
/****** Object:  Table [dbo].[AssetManagementSnmpMibOidDetails]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSnmpMibOidDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SnmpMibI3D] [int] NOT NULL,
	[OidValue] [nvarchar](100) NOT NULL,
	[ResultType] [int] NOT NULL,
	[PreCondition] [nvarchar](50) NULL,
	[ActualFormat] [nvarchar](500) NOT NULL,
	[SuccessFormat] [nvarchar](100) NULL,
	[WarningFormat] [nvarchar](100) NULL,
	[ErrorFormat] [nvarchar](100) NULL,
	[OtherFormat] [nvarchar](100) NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDate] [datetime] NULL,
	[IsActive] [bit] NOT NULL,
	[DependentOidValue] [nvarchar](100) NULL,
	[IsRangeEnabled] [bit] NOT NULL,
	[StartRange] [int] NULL,
	[EndRange] [int] NULL,
	[CommandType] [int] NOT NULL,
	[IsParallelRecordsExists] [bit] NOT NULL,
	[ParentI3D] [int] NULL,
	[SizeCheckType] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementSnmpMibOidDetails] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSnmpMibChecks]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSnmpMibChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[SnmpOidI3D] [int] NOT NULL,
	[SystemName] [varchar](100) NOT NULL,
	[CommunityString] [nvarchar](100) NOT NULL,
	[SuccessFormat] [nvarchar](100) NULL,
	[WarningFormat] [nvarchar](100) NULL,
	[ErrorFormat] [nvarchar](100) NULL,
	[OtherFormat] [nvarchar](100) NULL,
	[IsActive] [bit] NOT NULL,
	[DisplayName] [nvarchar](256) NOT NULL,
	[SnmpOidValue] [nvarchar](256) NULL,
	[SizeCheckType] [int] NOT NULL,
	[OperatorValue] [int] NOT NULL,
	[PortValue] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementSnmpMibChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSnmpMibDetails]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSnmpMibDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProviderName] [nvarchar](256) NOT NULL,
	[ProviderCode] [nvarchar](256) NOT NULL,
	[ServiceName] [nvarchar](1000) NOT NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDate] [datetime] NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementSnmpMibDetails] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementSnmpMibCheckOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementSnmpMibCheckOverview]
        AS
        SELECT        CHK.I3D, CHK.CustomerI3D, CHK.DeviceI3D, CHK.SnmpOidI3D, CHK.SystemName, CHK.CommunityString, CHK.SuccessFormat, CHK.WarningFormat, CHK.ErrorFormat, CHK.OtherFormat, CHK.IsActive, 
                                 OID.OidValue, OID.ResultType, MIB.ServiceName, MIB.ProviderCode, MIB.ProviderName, DEV.ShortName AS DeviceName, CUST.Name AS CustomerName, OID.PreCondition, CHK.DisplayName, 
                                 OID.IsRangeEnabled, OID.StartRange, OID.EndRange, OID.CommandType, CHK.SnmpOidValue, OID.IsParallelRecordsExists, OID.ParentI3D, CHK.SizeCheckType
        FROM            dbo.AssetManagementSnmpMibChecks AS CHK INNER JOIN
                                 dbo.AssetManagementSnmpMibOidDetails AS OID ON OID.I3D = CHK.SnmpOidI3D INNER JOIN
                                 dbo.AssetManagementSnmpMibDetails AS MIB ON MIB.I3D = OID.SnmpMibI3D INNER JOIN
                                 dbo.AssetManagementDevices AS DEV ON DEV.I3D = CHK.DeviceI3D INNER JOIN
                                 dbo.Kunden AS CUST ON CUST.I3D = CHK.CustomerI3D
      
GO
/****** Object:  Table [dbo].[SocialMediaStreamAccount]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SocialMediaStreamAccount](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[AccountKind] [int] NOT NULL,
	[SocialMediaStreamI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_SocialMediaCustomerFeed]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_SocialMediaCustomerFeed]
AS
SELECT        S.StreamI3D, S.SocialMediaI3D, S.SocialMediaKind, S.Name, S.Text, S.CreatedDate, S.LastCommentDate, S.SortDate, S.EmployeeI3D, S.CommentCount, S.LikeCount, S.ObjectI3D, S.ObjectKind, 
                         A.AccountI3D AS CustomerI3D
FROM            dbo.cvw_SocialMediaFeed AS S INNER JOIN
                         dbo.SocialMediaStreamAccount AS A ON A.SocialMediaStreamI3D = S.StreamI3D AND A.AccountKind = 0
      
GO
/****** Object:  Table [dbo].[MonitoringServiceSettings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringServiceSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Username] [nvarchar](50) NOT NULL,
	[Password] [nvarchar](200) NOT NULL,
	[CentronServiceWCFUrl] [nvarchar](300) NOT NULL,
	[ServiceConnectorWCFUrl] [nvarchar](300) NOT NULL,
	[SystemCrawlerServiceInterval] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ModifiedDate] [datetime] NULL,
	[ServiceConnectorServiceInventoryInterval] [int] NOT NULL,
	[ServiceConnectorSystemCrawlerInstallerInterval] [int] NOT NULL,
	[ServiceConnectorSystemCrawlerStatusInterval] [int] NOT NULL,
	[MonitoringWebsiteUrl] [nvarchar](500) NOT NULL,
	[SystemCrawlerUpdateStatusInterval] [int] NOT NULL,
	[ServiceConnectorUpdaterVersionCheckInterval] [int] NOT NULL,
	[ServiceConnectorUpdaterInstallerInterval] [int] NOT NULL,
	[ServiceConnectorDeviceName] [nvarchar](256) NOT NULL,
	[ServiceConnectorVersion] [nvarchar](25) NOT NULL,
	[ServiceConnectorSystemCrawlerUninstallInterval] [int] NOT NULL,
	[IsServiceConnectorRunning] [bit] NOT NULL,
	[ServiceConnectorRunningLastActive] [datetime] NULL,
	[ServiceType] [int] NOT NULL,
	[AdminType] [int] NOT NULL,
	[AdminUsername] [nvarchar](256) NULL,
	[AdminPassword] [nvarchar](256) NULL,
	[IsDownloadLogs] [bit] NOT NULL,
	[ServiceConnectorVersionInterval] [int] NOT NULL,
	[ServiceConnectorInstallationInterval] [int] NOT NULL,
	[SystemCrawlerUninstallInterval] [int] NOT NULL,
 CONSTRAINT [PK_MonitoringServiceSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_MonitoringServiceSettingOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_MonitoringServiceSettingOverview]
        AS
        SELECT        dbo.MonitoringServiceSettings.I3D, dbo.MonitoringServiceSettings.CustomerI3D, dbo.Kunden.Name AS CustomerName, dbo.MonitoringServiceSettings.Username, dbo.MonitoringServiceSettings.Password, 
                                 dbo.MonitoringServiceSettings.CentronServiceWCFUrl, dbo.MonitoringServiceSettings.ServiceConnectorWCFUrl, dbo.MonitoringServiceSettings.SystemCrawlerServiceInterval, 
                                 dbo.MonitoringServiceSettings.IsActive, dbo.MonitoringServiceSettings.CreatedDate, dbo.MonitoringServiceSettings.ModifiedDate, dbo.MonitoringServiceSettings.ServiceConnectorServiceInventoryInterval, 
                                 dbo.MonitoringServiceSettings.ServiceConnectorSystemCrawlerInstallerInterval, dbo.MonitoringServiceSettings.ServiceConnectorSystemCrawlerStatusInterval, 
                                 dbo.MonitoringServiceSettings.MonitoringWebsiteUrl, dbo.MonitoringServiceSettings.SystemCrawlerUpdateStatusInterval, dbo.MonitoringServiceSettings.ServiceConnectorUpdaterVersionCheckInterval, 
                                 dbo.MonitoringServiceSettings.ServiceConnectorUpdaterInstallerInterval, dbo.MonitoringServiceSettings.ServiceConnectorDeviceName, dbo.MonitoringServiceSettings.ServiceConnectorVersion, 
                                 dbo.MonitoringServiceSettings.ServiceConnectorSystemCrawlerUninstallInterval, dbo.MonitoringServiceSettings.IsServiceConnectorRunning, dbo.MonitoringServiceSettings.ServiceConnectorRunningLastActive, 
                                 dbo.MonitoringServiceSettings.ServiceType, dbo.MonitoringServiceSettings.AdminType, dbo.MonitoringServiceSettings.AdminUsername, dbo.MonitoringServiceSettings.AdminPassword, 
                                 dbo.MonitoringServiceSettings.IsDownloadLogs
        FROM            dbo.MonitoringServiceSettings INNER JOIN
                                 dbo.Kunden ON dbo.MonitoringServiceSettings.CustomerI3D = dbo.Kunden.I3D
      
GO
/****** Object:  View [dbo].[cvw_SupplierDeliveryListHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierDeliveryListHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.Datum AS Date
	,K.Name AS AddressName
	,A.LieferscheinNr AS SupplierReceiptNumber
	,A.LieferscheinDatum AS SupplierReceiptDate
	,A.Lieferdatum AS DeliveryDate
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,NULL AS BranchI3D
	,CASE WHEN A.KreditorI3D <= 0 THEN NULL ELSE A.KreditorI3D END AS AddressI3D
	,CASE WHEN A.PersonalI3D <= 0 THEN NULL ELSE A.PersonalI3D END AS EditorI3D
	,A.MwStAusweisen AS ExclusiveOfVAT
	,A.Status AS State
	,ZK.I3D AS PaymentConditionI3D
	,ZK.Kurztext AS PaymentCondition
	,A.Empfanger AS DeliveryAddress
	,A.Empfanger AS InvoiceAddress
	,SUM(AP.NetPriceTotal) AS NetPrice
	,SUM(AP.TaxPriceTotal) AS TaxPrice
	,SUM(AP.NetPriceTotalComplete) AS NetPriceComplete
	,SUM(AP.TaxPriceTotalComplete) AS TaxPriceComplete
	,SUM(AP.NetPriceTotalFC) AS NetPriceFC
	,SUM(AP.TaxPriceTotalFC) AS TaxPriceFC
	,SUM(AP.NetPriceTotalFCComplete) AS NetPriceFCComplete
	,SUM(AP.TaxPriceTotalFCComplete) AS TaxPriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(A.Bar,0) AS IsCashAsset
FROM dbo.WareKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftI3D = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonI3D = Pers.I3D
LEFT OUTER JOIN dbo.cvw_SupplierDeliveryListHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kreditor AS K ON A.KreditorI3D = K.I3D
LEFT OUTER JOIN dbo.Zahkond AS ZK ON ZK.I3D = A.ZahlKondI3D
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.LieferscheinNr
	,A.LieferscheinDatum
	,A.Empfanger
	,ZK.Kurztext
	,A.Status
	,A.Lieferdatum
	,A.Version
	,A.KreditorI3D
	,A.PersonalI3D
	,A.MwStAusweisen
	,K.Name
	,ZK.I3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
GO
/****** Object:  View [dbo].[cvw_SocialMediaActionEmployeeInteraction]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_SocialMediaActionEmployeeInteraction]
AS
SELECT P.I3D AS EmployeeI3D, A.I3D AS SocialMediaI3D, 0 AS SocialMediaKind, CONVERT(bit, CASE WHEN EXISTS
(SELECT 1 FROM SocialMediaLike L WHERE L.EmployeeI3D = P.I3D AND L.SocialMediaStreamI3D = A.I3D) THEN 1 ELSE 0 END) AS HasLiked, CONVERT(bit, CASE WHEN EXISTS
(SELECT 1 FROM SocialMediaComment C WHERE C.EmployeeI3D = P.I3D AND C.SocialMediaStreamI3D = A.I3D) THEN 1 ELSE 0 END) AS HasCommented
FROM dbo.SocialMediaStream AS A 
INNER JOIN dbo.Personal AS P ON P.I3D IN (SELECT EmployeeI3D FROM dbo.SocialMediaLike AS SL WHERE (ISNULL(SocialMediaStreamI3D, 0) > 0)
      GROUP BY EmployeeI3D) OR
P.I3D IN (SELECT EmployeeI3D FROM dbo.SocialMediaComment AS SC WHERE (ISNULL(SocialMediaStreamI3D, 0) > 0) GROUP BY EmployeeI3D)
GROUP BY P.I3D, A.I3D
HAVING EXISTS (SELECT 1 AS Expr1 FROM dbo.SocialMediaLike AS L WHERE (EmployeeI3D = P.I3D) AND (SocialMediaStreamI3D = A.I3D)) 
OR EXISTS (SELECT        1 AS Expr1 FROM dbo.SocialMediaComment AS C WHERE (EmployeeI3D = P.I3D) AND (SocialMediaStreamI3D = A.I3D))
UNION ALL
SELECT P.I3D AS EmployeeI3D, A.I3D AS SocialMediaI3D, 1 AS SocialMediaKind, CONVERT(bit, CASE WHEN EXISTS
(SELECT 1 FROM SocialMediaLike L WHERE L.EmployeeI3D = P.I3D AND L.SocialMediaActionI3D = A.I3D) THEN 1 ELSE 0 END) AS HasLiked, CONVERT(bit, CASE WHEN EXISTS
(SELECT 1 FROM SocialMediaComment C WHERE C.EmployeeI3D = P.I3D AND C.SocialMediaActionI3D = A.I3D) THEN 1 ELSE 0 END) AS HasCommented
FROM dbo.SocialMediaAction AS A 
INNER JOIN dbo.Personal AS P ON P.I3D IN (SELECT EmployeeI3D FROM dbo.SocialMediaLike AS SL WHERE (ISNULL(SocialMediaActionI3D, 0) > 0)
      GROUP BY EmployeeI3D) OR
P.I3D IN (SELECT EmployeeI3D FROM dbo.SocialMediaComment AS SC WHERE ISNULL(SocialMediaActionI3D, 0) > 0 GROUP BY EmployeeI3D)
GROUP BY P.I3D, A.I3D
HAVING EXISTS (SELECT 1 AS Expr1 FROM dbo.SocialMediaLike AS L WHERE (EmployeeI3D = P.I3D) AND (SocialMediaActionI3D = A.I3D)) 
OR EXISTS (SELECT        1 AS Expr1 FROM dbo.SocialMediaComment AS C WHERE (EmployeeI3D = P.I3D) AND (SocialMediaActionI3D = A.I3D))
      
GO
/****** Object:  View [dbo].[cvw_CustomerOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_CustomerOverview]
        AS
        SELECT I3D, Name AS CustomerName, Status, InnendienstID AS Adviser1, AussendienstID AS Adviser2, TechnikerID AS Adviser3, Techniker2ID AS Adviser4, 
		        (SELECT COUNT(1) AS DeviceCount FROM dbo.AssetManagementDevices WHERE (KundenI3D = Cust.I3D)) AS DeviceCount,
		        (SELECT COUNT(1) AS SystemCralwerInstalledCount FROM dbo.AssetManagementDevices AS Dev WHERE (IsSystemCralwerInstalled = 1) AND (KundenI3D = Cust.I3D)) AS SystemCralwerInstalledCount,
		        (SELECT COUNT(1) AS SystemCralwerRunningCount FROM dbo.AssetManagementDevices AS Dev1 WHERE (SystemCrawlerStatus = 1) AND (KundenI3D = Cust.I3D)) AS SystemCralwerRunningCount
        FROM dbo.Kunden AS Cust WHERE (Status = 1) AND (Cust.Gesperrt IS NULL OR Cust.Gesperrt = 0) 
      
GO
/****** Object:  View [dbo].[Offers]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[Offers] AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.AngUeberschrift AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.Projektnummer AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptConditionText
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryConditionText
	,CASE WHEN A.ZahlKondRechI3D <= 0 THEN NULL ELSE A.ZahlKondRechI3D END AS PaymentConditionI3D
	,A.RechnungskonditionsText AS PaymentConditionText
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
    ,CASE WHEN YEAR(ISNULL(A.ProjektEnde,0)) < 1905 THEN NULL ELSE A.ProjektEnde END AS ProjectEnd
    ,CASE WHEN A.Angebotklasse <= 0 THEN NULL ELSE A.Angebotklasse END AS ProbabilityClassificationI3D
    ,CASE WHEN A.AngebKlassifI3D <= 0 THEN NULL ELSE A.AngebKlassifI3D END AS ProductGroupClassificationI3D
	,ISNULL(A.Leasing, 0) AS IsLeasingActive
	,ISNULL(A.LeasingGebuehr, 0) AS LeasingFee
	,ISNULL(A.LeasingMonate, 0) AS LeasingMonths
	,ISNULL(A.LeasingSatz, 0) AS LeasingRatePercent
	,ISNULL(A.LeasingRate, 0) AS LeasingRatePerMonth
	,ISNULL(A.IsServiceShare, 0) AS IsServiceActive
	,ISNULL(A.ServiceGebuehr, 0) AS ServiceFee
	,ISNULL(A.ServiceMonate, 0) AS ServiceMonths
	,ISNULL(A.ServiceSatz, 0) AS ServiceRatePercent
	,ISNULL(A.ServiceRate, 0) AS ServiceRatePerMonth
	,CASE WHEN A.AbschlI3D <= 0 THEN NULL ELSE A.AbschlI3D END AS CompleteReasonI3D
	,A.AbschlGrund AS CompleteReasonText
	,A.VertragsI3D AS ContractI3D
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.GUI3D AS ConcurrencyControlGuid
	,A.CampaignI3D
	,A.ReceiptUserStateI3D
	,A.IsCart
	,A.CartName
	,A.CartDescription
	,A.CartCreatorContactPersonI3D
	,A.CartAssembleArticles
	,A.CartState
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.AngKopf AS A
GO
/****** Object:  Table [dbo].[KalkKopf]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KalkKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Datum] [datetime] NULL,
	[KreditorI3D] [int] NULL,
	[Empfanger] [varchar](500) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Tel] [varchar](30) NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[WaehrungI3D] [int] NULL,
	[WaherungKursZuEuro] [float] NULL,
	[Notiz] [text] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Lockuser] [nvarchar](50) NULL,
	[Status] [int] NULL,
	[LieferscheinNr] [varchar](500) NULL,
	[LieferscheinDatum] [datetime] NULL,
	[RechnungsNr] [varchar](50) NULL,
	[RechnungsDatum] [datetime] NULL,
	[Nettobetrag] [float] NULL,
	[Frachtkosten] [float] NULL,
	[Versicherung] [float] NULL,
	[ZahlKondI3D] [int] NULL,
	[ZahlKondText] [varchar](255) NULL,
	[NettobetragGesamt] [float] NULL,
	[BruttobetragGesamt] [float] NULL,
	[MwStAusweisen] [int] NULL,
	[LandI3D] [int] NULL,
	[LinFracht] [int] NULL,
	[LinVersicherung] [int] NULL,
	[Fracht] [float] NULL,
	[FrachtFreiAb] [float] NULL,
	[Mindestbestellwert] [float] NULL,
	[Mindermengenzuschlag] [float] NULL,
	[FaelligAm] [datetime] NULL,
	[Bezahlt] [float] NULL,
	[ZahlungsabgangNichtAnzeigen] [int] NULL,
	[GutschriftBetrag] [float] NULL,
	[DTAusErstellt] [int] NULL,
	[DTAusDatum] [datetime] NULL,
	[DTAusBearbeiter] [int] NULL,
	[SummeNetto] [float] NULL,
	[FrachtVerteilung] [int] NULL,
	[VersicherungsVerteilung] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[Kalkulationsart] [int] NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[WEKalkulationGrundI3D] [int] NULL,
	[WEKalkulationGrundText] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[AktuelleVersion] [int] NULL,
	[Version] [int] NULL,
	[BankVerbNummer] [int] NULL,
	[ESRCodierzeile] [varchar](75) NULL,
	[FibuGesamtPreis] [float] NULL,
	[VarFeld1] [varchar](40) NULL,
	[KeinBuchhaltungsexport] [int] NULL,
	[FIBUSammelkonto] [varchar](24) NULL,
	[SKontoBetrag] [float] NULL,
	[IsNotAssignToOrder] [bit] NULL,
	[SeparateVersicherung] [bit] NULL,
	[SeparateFracht] [bit] NULL,
	[BranchI3D] [int] NULL,
	[BranchOrigin] [int] NULL,
	[Street] [nvarchar](50) NULL,
	[HasPostOfficeBox] [int] NULL,
	[PostOfficeBox] [nvarchar](50) NULL,
	[Zip] [nvarchar](50) NULL,
	[City] [nvarchar](50) NULL,
	[ContactName] [nvarchar](128) NULL,
	[ChangedThroughApplication] [int] NULL,
	[ConcurrencyControlGuid] [uniqueidentifier] NULL,
	[ProjNr] [varchar](50) NULL,
	[ReceiptLink] [nvarchar](256) NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
	[IsSupplierInvoiceStandalone] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KalkPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KalkPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KalkKopfI3D] [int] NULL,
	[Version] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[Text] [varchar](5000) NULL,
	[Kreditorcode] [varchar](100) NULL,
	[Hersteller] [varchar](100) NULL,
	[Herstellercode] [varchar](100) NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[BlockID] [int] NULL,
	[Stk] [float] NULL,
	[Menge] [float] NULL,
	[StkWareneingang] [float] NULL,
	[Preis] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[MwStSatz] [float] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Art] [int] NULL,
	[Freitext] [varchar](5000) NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[UebernommenAusI3D] [int] NULL,
	[UebernommenAusArt] [int] NULL,
	[UebernommenInI3D] [int] NULL,
	[UebernommenInArt] [int] NULL,
	[Status] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[LieferDatumSoll] [datetime] NULL,
	[LieferDatumIst] [datetime] NULL,
	[Gebucht] [int] NULL,
	[LieferscheinNr] [varchar](500) NULL,
	[LieferscheinDatum] [datetime] NULL,
	[Fracht] [float] NULL,
	[Versicherung] [float] NULL,
	[EKAusAufPosI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[Masseinheit] [int] NULL,
	[Dimension] [int] NULL,
	[GewProEinheit] [float] NULL,
	[MwStI3D] [int] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[Beschaffenheit] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[Abbuchung] [varchar](1) NULL,
	[StkBestellt] [float] NULL,
	[EANCode] [varchar](70) NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[BestellnrKunde] [varchar](50) NULL,
	[AuftProj] [varchar](50) NULL,
	[StkGutgeschrieben] [int] NULL,
	[RMAPosI3D] [int] NULL,
	[DistributorID] [int] NULL,
	[IsReverseCharge] [int] NULL,
	[ExportDate] [datetime] NULL,
	[CopyFromI3D] [int] NULL,
	[CopyFromKind] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_SupplierInvoicePos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierInvoicePos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5, 11, 12) THEN AP.Text ELSE AP.Freitext END AS Text
	,NULL AS RichText
	,AP.BestellNrKunde AS PurchaseOrderNumber
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.LieferdatumSoll AS DeliveryDate
	,0 AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,NULL AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,AP.KalkKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0) - ISNULL(AP.StkGutgeschrieben, 0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.StkGutgeschrieben,0)) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotal
	, Calc.TaxPriceTotal
	, Calc.NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete
	, Calc.NetPriceTotalFC
	, Calc.TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete

	,CONVERT(DECIMAL(19,4),ISNULL(AP.Versicherung,0) / CASE WHEN ABS(A.CurrencyFactor) < 0.000001 THEN 1 ELSE A.CurrencyFactor END * AP.Stk) AS InsuranceNetPriceTotalComplete
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Versicherung,0) / CASE WHEN ABS(A.CurrencyFactor) < 0.000001 THEN 1 ELSE A.CurrencyFactor END * AP.Stk * IIF(A.MwStAusweisen = 1, 0, AP.MwstSatz / 100)) AS InsuranceTaxPriceTotalComplete
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Versicherung,0) * AP.Stk) AS InsuranceNetPriceTotalFCComplete
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Versicherung,0) * AP.Stk * IIF(A.MwStAusweisen = 1, 0, AP.MwstSatz / 100)) AS InsuranceTaxPriceTotalFCComplete
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Fracht,0) / CASE WHEN ABS(A.CurrencyFactor) < 0.000001 THEN 1 ELSE A.CurrencyFactor END * AP.Stk) AS FreightNetPriceTotalComplete
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Fracht,0) / CASE WHEN ABS(A.CurrencyFactor) < 0.000001 THEN 1 ELSE A.CurrencyFactor END * AP.Stk * IIF(A.MwStAusweisen = 1, 0, AP.MwstSatz / 100)) AS FreightTaxPriceTotalComplete
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Fracht,0) * AP.Stk) AS FreightNetPriceTotalFCComplete
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Fracht,0) * AP.Stk * IIF(A.MwStAusweisen = 1, 0, AP.MwstSatz / 100)) AS FreightTaxPriceTotalFCComplete

	,CONVERT(DECIMAL(19,4),ISNULL(AP.Versicherung,0) / CASE WHEN ABS(A.CurrencyFactor) < 0.000001 THEN 1 ELSE A.CurrencyFactor END) AS InsuranceNetPrice
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Versicherung,0) / CASE WHEN ABS(A.CurrencyFactor) < 0.000001 THEN 1 ELSE A.CurrencyFactor END * IIF(A.MwStAusweisen = 1, 0, AP.MwstSatz / 100)) AS InsuranceTaxPrice
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Versicherung,0)) AS InsuranceNetPriceFC
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Versicherung,0) * IIF(A.MwStAusweisen = 1, 0, AP.MwstSatz / 100)) AS InsuranceTaxPriceFC
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Fracht,0) / CASE WHEN ABS(A.CurrencyFactor) < 0.000001 THEN 1 ELSE A.CurrencyFactor END) AS FreightNetPrice
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Fracht,0) / CASE WHEN ABS(A.CurrencyFactor) < 0.000001 THEN 1 ELSE A.CurrencyFactor END * IIF(A.MwStAusweisen = 1, 0, AP.MwstSatz / 100)) AS FreightTaxPrice
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Fracht,0)) AS FreightNetPriceFC
	,CONVERT(DECIMAL(19,4),ISNULL(AP.Fracht,0) * IIF(A.MwStAusweisen = 1, 0, AP.MwstSatz / 100)) AS FreightTaxPriceFC
	,0 AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStAusweisen = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.KalkPos AS AP
INNER JOIN dbo.KalkKopf AS A ON AP.KalkKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Art IN (1,3, 11, 12) THEN 1 ELSE 0 END
	,CASE WHEN AP.Art IN (1,3, 11, 12) AND AP.Expanded IS NULL THEN 1 ELSE 0 END
	,AP.Preis, 0, ISNULL(AR.Nachkommastellen,2), 0, A.CurrencyFactor, CONVERT(bit,ISNULL(A.MwStAusweisen,0)), AP.MwstSatz, ISNULL(A.Bar,0), ISNULL(AP.Stk,0), ISNULL(AP.StkGutgeschrieben,0)) AS Calc
GO
/****** Object:  View [dbo].[cvw_SocialMediaCommentOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_SocialMediaCommentOverview]
AS
SELECT        C.I3D, C.EmployeeI3D, P.Vorname + ' ' + P.Name + ' (' + P.KurzZeich + ')' AS EmployeeName, ISNULL(C.SocialMediaStreamI3D, C.SocialMediaActionI3D) AS SocialMediaI3D, 
                         CASE WHEN C.SocialMediaStreamI3D IS NOT NULL THEN 0 ELSE 1 END AS SocialMediaKind, ISNULL(A.Text, S.DisplayText) AS Caption, C.Text AS Comment, C.CreatedDate
FROM            dbo.SocialMediaComment AS C LEFT OUTER JOIN
                         dbo.Personal AS P ON P.I3D = C.EmployeeI3D LEFT OUTER JOIN
                         dbo.SocialMediaStream AS S ON C.SocialMediaStreamI3D = S.I3D LEFT OUTER JOIN
                         dbo.SocialMediaAction AS A ON A.I3D = C.SocialMediaActionI3D LEFT OUTER JOIN
                         dbo.SocialMediaStream AS S2 ON S2.I3D = A.SocialMediaStreamI3D
      
GO
/****** Object:  Table [dbo].[AssetManagementWindowsServices]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementWindowsServices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[ServiceName] [nvarchar](256) NOT NULL,
	[Caption] [nvarchar](256) NULL,
	[StartupType] [nvarchar](256) NULL,
	[UserAccount] [nvarchar](256) NULL,
	[ExecutableName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDeviceDependencies]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDeviceDependencies](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NULL,
	[WindowsServicesI3D] [int] NULL,
	[ApplicationI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementApplication]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementApplication](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[DisplayName] [nvarchar](256) NULL,
	[Publisher] [nvarchar](256) NULL,
	[Version] [nvarchar](256) NULL,
	[LicenseKey] [nvarchar](256) NULL,
	[LicenseType] [nvarchar](256) NULL,
	[UninstallString] [nvarchar](500) NULL,
	[IdentifyingNumber] [nvarchar](256) NULL,
	[Is64Bit] [bit] NOT NULL,
	[InstallationDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_DeviceDependencies]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_DeviceDependencies]
        AS
        SELECT        dbo.AssetManagementDevices.I3D, dbo.AssetManagementDevices.ParentI3D, dbo.AssetManagementDevices.KundenI3D, dbo.AssetManagementDevices.ShortName, dbo.AssetManagementDevices.LongName, 
                                 dbo.AssetManagementDevices.DeviceId, dbo.AssetManagementDevices.WarrantyExpiryDate, dbo.AssetManagementDevices.CreatedOn, dbo.AssetManagementDevices.DocumentationCategoryI3D, 
                                 dbo.AssetManagementDevices.Deleted, dbo.AssetManagementDevices.DeviceClass, dbo.AssetManagementDevices.Uri, dbo.AssetManagementDevices.IsOnline, dbo.AssetManagementDevices.LastUpdate, 
                                 dbo.AssetManagementDevices.Status, dbo.AssetManagementDeviceDependencies.I3D AS DependentI3D, dbo.AssetManagementApplication.I3D AS ApplicationI3D, 
                                 dbo.AssetManagementApplication.DisplayName, dbo.AssetManagementApplication.Publisher, dbo.AssetManagementApplication.InstallationDate, dbo.AssetManagementApplication.Version, 
                                 dbo.AssetManagementApplication.LicenseKey, dbo.AssetManagementApplication.LicenseType, dbo.AssetManagementWindowsServices.I3D AS WindowsServicesI3D, 
                                 dbo.AssetManagementWindowsServices.ServiceName, dbo.AssetManagementWindowsServices.Caption, dbo.AssetManagementWindowsServices.StartupType, 
                                 dbo.AssetManagementWindowsServices.UserAccount, dbo.AssetManagementWindowsServices.ExecutableName
        FROM            dbo.AssetManagementDevices INNER JOIN
                                 dbo.AssetManagementDeviceDependencies ON dbo.AssetManagementDeviceDependencies.DeviceI3D = dbo.AssetManagementDevices.I3D INNER JOIN
                                 dbo.AssetManagementApplication ON dbo.AssetManagementApplication.I3D = dbo.AssetManagementDeviceDependencies.ApplicationI3D INNER JOIN
                                 dbo.AssetManagementWindowsServices ON dbo.AssetManagementWindowsServices.I3D = dbo.AssetManagementDeviceDependencies.WindowsServicesI3D
      
GO
/****** Object:  Table [dbo].[AngPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AngKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[AufLiefRechNr] [int] NULL,
	[AufLiefRechArt] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[MwstI3D] [int] NULL,
	[LaenderI3D] [int] NULL,
	[MWStAktiv] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellPos] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[Import] [int] NULL,
	[MitBild] [int] NULL,
	[BSLaengeT] [float] NULL,
	[BSBreiteT] [float] NULL,
	[BSHoeheT] [float] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[VertragI3D] [int] NULL,
	[VertragArt] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[OriginalStk] [float] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[BSLaengeE] [float] NULL,
	[BSBreiteE] [float] NULL,
	[BSHoeheE] [float] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[RMAPosI3D] [int] NULL,
	[Status] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[HerstellerI3D] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[RundungsDiff] [float] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[IsBillingPartList] [int] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[isLeasing] [int] NULL,
	[isService] [int] NULL,
	[PurchasePriceSupplierI3D] [int] NULL,
	[InternalNote] [nvarchar](max) NULL,
	[PlannedDurationInHours] [decimal](19, 7) NOT NULL,
	[IsReverseCharge] [bit] NULL,
 CONSTRAINT [PK_AngPos] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [ixAngPos_AngKopfI3D]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixAngPos_AngKopfI3D] ON [dbo].[AngPos]
(
	[AngKopfI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  View [dbo].[OfferItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[OfferItems] AS
SELECT AP.I3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.AngKopfI3D, 0) AS ReceiptI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,CASE WHEN AP.MitBild IN (1, 11) THEN 1 ELSE 0 END AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
	,AP.Bestellinformation AS PurchaseInformations
	,AP.WEEE AS WEEE
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,AP.PurchasePriceSupplierI3D AS PurchasePriceSupplierI3D
	,AP.InternalNote AS InternalNote
	,AP.PlannedDurationInHours AS PlannedDurationInHours
	,AP.IsReverseCharge
	,CAST(ISNULL(AP.isLeasing,0) AS BIT) AS IsLeasing
	,CAST(ISNULL(AP.isService,0) AS BIT) AS IsService
FROM dbo.AngPos AS AP
GO
/****** Object:  View [dbo].[cvw_SupplierInvoiceHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierInvoiceHeadVATPriceSplit]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalComplete) + SUM(InsuranceTaxPriceTotalComplete) + SUM(FreightTaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalFCComplete) + SUM(InsuranceTaxPriceTotalFCComplete) + SUM(FreightTaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,CONVERT(DECIMAL(19,2), ROUND(SUM(InsuranceNetPriceTotalComplete),2)) AS InsuranceNetPriceTotalComplete
	,CONVERT(DECIMAL(19, 2), 0) AS InsuranceTaxPriceTotalComplete
	,CONVERT(DECIMAL(19,2), ROUND(SUM(InsuranceNetPriceTotalFCComplete),2)) AS InsuranceNetPriceTotalFCComplete
	,CONVERT(DECIMAL(19, 2), 0) AS InsuranceTaxPriceTotalFCComplete
	,CONVERT(DECIMAL(19,2), ROUND(SUM(FreightNetPriceTotalComplete),2)) AS FreightNetPriceTotalComplete
	,CONVERT(DECIMAL(19, 2), 0) AS FreightTaxPriceTotalComplete
	,CONVERT(DECIMAL(19,2), ROUND(SUM(FreightNetPriceTotalFCComplete),2)) AS FreightNetPriceTotalFCComplete
	,CONVERT(DECIMAL(19, 2), 0) AS FreightTaxPriceTotalFCComplete
FROM dbo.cvw_SupplierInvoicePos
WHERE Kind IN (1,3, 11, 12)
AND Expanded IS NULL
GROUP BY HeadI3D
	,VATI3D
	,VATRate
GO
/****** Object:  View [dbo].[cvw_SocialMediaLikeOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_SocialMediaLikeOverview]
AS
SELECT        L.I3D, L.EmployeeI3D, P.Vorname + ' ' + P.Name + ' (' + P.KurzZeich + ')' AS EmployeeName, ISNULL(L.SocialMediaStreamI3D, L.SocialMediaActionI3D) AS SocialMediaI3D, 
                         CASE WHEN L.SocialMediaStreamI3D IS NOT NULL THEN 0 ELSE 1 END AS SocialMediaKind, ISNULL(A.Text, S.DisplayText) AS Caption
FROM            dbo.SocialMediaLike AS L INNER JOIN
                         dbo.Personal AS P ON P.I3D = L.EmployeeI3D LEFT OUTER JOIN
                         dbo.SocialMediaStream AS S ON S.I3D = L.SocialMediaStreamI3D LEFT OUTER JOIN
                         dbo.SocialMediaAction AS A ON A.I3D = L.SocialMediaActionI3D LEFT OUTER JOIN
                         dbo.SocialMediaStream AS S2 ON S2.I3D = A.SocialMediaStreamI3D
      
GO
/****** Object:  Table [dbo].[AssetManagementWindowsSystems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementWindowsSystems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[DeviceName] [nvarchar](256) NULL,
	[OperatingSystem] [nvarchar](256) NULL,
	[Type] [nvarchar](256) NULL,
	[PasswordAge] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementWizardMappings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementWizardMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ActiveDirectoryI3D] [int] NULL,
	[WindowsSystemI3D] [int] NULL,
	[IISServerSiteI3D] [int] NULL,
	[Name] [nvarchar](256) NULL,
	[Value] [nvarchar](500) NULL,
	[ActiveDirectoryUserI3D] [int] NULL,
	[ActiveDirectoryGroupI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementWindowsSystemWizardMappings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementWindowsSystemWizardMappings]
        AS
        SELECT        dbo.AssetManagementWindowsSystems.I3D, dbo.AssetManagementWindowsSystems.CustomerI3D, dbo.AssetManagementWindowsSystems.DeviceName, 
                                 dbo.AssetManagementWindowsSystems.OperatingSystem, dbo.AssetManagementWindowsSystems.Type, dbo.AssetManagementWindowsSystems.PasswordAge, 
                                 dbo.AssetManagementWizardMappings.I3D AS AssetManagementWizardMappingsI3D, dbo.AssetManagementWizardMappings.Name, dbo.AssetManagementWizardMappings.Value
        FROM            dbo.AssetManagementWindowsSystems INNER JOIN
                                 dbo.AssetManagementWizardMappings ON dbo.AssetManagementWindowsSystems.I3D = dbo.AssetManagementWizardMappings.WindowsSystemI3D
      
GO
/****** Object:  View [dbo].[cvw_SupplierInvoiceHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierInvoiceHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.Datum AS Date
	,K.Name AS AddressName
	,A.RechnungsNr AS SupplierReceiptNumber
	,A.RechnungsDatum AS SupplierReceiptDate
	,A.LieferscheinDatum AS DeliveryDate
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,NULL AS BranchI3D
	,CASE WHEN A.KreditorI3D <= 0 THEN NULL ELSE A.KreditorI3D END AS AddressI3D
	,CASE WHEN A.PersonalI3D <= 0 THEN NULL ELSE A.PersonalI3D END AS EditorI3D
	,A.MwStAusweisen AS ExclusiveOfVAT
	,A.Status AS State
	,ZK.I3D AS PaymentConditionI3D
	,ZK.Kurztext AS PaymentCondition
	,A.Empfanger AS DeliveryAddress
	,A.Empfanger AS InvoiceAddress
	,SUM(AP.NetPriceTotal) AS NetPrice
	,SUM(AP.TaxPriceTotal) AS TaxPrice
	,SUM(AP.NetPriceTotalComplete) AS NetPriceComplete
	,SUM(AP.TaxPriceTotalComplete) AS TaxPriceComplete
	,SUM(AP.NetPriceTotalFC) AS NetPriceFC
	,SUM(AP.TaxPriceTotalFC) AS TaxPriceFC
	,SUM(AP.NetPriceTotalFCComplete) AS NetPriceFCComplete
	,SUM(AP.TaxPriceTotalFCComplete) AS TaxPriceFCComplete
	,SUM(AP.InsuranceNetPriceTotalComplete) AS InsuranceNetPriceComplete
	,SUM(AP.InsuranceTaxPriceTotalComplete) AS InsuranceTaxPriceComplete
	,SUM(AP.InsuranceNetPriceTotalFCComplete) AS InsuranceNetPriceFCComplete
	,SUM(AP.InsuranceTaxPriceTotalFCComplete) AS InsuranceTaxPriceFCComplete
	,SUM(AP.FreightNetPriceTotalComplete) AS FreightNetPriceComplete
	,SUM(AP.FreightTaxPriceTotalComplete) AS FreightTaxPriceComplete
	,SUM(AP.FreightNetPriceTotalFCComplete) AS FreightNetPriceFCComplete
	,SUM(AP.FreightTaxPriceTotalFCComplete) AS FreightTaxPriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(A.Bar,0) AS IsCashAsset
	,A.DTAusErstellt AS DTOutCreated
	,A.DTAusDatum AS DTOutCreatedDate
	,A.DTAusBearbeiter AS DTOutCreatedFromI3D
	,ROUND(A.Bezahlt,2) AS Payed
	,A.SeparateFracht AS FreightAsOwnPosition
	,A.SeparateVersicherung AS InsuranceAsOwnPosition
FROM dbo.KalkKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftI3D = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonI3D = Pers.I3D
LEFT OUTER JOIN dbo.cvw_SupplierInvoiceHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kreditor AS K ON A.KreditorI3D = K.I3D
LEFT OUTER JOIN dbo.Zahkond AS ZK ON ZK.I3D = A.ZahlKondI3D
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.RechnungsNr
	,A.RechnungsDatum
	,A.Empfanger
	,ZK.Kurztext
	,A.Status
	,A.LieferscheinDatum
	,A.Version
	,A.KreditorI3D
	,A.PersonalI3D
	,A.MwStAusweisen
	,K.Name
	,ZK.I3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,A.DTAusErstellt
	,A.DTAusDatum
	,A.DTAusBearbeiter
	,A.Bezahlt
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
	,A.SeparateFracht
	,A.SeparateVersicherung
GO
/****** Object:  Table [dbo].[AssetManagementCheckResults]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCheckResults](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CheckConfigurationID] [int] NULL,
	[State] [nvarchar](50) NULL,
	[Resolved] [nvarchar](50) NULL,
	[Message] [nvarchar](max) NULL,
	[Date] [datetime] NULL,
	[ActualResultValue] [nvarchar](256) NULL,
	[OriginalValue] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AMCheckConfigurationsOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AMCheckConfigurationsOverview]
        AS
	      SELECT dbo.AssetManagementCheckConfigurations.I3D, dbo.AssetManagementCheckConfigurations.CheckID, dbo.AssetManagementCheckConfigurations.Status, 
			      dbo.AssetManagementCheckConfigurations.StartTime, dbo.AssetManagementCheckConfigurations.IntervalKind, dbo.AssetManagementCheckConfigurations.IntervalInMinutes,
			      dbo.AssetManagementCheckConfigurations.DeviceId, dbo.AssetManagementCheckConfigurations.IsNewCheck, dbo.AssetManagementCheckConfigurations.CheckType, 
			      dbo.AssetManagementCheckConfigurations.NoAlertFrom, dbo.AssetManagementCheckConfigurations.NoAlertTo, dbo.AssetManagementCheckConfigurations.IsPicked, 
			      dbo.AssetManagementCheckConfigurations.PickedDateTime, dbo.AssetManagementDevices.KundenI3D AS CustomerI3D, dbo.AssetManagementDevices.ShortName AS DeviceName, 
			      dbo.AssetManagementDevices.DeviceClass, dbo.AssetManagementDevices.IsOnline, dbo.Kunden.Name AS CustomerName
	      FROM dbo.AssetManagementCheckConfigurations INNER JOIN 
		      dbo.AssetManagementCheckResults ON dbo.AssetManagementCheckConfigurations.I3D = dbo.AssetManagementCheckResults.CheckConfigurationID INNER JOIN
		      (SELECT CheckConfigurationID, MAX(Date) AS MaxDate FROM dbo.AssetManagementCheckResults AS AssetManagementCheckResults_1 
			      GROUP BY CheckConfigurationID) AS MaxInner ON dbo.AssetManagementCheckResults.CheckConfigurationID = MaxInner.CheckConfigurationID AND 
			      dbo.AssetManagementCheckResults.Date = MaxInner.MaxDate INNER JOIN
			      dbo.AssetManagementDevices ON dbo.AssetManagementCheckConfigurations.DeviceId = dbo.AssetManagementDevices.I3D INNER JOIN
			      dbo.Kunden ON dbo.AssetManagementDevices.KundenI3D = dbo.Kunden.I3D
			      WHERE (dbo.Kunden.Status = 1) AND (dbo.Kunden.Gesperrt IS NULL OR dbo.Kunden.Gesperrt = 0)
      
GO
/****** Object:  Table [dbo].[LiGutKopf]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiGutKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kalkulationsart] [int] NULL,
	[Nummer] [int] NULL,
	[Datum] [datetime] NULL,
	[KreditorI3D] [int] NULL,
	[Empfanger] [varchar](500) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Tel] [varchar](30) NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[WaehrungI3D] [int] NULL,
	[WaherungKursZuEuro] [float] NULL,
	[Notiz] [text] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[LockUserI3D] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[Status] [int] NULL,
	[LieferscheinNr] [varchar](500) NULL,
	[LieferscheinDatum] [datetime] NULL,
	[RechnungsNr] [varchar](50) NULL,
	[RechnungsDatum] [datetime] NULL,
	[Nettobetrag] [float] NULL,
	[Frachtkosten] [float] NULL,
	[Versicherung] [float] NULL,
	[ZahlKondI3D] [int] NULL,
	[ZahlKondText] [varchar](255) NULL,
	[NettobetragGesamt] [float] NULL,
	[BruttobetragGesamt] [float] NULL,
	[MwStAusweisen] [int] NULL,
	[LandI3D] [int] NULL,
	[LinFracht] [int] NULL,
	[LinVersicherung] [int] NULL,
	[Fracht] [float] NULL,
	[FrachtFreiAb] [float] NULL,
	[Mindestbestellwert] [float] NULL,
	[Mindermengenzuschlag] [float] NULL,
	[FaelligAm] [datetime] NULL,
	[Bezahlt] [float] NULL,
	[ZahlungsabgangNichtAnzeigen] [int] NULL,
	[GutschriftBetrag] [float] NULL,
	[DTAusErstellt] [int] NULL,
	[DTAusDatum] [datetime] NULL,
	[DTAusBearbeiter] [int] NULL,
	[SummeNetto] [float] NULL,
	[FrachtVerteilung] [int] NULL,
	[VersicherungsVerteilung] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[DTInErstellt] [int] NULL,
	[DTInDatum] [datetime] NULL,
	[DTInBearbeiter] [int] NULL,
	[DocDirI3D] [int] NULL,
	[AktuelleVersion] [int] NULL,
	[WiedervorlageDatum] [datetime] NULL,
	[WiedervorlageToDoI3D] [int] NULL,
	[Version] [int] NULL,
	[WertstellungsDatum] [datetime] NULL,
	[GutschriftsNr] [varchar](50) NULL,
	[GutschriftsDatum] [datetime] NULL,
	[LiGutschriftGrundI3D] [int] NULL,
	[LiGutschriftGrundText] [varchar](500) NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[VarFeld1] [varchar](40) NULL,
	[FIBUSammelkonto] [varchar](24) NULL,
	[SeparateVersicherung] [bit] NULL,
	[SeparateFracht] [bit] NULL,
	[BranchI3D] [int] NULL,
	[BranchOrigin] [int] NULL,
	[Street] [nvarchar](50) NULL,
	[HasPostOfficeBox] [int] NULL,
	[PostOfficeBox] [nvarchar](50) NULL,
	[Zip] [nvarchar](50) NULL,
	[City] [nvarchar](50) NULL,
	[ContactName] [nvarchar](128) NULL,
	[ChangedThroughApplication] [int] NULL,
	[ConcurrencyControlGuid] [uniqueidentifier] NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LiGutPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiGutPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LiGutKopfI3D] [int] NULL,
	[Version] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[Text] [varchar](5000) NULL,
	[Kreditorcode] [varchar](100) NULL,
	[Hersteller] [varchar](100) NULL,
	[Herstellercode] [varchar](100) NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[BlockID] [int] NULL,
	[Stk] [float] NULL,
	[Menge] [float] NULL,
	[StkWareneingang] [float] NULL,
	[Preis] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[MwStSatz] [float] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Art] [int] NULL,
	[Freitext] [varchar](5000) NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[UebernommenAusI3D] [int] NULL,
	[UebernommenAusArt] [int] NULL,
	[UebernommenInI3D] [int] NULL,
	[UebernommenInArt] [int] NULL,
	[Status] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[LieferDatumSoll] [datetime] NULL,
	[LieferDatumIst] [datetime] NULL,
	[Gebucht] [int] NULL,
	[LieferscheinNr] [varchar](500) NULL,
	[LieferscheinDatum] [datetime] NULL,
	[Fracht] [float] NULL,
	[Versicherung] [float] NULL,
	[EKAusAufPosI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[Masseinheit] [int] NULL,
	[Dimension] [int] NULL,
	[GewProEinheit] [float] NULL,
	[MwStI3D] [int] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[Beschaffenheit] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[Abbuchung] [varchar](1) NULL,
	[StkKalkuliert] [float] NULL,
	[EANCode] [varchar](70) NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[BestellnrKunde] [varchar](50) NULL,
	[AuftProj] [varchar](50) NULL,
	[RMAPosI3D] [int] NULL,
	[KalkKopfI3D] [int] NULL,
	[StkBestellt] [float] NULL,
	[ExportDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_SupplierCreditVoucherPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierCreditVoucherPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5,11,12) THEN AP.Text ELSE AP.Freitext END AS Text
	,NULL AS RichText
	,AP.BestellNrKunde AS PurchaseOrderNumber
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.LieferdatumSoll AS DeliveryDate
	,0 AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,NULL AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,AP.LiGutKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotalComplete AS NetPriceTotal
	, Calc.TaxPriceTotalComplete AS TaxPriceTotal
	, Calc.NetPriceTotalFCComplete AS NetPriceTotalFC
	, Calc.TaxPriceTotalFCComplete AS TaxPriceTotalFC
	,0 AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStAusweisen = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.LiGutPos AS AP
INNER JOIN dbo.LiGutKopf AS A ON AP.LiGutKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Art IN (1,3,11,12) THEN 1 ELSE 0 END
	,CASE WHEN AP.Art IN (1,3,11,12) AND AP.Expanded IS NULL THEN 1 ELSE 0 END
	,AP.Preis * -1, 0, ISNULL(AR.Nachkommastellen,2), 0, A.CurrencyFactor, CONVERT(bit,ISNULL(A.MwStAusweisen,0)), AP.MwstSatz, ISNULL(A.Bar,0), AP.Stk, 0) AS Calc
GO
/****** Object:  Table [dbo].[WAREN]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WAREN](
	[Warengruppe] [smallint] NULL,
	[Bezeichnung] [varchar](40) NULL,
	[Aufschlag_1] [float] NULL,
	[Aufschlag_2] [float] NULL,
	[Aufschlag_3] [float] NULL,
	[Aufschlag_4] [float] NULL,
	[Aufschlag_EVK] [float] NULL,
	[Aufschlag_Minpreis] [float] NULL,
	[Einheit] [varchar](50) NULL,
	[Kommisionieren] [int] NULL,
	[LagerortI3D] [int] NULL,
	[LagerplatzI3D] [int] NULL,
	[EinheitI3D] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[ErloesKTO] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Nachkommastellen] [int] NULL,
	[ProvProz] [float] NULL,
	[ProvArt] [int] NULL,
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[LagerI3D] [int] NULL,
	[Lieferzeit] [int] NULL,
	[VPE] [int] NULL,
	[TextAenderbar] [int] NULL,
	[WebAenderbar] [int] NULL,
	[SNbeiWarenabgang] [int] NULL,
	[Lieferbar] [int] NULL,
	[EKgleichVK] [int] NULL,
	[Abbuchung] [int] NULL,
	[Teilbar] [int] NULL,
	[Montieren] [int] NULL,
	[Garantie1Wert] [int] NULL,
	[Garantie1Art] [int] NULL,
	[Garantie2Wert] [int] NULL,
	[Garantie2Art] [int] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EOLauto] [int] NULL,
	[Preisupdate] [int] NULL,
	[EUErloesKTO] [int] NULL,
	[AuslandErloesKTO] [int] NULL,
	[KostenstelleI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[VarAttributes] [int] NULL,
	[KeinMischEK] [int] NULL,
	[FremdwaehrungLandI3D] [int] NULL,
	[ProduktfamilienPflicht] [int] NULL,
	[EUAufwandKTO] [int] NULL,
	[AuslandAufwandKTO] [int] NULL,
	[EVPAlsVKEintragen] [int] NULL,
	[MwstI3D] [int] NULL,
	[KeineFracht] [int] NULL,
	[PauschalWarengruppe] [int] NULL,
	[StandardErtrag] [float] NULL,
	[NormAbwErtrag] [float] NULL,
	[VK1_ErtragBasis] [int] NULL,
	[VK2_ErtragBasis] [int] NULL,
	[VK3_ErtragBasis] [int] NULL,
	[VK4_ErtragBasis] [int] NULL,
	[RCAufwandKTO] [int] NULL,
	[RCErloesKTO] [int] NULL,
	[isReverseCharge] [bit] NULL,
	[IsWithCounter] [bit] NULL,
	[isMietPortal] [bit] NULL,
	[IsServiceArticle] [bit] NULL,
	[NeedsCustomClearance] [bit] NOT NULL,
	[KulanzWarengruppe] [bit] NOT NULL,
	[NotDiscountable] [bit] NULL,
	[TelekomDiveMaterialGroup] [int] NULL,
	[IsObligatoryBooking] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelZubehoer]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelZubehoer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerArtikelI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelZubehoer] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AufPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AufKopfI3D] [int] NOT NULL,
	[VertragI3D] [int] NULL,
	[VertragArt] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[Kommisioniert] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockId] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Status] [int] NULL,
	[UrsprungAngNr] [int] NULL,
	[RechLiefNr] [int] NULL,
	[RechLiefArt] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellPos] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[EKStkBestellt] [float] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[OriginalI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungPosI3D] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[VKBasisWert] [float] NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[RMAPosI3D] [int] NULL,
	[HerstellerI3D] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[RundungsDiff] [float] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[EkStkGebucht] [float] NULL,
	[IsBillingPartList] [bit] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalComplete] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFCComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFCComplete] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFCComplete] [decimal](19, 2) NULL,
	[PurchasePriceSupplierI3D] [int] NULL,
	[InternalNote] [nvarchar](max) NULL,
	[PlannedDurationInHours] [decimal](19, 7) NOT NULL,
	[BVLInfo] [nvarchar](500) NULL,
	[LizenzDatum] [datetime2](0) NULL,
	[Direktlieferung] [int] NULL,
	[LieferMenge_old] [float] NULL,
	[Liefermenge]  AS ([dbo].[cfn_DeliveryCount]([I3D])),
	[IsReverseCharge] [bit] NULL,
	[isLeasing] [int] NULL,
	[isService] [int] NULL,
 CONSTRAINT [PK_AufPos] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [ixAufPos_AufKopfI3D]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixAufPos_AufKopfI3D] ON [dbo].[AufPos]
(
	[AufKopfI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Hersteller]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Hersteller](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Hersteller] [varchar](500) NULL,
	[Status] [int] NULL,
	[KreditorI3D] [int] NULL,
	[EDI1] [int] NULL,
	[EDI1User] [varchar](250) NULL,
	[EDI1Pass] [varchar](250) NULL,
	[EDI2] [int] NULL,
	[EDI2User] [varchar](250) NULL,
	[EDI2Pass] [varchar](250) NULL,
	[EDI3] [int] NULL,
	[EDI3User] [varchar](250) NULL,
	[EDI3Pass] [varchar](250) NULL,
	[EDI4] [int] NULL,
	[EDI4User] [varchar](250) NULL,
	[AnschriftI3D] [int] NULL,
	[AnsprechI3D] [int] NULL,
	[EDI4Pass] [varchar](250) NULL,
	[EOrderInterface] [int] NULL,
	[EOrderUser] [varchar](250) NULL,
	[EOrderPass] [varchar](250) NULL,
	[EOrderZugangsCode] [varchar](250) NULL,
	[EOrderSenderID] [varchar](250) NULL,
	[EOrderKundennummer] [varchar](250) NULL,
	[EDI5] [int] NULL,
	[EDI5User] [varchar](250) NULL,
	[EDI5Pass] [varchar](250) NULL,
	[EDI3Laendercode] [varchar](250) NULL,
	[EDI3Branchennummer] [varchar](250) NULL,
	[EDIUserTest] [varchar](250) NULL,
	[EDIPassTest] [varchar](250) NULL,
	[EDI10] [int] NULL,
	[EDI10User] [varchar](250) NULL,
	[EDI10Pass] [varchar](250) NULL,
	[EDI12] [int] NULL,
	[EDI12User] [varchar](250) NULL,
	[EDI12Pass] [varchar](250) NULL,
 CONSTRAINT [Hersteller_pk] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [ixHersteller_I3D]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixHersteller_I3D] ON [dbo].[Hersteller]
(
	[I3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerArtik]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerArtik](
	[I3D0] [int] IDENTITY(1,1) NOT NULL,
	[I3D] [int] NOT NULL,
	[Code] [varchar](100) NULL,
	[HEK] [float] NULL,
	[VK] [float] NULL,
	[Verfuegbarkeit] [varchar](50) NULL,
	[Hersteller] [varchar](100) NULL,
	[Sprache] [char](10) NULL,
	[EANCODE] [varchar](50) NULL,
	[Nachfolger] [char](20) NULL,
	[Garantie] [varchar](50) NULL,
	[SpezialEK] [char](100) NULL,
	[SpezialEKgiltBis] [datetime] NULL,
	[Hoehe] [char](10) NULL,
	[Breite] [char](10) NULL,
	[Laenge] [char](10) NULL,
	[Gewicht] [char](10) NULL,
	[Datenblatt] [varchar](255) NULL,
	[Bild] [varchar](255) NULL,
	[HEKRoh] [float] NULL,
	[KreditorNr] [varchar](50) NULL,
	[Hauptartikel] [varchar](50) NULL,
	[Zubehoerartikel] [varchar](50) NULL,
	[NettoGewicht] [float] NULL,
	[Text] [varchar](8000) NULL,
	[ImportDatum] [datetime] NULL,
	[EGISNummer] [varchar](30) NULL,
	[Produktlinie] [varchar](50) NULL,
	[EVP] [float] NULL,
	[Listenpreis] [float] NULL,
	[HerstellerWarenWgI3D] [int] NULL,
	[HerstellerWarenUwg1I3D] [int] NULL,
	[HerstellerWarenUwg2I3D] [int] NULL,
	[VerfuegbarkeitStk] [float] NULL,
	[Status] [int] NULL,
	[Verpackungsmenge] [float] NULL,
	[Mindestbestellmenge] [float] NULL,
 CONSTRAINT [PK_HerstellerArtik] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC,
	[I3D0] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [IX_HerstellerArtik_I3D0_Unique] UNIQUE NONCLUSTERED 
(
	[I3D0] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MwstSatz]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MwstSatz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Mwst] [float] NULL,
	[Text] [varchar](60) NULL,
	[LandID] [int] NULL,
	[Status] [int] NULL,
	[Lieferkond] [varchar](5) NULL,
	[KtoInland] [varchar](50) NULL,
	[KtoEU] [varchar](50) NULL,
	[KtoNonEU] [varchar](50) NULL,
	[ErloesKTO] [int] NULL,
	[ErloesKTODeak] [int] NULL,
	[LandI3D] [int] NULL,
	[MwstStandard] [int] NULL,
	[Steuerkennziffer] [varchar](24) NULL,
	[AufwandKTO] [int] NULL,
	[AufwandKTODeak] [int] NULL,
	[Konto] [varchar](50) NULL,
	[ErstelltDurch] [int] NULL,
	[AblaufDatum] [datetime] NULL,
	[FolgeMWStI3D] [int] NULL,
	[SteuerKZEinkauf] [varchar](24) NULL,
	[VerwFuerMwStNichtAusweisbar] [int] NULL,
	[GueltigAb] [datetime] NULL,
 CONSTRAINT [PK_MwstSatz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Laenkenn]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Laenkenn](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Land] [varchar](255) NULL,
	[PlzKurz] [varchar](3) NULL,
	[Vorwahl] [varchar](16) NULL,
	[Status] [int] NULL,
	[Kurzzeichen] [varchar](3) NULL,
	[Nummer] [varchar](3) NULL,
	[Waehrung] [varchar](60) NULL,
	[Zeichen] [varchar](5) NULL,
	[RWZeichen] [varchar](50) NULL,
	[KursZuEur] [float] NULL,
	[Kurztext] [varchar](25) NULL,
	[MwstArt] [int] NULL,
	[Flagge] [image] NULL,
	[FlaggeExt] [varchar](50) NULL,
	[MenueVerfueg] [int] NULL,
	[MwstAktiv] [int] NULL,
	[ErloesKTO] [int] NULL,
	[Standard] [int] NULL,
	[ErloesKTOFremd] [int] NULL,
	[MWStKTOFremd] [int] NULL,
	[MWStFremd] [float] NULL,
	[AufwandKTO] [int] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[EUMitglied] [int] NULL,
	[ErstelltDurch] [int] NULL,
	[ISOCodeNummerisch] [nvarchar](10) NULL,
 CONSTRAINT [PK_Laenkenn] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerWaren]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerWaren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HerstellerI3D] [int] NULL,
	[WG] [varchar](40) NULL,
	[UWG1] [varchar](40) NULL,
	[UWG2] [varchar](40) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NebenlagerArtikel]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NebenlagerArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MandantI3D] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Bestand] [float] NULL,
	[Zulauf] [float] NULL,
	[Mindestbestand] [float] NULL,
	[Reparaturbestand] [float] NULL,
	[LagerortI3D] [int] NULL,
	[LagerplatzI3D] [int] NULL,
	[DirektFakturierung] [int] NULL,
	[EigenerEK] [int] NULL,
	[EK] [float] NULL,
	[Lagerwert] [float] NULL,
	[AngelegtVon] [int] NULL,
	[AngelegtAm] [datetime] NULL,
	[RohEK1] [float] NULL,
	[RohEK1Datum] [datetime] NULL,
	[RohEK2] [float] NULL,
	[RohEK2Datum] [datetime] NULL,
	[RohEK1I3D] [int] NULL,
	[RohEK1Art] [int] NULL,
	[RohEK2I3D] [int] NULL,
	[RohEK2Art] [int] NULL,
	[AuftragsBestand_alt] [float] NULL,
	[LieferBestand_alt] [float] NULL,
	[LieferBestand]  AS ([dbo].[cfn_LieferBestand]([ArtikelI3D],[NebenlagerI3D])),
	[AuftragsBestand]  AS ([dbo].[cfn_AuftragsBestand]([ArtikelI3D],[NebenlagerI3D])),
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Barcode]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Barcode](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BestPosI3D] [int] NULL,
	[GeraetePosI3D] [int] NULL,
	[Barcode] [varchar](200) NULL,
	[Import] [int] NULL,
	[Status] [int] NULL,
	[AufPosI3D] [int] NULL,
	[Auftragsnummer] [int] NULL,
	[LiefPosI3D] [int] NULL,
	[Lieferscheinnummer] [int] NULL,
	[RechPosI3D] [int] NULL,
	[Rechnungsnummer] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[ErstellerKurzZeich] [varchar](50) NULL,
	[ErstellDatum] [datetime] NOT NULL,
	[VerlustInventurI3D] [int] NULL,
	[BarcodeImport] [varchar](50) NULL,
	[RepNummer] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[BestPosKonv] [int] NULL,
	[KundenRMANummer] [int] NULL,
	[SNStueckliste] [int] NULL,
	[OwnerPosI3D] [int] NULL,
	[SystemIdentNr] [int] NULL,
	[Beschreibung] [varchar](255) NULL,
	[Lagerauftragsnummer] [int] NULL,
	[LagerAufPosI3D] [int] NULL,
	[GeraeteKopfNummer] [int] NULL,
	[LagerI3D] [int] NULL,
	[BarcodeConditionI3D] [int] NULL,
	[IsInRma] [bit] NOT NULL,
	[SupplierInvoicePositionI3D] [int] NULL,
 CONSTRAINT [Barcode_pk] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_BarcodeCount]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_BarcodeCount]  
WITH SCHEMABINDING
AS
SELECT b.ArtikelI3D, ISNULL(b.LagerI3D,-1) LagerI3D, COUNT_BIG(*) cnt 
 FROM dbo.Barcode b 
WHERE b.Status in (1,2,8)
GROUP BY  b.ArtikelI3D,ISNULL(b.LagerI3D,-1)
GO
/****** Object:  Table [dbo].[Warehouses]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Warehouses](
	[I3D] [int] NOT NULL,
	[Number] [int] NOT NULL,
	[Caption] [nvarchar](255) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[IsOwnPurchasePriceActive] [bit] NOT NULL,
	[CostCenterI3D] [int] NULL,
	[BookKeepingAccount] [nvarchar](32) NULL,
	[WarehouseKind] [int] NULL,
 CONSTRAINT [PK_Warehouses] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_ArticleCount]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ArticleCount] AS
 SELECT
 a.i3d ArtikelI3D,
 - 1 LagerI3D,
 0 WarehouseKind,
 CASE WHEN a.BarcodeScanen = 1 AND s.Wert = 1 THEN ISNULL(bc.cnt, 0) ELSE a.Menge END cnt
 FROM Artik a 
 LEFT JOIN cvw_BarcodeCount bc ON bc.ArtikelI3D = a.I3D AND bc.LagerI3D = - 1
 INNER JOIN Stammdat s ON s.I3D = 1490
 UNION
 SELECT
 na.ArtikelI3D,
 na.NebenlagerI3D,
 WH.WarehouseKind,
 CASE WHEN a.BarcodeScanen = 1 AND s.Wert = 1  THEN ISNULL(bc.cnt, 0) ELSE na.Bestand END cnt
 FROM NebenlagerArtikel na
 INNER JOIN Warehouses WH ON WH.I3D = NA.NebenlagerI3D AND WH.I3D > 0
 INNER JOIN Artik A ON a.I3d = na.ArtikelI3D AND na.NebenlagerI3D > 0
 LEFT JOIN cvw_BarcodeCount bc ON bc.ArtikelI3D = na.ArtikelI3D AND bc.LagerI3D = na.NebenlagerI3D
 INNER JOIN Stammdat s ON s.I3D = 1490
GO
/****** Object:  Table [dbo].[ArtikelEinheit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelEinheit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[KurzText] [varchar](30) NULL,
	[Bezeichnung] [varchar](80) NULL,
	[VPE] [float] NULL,
	[Standard] [int] NULL,
	[Status] [int] NULL,
	[Zeiteinheit] [int] NULL,
	[FaktorZuSekunde] [int] NULL,
	[UNECECode] [nvarchar](10) NULL,
 CONSTRAINT [PK_ArtikelEinheit] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[UNTERWAREN]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UNTERWAREN](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WARENI3D] [int] NULL,
	[Text] [varchar](250) NULL,
	[ErloesKTO] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[Nachkommastellen] [int] NULL,
	[Status] [int] NULL,
	[LagerI3D] [int] NULL,
	[LagerortI3D] [int] NULL,
	[LagerplatzI3D] [int] NULL,
	[Lieferzeit] [int] NULL,
	[VPE] [int] NULL,
	[EinheitI3D] [int] NULL,
	[TextAenderbar] [int] NULL,
	[WebAenderbar] [int] NULL,
	[SNbeiWarenabgang] [int] NULL,
	[Lieferbar] [int] NULL,
	[EKgleichVK] [int] NULL,
	[Abbuchung] [int] NULL,
	[Teilbar] [int] NULL,
	[Kommisionieren] [int] NULL,
	[Montieren] [int] NULL,
	[Garantie1Wert] [int] NULL,
	[Garantie1Art] [int] NULL,
	[Garantie2Wert] [int] NULL,
	[Garantie2Art] [int] NULL,
	[WarengruppenI3D] [int] NULL,
	[Aufschlag_1] [float] NULL,
	[Aufschlag_2] [float] NULL,
	[Aufschlag_3] [float] NULL,
	[Aufschlag_4] [float] NULL,
	[Aufschlag_EVK] [float] NULL,
	[Aufschlag_MinPreis] [float] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EUErloesKTO] [int] NULL,
	[AuslandErloesKTO] [int] NULL,
	[EOLauto] [int] NULL,
	[Preisupdate] [int] NULL,
	[KostenstelleI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[VarAttributes] [int] NULL,
	[KeinMischEK] [int] NULL,
	[FremdwaehrungLandI3D] [int] NULL,
	[ProduktfamilienPflicht] [int] NULL,
	[EUAufwandKTO] [int] NULL,
	[AuslandAufwandKTO] [int] NULL,
	[EVPAlsVKEintragen] [int] NULL,
	[MwstI3D] [int] NULL,
	[KeineFracht] [int] NULL,
	[RCAufwandKTO] [int] NULL,
	[RCErloesKTO] [int] NULL,
	[isReverseCharge] [bit] NULL,
	[IsWithCounter] [bit] NULL,
	[isMietPortal] [bit] NULL,
	[IsServiceArticle] [bit] NULL,
	[NeedsCustomClearance] [bit] NOT NULL,
	[KulanzWarengruppe] [bit] NOT NULL,
	[NotDiscountable] [bit] NULL,
	[TelekomDiveMaterialGroup] [int] NULL,
	[IsObligatoryBooking] [bit] NULL,
 CONSTRAINT [PK_UNTERWAREN] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_ArticleSearch]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ArticleSearch] AS
SELECT
	IsExternalArticle = CAST(0 AS BIT), 
	ExternalArticleKind = NULL,
	ExternalArticleId = NULL,
    ExternalArticlePublicId = NULL,
	DistributorI3D = 1, 
	Distributor = 'Eigene',
	I3D = a.I3D, 
	ArticleCode = a.Artikelcode, 
	EANCode = a.EANCode, 
	ManufacturerCode = a.Hersteller, 
	Caption = a.Kurzbegriff, 
	Description = a.Artikelbeschreibung, 
	Manufacturer = K.Name, 
	Quantity = CONVERT(decimal(24, 8), M.Menge),
	QuantityAvailable = CONVERT(decimal(24, 8), M.Menge - ISNULL(MA.Menge, 0)),
	MaterialGroupI3D = w.I3D, 
	MaterialGroupCaption = w.Bezeichnung, 
	SubMaterialGroup1I3D = uw.I3D, 
	SubMaterialGroup1Caption = uw.Text, 
	SubMaterialGroup2I3D = NULL, 
	SubMaterialGroup2Caption = NULL, 
	IsEndOfLifeArticle = CAST(ISNULL(a.EOL, 0) AS BIT),
	SalePrice1 = CONVERT(decimal(24, 8), ISNULL(a.VK_1, 0)), 
	SalePrice2 = CONVERT(decimal(24, 8), ISNULL(a.VK_2, 0)),
	SalePrice3 = CONVERT(decimal(24, 8), ISNULL(a.VK_3, 0)),
	SalePrice4 = CONVERT(decimal(24, 8), ISNULL(a.VK_4, 0)),
	RecommendedSalePrice = CONVERT(decimal(24, 8), ISNULL(A.EVK, 0)),
    ListPrice = CONVERT(decimal(24, 8), ISNULL(A.Listenpreis, 0)),
	PurchasePrice = CONVERT(decimal(24, 8), ISNULL(a.EK, 0)),
	CurrencyFactorI3D = a.FremdwaehrungLandI3D,
	CurrencyFactor = CONVERT(decimal(24, 8), ISNULL(a.FremdwaehrungFaktor, 0)),
	Precision = ISNULL(a.Nachkommastellen, 2),
	VatRate = CONVERT(decimal(24, 8), a.Mwst_Satz),
	VatI3D = a.MwstI3D,
	HasAdditionalArticles = CAST(ISNULL(AZ.HatZubehoer,0) AS BIT),
    SerialNumbersAreMandatory = CAST(ISNULL(a.BarcodeScanen, 0) AS BIT),
    IsTextEditable = CAST(ISNULL(a.TextAenderbar, 1) AS BIT),
	IsPartList = CAST(ISNULL(a.StkListe, 0) AS BIT),
    DefaultArticleSearchQuantity = IIF(a.DefaultArticleSearchQuantity <= 0, 1, a.DefaultArticleSearchQuantity),
	CreatedDate = A.Angelegt_am,
	Changeddate = A.Geandert_am,
	unit.KurzText AS ArticleUnitShortCaption,
    StorePlaceI3D = A.LagerortI3D,
    StorePositionI3D = A.LagerplatzI3D
FROM            
	ARTIK A 
INNER JOIN WAREN W ON W.Warengruppe = A.Warengruppe 
LEFT OUTER JOIN UNTERWAREN UW ON UW.I3D = A.WEBKategorie 
LEFT OUTER JOIN Kreditor K ON K.I3D = A.KreditorI3D
LEFT OUTER JOIN Hersteller H ON A.Hersteller = H.Hersteller
INNER JOIN (
	SELECT 
		Menge = Sum(cnt), 
		AC.ArtikelI3D 
	FROM
		cvw_ArticleCount AC 
	INNER JOIN (SELECT	(SELECT ISNULL(Wert, 0) FROM Stammdat WHERE i3D = 867)  AS RMA1, 
						(SELECT ISNULL(Wert, 0) FROM Stammdat WHERE i3D = 997)  AS RMA2, 
						(SELECT ISNULL(Wert, 0) FROM Stammdat WHERE i3D = 998)  AS RMA3,
						(SELECT ISNULL(Wert, 0) FROM Stammdat WHERE i3D = 1026) AS RMA4) AS LF ON LF.RMA1 <> AC.LagerI3D AND LF.RMA2 <> AC.LagerI3D AND LF.RMA3 <> AC.LagerI3D AND AC.LagerI3D <> LF.RMA4
	GROUP BY ArtikelI3D
) M on M.ArtikelI3D = A.I3D
LEFT OUTER JOIN (
	SELECT 
		Menge = SUM(ap.Stk - ISNULL(ap.Liefermenge,0)),
		ap.ArtikelI3D
	FROM 
		AufPos ap 
	INNER JOIN 
		AufKopf ak ON ak.I3D = ap.AufKopfI3D 
	WHERE 
		ak.Status = 1
	GROUP BY 
		ap.ArtikelI3D
) MA on MA.ArtikelI3D = A.I3D
LEFT OUTER JOIN (
	SELECT
		ArtikelI3D = AZ.OwnerArtikelI3D,
		HatZubehoer = CASE WHEN COUNT(AZ.ArtikelI3D) > 0 THEN 1 ELSE 0 END
	FROM
		ArtikelZubehoer AZ
	GROUP BY 
		AZ.OwnerArtikelI3D
) AS AZ ON AZ.ArtikelI3D = A.I3D
LEFT OUTER JOIN ArtikelEinheit unit ON unit.I3D = A.Einheit

UNION ALL

SELECT        
	IsExternalArticle = CAST(1 AS BIT), 
	ExternalArticleKind = 0,
	ExternalArticleId = HA.KreditorNr,
    ExternalArticlePublicId = HA.KreditorNr,
	DistributorI3D = H.I3D, 
	Distributor = H.Hersteller,
	I3D = HA.I3D0, 
	ArticleCode = NULL, 
	EANCode = HA.EANCODE, 
	ManufacturerCode = HA.Code, 
	Caption = '', 
	Description = HA.Text, 
	Manufacturer = HA.Hersteller, 
	Quantity = CONVERT(decimal(24, 8), HA.VerfuegbarkeitStk),
	QuantityAvailable = 0,
	MaterialGroupI3D = HW.I3D, 
	MaterialGroupCaption = HW.WG, 
	SubMaterialGroup1I3D = 
		CASE WHEN ISNULL(HA.HerstellerWarenUwg1I3D, 0) <= 0 THEN 
			NULL 
		ELSE 
			HA.HerstellerWarenUwg1I3D 
		END,
	SubMaterialGroup1Caption = HW.UWG1, 
	SubMaterialGroup2I3D = 
		CASE WHEN ISNULL(HA.HerstellerWarenUwg2I3D, 0) <= 0 THEN 
			NULL 
		ELSE 
			HA.HerstellerWarenUwg2I3D 
		END, 
	SubMaterialGroup2Caption = HW.UWG2, 
	IsEndOfLifeArticle = CAST(0 AS BIT), 
	SalePrice1 = CONVERT(decimal(24, 8), ISNULL(HA.VK, 0)), 
	SalePrice2 = CONVERT(decimal(24, 8), ISNULL(HA.VK, 0)),
	SalePrice3 = CONVERT(decimal(24, 8), ISNULL(HA.VK, 0)),
	SalePrice4 = CONVERT(decimal(24, 8), ISNULL(HA.VK, 0)),
	RecommendedSalePrice = CONVERT(decimal(24, 8), ISNULL(HA.VK, 0)),
    ListPrice = CONVERT(decimal(24, 8), ISNULL(HA.VK, 0)),
	PurchasePrice = CONVERT(decimal(24, 8), ISNULL(HA.HEK, 0)),
	CurrencyFactorI3D = NULL,
	CurrencyFactor = CONVERT(decimal(24, 8), 1),
	Precision = 2,
	VatRate = CONVERT(decimal(24, 8), MS.Mwst),
	VatI3D = MS.I3D,
	HasAdditionalArticles = CAST(0 AS BIT),
    SerialNumbersAreMandatory = CAST(0 AS BIT),
    IsTextEditable = CAST(1 AS BIT),
	IsPartList = CAST(0 AS BIT),
    DefaultArticleSearchQuantity = 1,
	CreatedDate = ha.ImportDatum,
	ChangedDate = ha.ImportDatum,
	'' AS ArticleUnitShortCaption,
    NULL AS StorePlaceI3D,
    NULL AS StorePositionI3D
FROM HerstellerArtik HA 
LEFT OUTER JOIN HerstellerWaren HW ON HW.I3D = HA.HerstellerWarenWgI3D
INNER JOIN Hersteller H ON HA.I3D = H.I3D
JOIN (SELECT TOP 1 M.I3D, M.Mwst
FROM MwstSatz M
Join Laenkenn L ON L.I3D = M.LandI3D
WHERE M.MwstStandard = 1 AND L.Standard = 1) AS MS ON 1=1
GO
/****** Object:  View [dbo].[cvw_SupplierCreditVoucherHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierCreditVoucherHeadVATPriceSplit]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(DECIMAL(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
FROM dbo.cvw_SupplierCreditVoucherPos
WHERE Kind IN (1,3,11,12)
AND Expanded IS NULL
GROUP BY HeadI3D
	,VATI3D
	,VATRate
GO
/****** Object:  Table [dbo].[Bankverbindungen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Bankverbindungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[BankName] [varchar](60) NULL,
	[Strasse] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Zahlungsart] [int] NULL,
	[BLZ] [varchar](20) NULL,
	[Kontonummer] [varchar](50) NULL,
	[LandI3D] [int] NULL,
	[IBAN] [varchar](50) NULL,
	[SWIFT] [varchar](50) NULL,
	[ObjectI3D] [int] NULL,
	[ObjectArt] [int] NULL,
	[BankverbNummer] [int] NULL,
	[BIC] [nvarchar](64) NULL,
	[AuthorizationDate] [datetime] NULL,
	[ValidFrom] [datetime] NULL,
	[ValidTo] [datetime] NULL,
	[LastUsed] [datetime] NULL,
	[DirectDebitType] [int] NULL,
	[AuthorizationNumber] [nvarchar](64) NULL,
	[IsDefault] [bit] NULL,
	[Comment] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_BankAccounts]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_BankAccounts] AS 
SELECT I3D, Bezeichnung AS Caption, BankName, Strasse AS Street, Ort AS City, Zahlungsart AS PaymentKind,
 BLZ AS BankCodeNumber, Kontonummer AS BankAccountNumber, LandI3D AS CountryI3D, IBAN, BIC, 
 ObjectI3D, ObjectArt AS ObjectKind, BankverbNummer AS BankConnectionNumber 
 FROM dbo.Bankverbindungen 
      
GO
/****** Object:  Table [dbo].[AccountAddressContacts]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountAddressContacts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[AccountAddressI3D] [int] NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[SalutationI3D] [int] NULL,
	[Lastname] [nvarchar](60) NOT NULL,
	[Firstname] [nvarchar](60) NOT NULL,
	[Job] [nvarchar](100) NULL,
	[Phone1] [nvarchar](30) NULL,
	[Phone2] [nvarchar](30) NULL,
	[Phone3] [nvarchar](30) NULL,
	[Phone4] [nvarchar](30) NULL,
	[Phone5] [nvarchar](30) NULL,
	[Fax1] [nvarchar](30) NULL,
	[Fax2] [nvarchar](30) NULL,
	[Email1] [nvarchar](255) NULL,
	[Email2] [nvarchar](255) NULL,
	[IsMailingAtEmail1Active] [bit] NOT NULL,
	[IsMailingAtEmail2Active] [bit] NOT NULL,
	[Birthday] [date] NULL,
	[Comment] [nvarchar](2000) NULL,
	[DepartmentI3D] [int] NULL,
	[DepartmentText] [nvarchar](255) NULL,
	[CreatedByI3D] [int] NULL,
	[CreatedDate] [datetime2](7) NULL,
	[CreatedVersion] [nvarchar](16) NULL,
	[ChangedByI3D] [int] NULL,
	[ChangedDate] [datetime2](7) NULL,
	[ChangedVersion] [nvarchar](16) NULL,
	[Picture] [varbinary](max) NULL,
	[PictureExtension] [nvarchar](5) NULL,
	[VariableTextField01] [nvarchar](255) NULL,
	[VariableTextField02] [nvarchar](255) NULL,
	[OldReferenceI3D] [int] NULL,
	[OldReferenceKind] [int] NULL,
	[DefaultSubstitute] [bit] NOT NULL,
	[IsInvoiceMailCCReceiver] [bit] NOT NULL,
	[IsDsgvoDeleted] [bit] NULL,
	[DsgvoDeletedEmployeeI3D] [int] NULL,
	[DsgvoDeletedDate] [datetime2](0) NULL,
	[SID] [nvarchar](256) NULL,
	[SAMAccountName] [nvarchar](256) NULL,
	[SearchTag] [nvarchar](256) NULL,
	[DefaultTicket] [bit] NULL,
 CONSTRAINT [PK_AccountAddressContacts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Anrede]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Anrede](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Anrede] [varchar](50) NULL,
	[Briefanrede] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Anrede] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AccountActivitiesOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_AccountActivitiesOverview]
WITH SCHEMABINDING
AS
SELECT 
       AA.I3D
       ,AA.IsDone
       ,AA.ActivityKind
       ,AA.Caption
       ,AA.Text
       ,AA.ProjectNumber
       ,AA.DueDate
       ,AA.RecurrenceDate
       ,AA.DateFrom
       ,AA.DateTo
       ,AA.EditorI3D
       ,ISNULL(PEditor.KurzZeich,'') AS Editor
       ,AA.AccountI3D
       ,Acc.Name AS Account
       ,LTRIM(ISNULL(Anr.Anrede,'') + ' ' + ISNULL(AAC.Firstname,'') + ' ' + ISNULL(AAC.Lastname, '')) AS ContactName
       ,ISNULL(AAC.Phone1,'') AS ContactPhone1
       ,ISNULL(AAC.Email1,'') AS ContactEMail1
	   ,AAC.I3D AS ContactI3D
       ,AA.Rating
       ,AA.HasDocuments
       ,AA.CreatedByI3D
       ,ISNULL(PCreator.KurzZeich,'') AS CreatedBy
       ,AA.CreatedDate
	   ,Acc.SalesAreaI3D
	   ,Acc.Adviser1I3D
	   ,Acc.Adviser2I3D
	   ,Acc.Adviser3I3D
	   ,Acc.Adviser4I3D
	   ,Acc.Adviser5I3D
	   ,Acc.Adviser6I3D
	   ,AA.CampaignI3D
	   ,AA.ProcessActivityI3D
FROM dbo.AccountActivities AA
INNER JOIN dbo.Personal PEditor ON PEditor.I3D = AA.EditorI3D
INNER JOIN dbo.AccountAddressContacts AAC ON AAC.I3D = AA.AccountAddressContactI3D
LEFT OUTER JOIN dbo.Anrede Anr ON Anr.I3D = AAC.SalutationI3D
INNER JOIN dbo.Personal PCreator ON PCreator.I3D = AA.CreatedByI3D
INNER JOIN dbo.Accounts Acc ON Acc.I3D = AA.AccountI3D;
GO
/****** Object:  View [dbo].[cvw_ArticleSearchWarehouseQuantity]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ArticleSearchWarehouseQuantity] AS
WITH 
ArtikelMengeInAngebot AS
(
	SELECT 
		Menge = SUM(ap.Stk - ISNULL(ap.Liefermenge,0)),
		ap.ArtikelI3D,
		NebenlagerI3D = ISNULL(ap.NebenlagerI3D, -1)
	FROM 
		AufPos ap 
	INNER JOIN 
		AufKopf ak ON ak.I3D = ap.AufKopfI3D 
	WHERE 
		ak.Status = 1
	GROUP BY 
		ap.ArtikelI3D, ap.NebenlagerI3D
)

SELECT 
	IsExternalArticle = 0,
	ArticleI3D = AC.ArtikelI3D,
	WarehouseI3D = W.I3D,
	WarehouseName = W.Caption,
	Quantity = CONVERT(VARCHAR(50), ISNULL(AC.cnt, 0)),
	QuantityAvailable = CONVERT(VARCHAR(50), ISNULL(AC.cnt, 0) - ISNULL(AM.Menge, 0))
FROM
	cvw_ArticleCount AC
LEFT JOIN
	Warehouses W ON AC.LagerI3D = W.I3D
LEFT JOIN
	ArtikelMengeInAngebot AM ON AC.ArtikelI3D = AM.ArtikelI3D AND AC.LagerI3D = AM.NebenlagerI3D

UNION

SELECT 
	IsExternalArticle = 1,
	ArticleI3D = HA.I3D0,
	WarehouseI3D = 0,
	WarehouseName = 'Lieferant',
	Quantity = CONVERT(VARCHAR(50), ISNULL(HA.Verfuegbarkeit, 0)),
	QuantityAvailable = CONVERT(VARCHAR(50), ISNULL(HA.VerfuegbarkeitStk, 0))
FROM HerstellerArtik HA
      
GO
/****** Object:  View [dbo].[cvw_SupplierCreditVoucherHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_SupplierCreditVoucherHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.Datum AS Date
	,K.Name AS AddressName
	,A.GutschriftsNr AS SupplierReceiptNumber
	,A.GutschriftsDatum AS SupplierReceiptDate
	,A.LieferscheinDatum AS DeliveryDate
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,NULL AS BranchI3D
	,CASE WHEN A.KreditorI3D <= 0 THEN NULL ELSE A.KreditorI3D END AS AddressI3D
	,CASE WHEN A.PersonalI3D <= 0 THEN NULL ELSE A.PersonalI3D END AS EditorI3D
	,A.MwStAusweisen AS ExclusiveOfVAT
	,A.Status AS State
	,ZK.I3D AS PaymentConditionI3D
	,ZK.Kurztext AS PaymentCondition
	,A.Empfanger AS DeliveryAddress
	,A.Empfanger AS InvoiceAddress
	,SUM(AP.NetPriceTotal) AS NetPrice
	,SUM(AP.TaxPriceTotal) AS TaxPrice
	,SUM(AP.NetPriceTotalFC) AS NetPriceFC
	,SUM(AP.TaxPriceTotalFC) AS TaxPriceFC
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(A.Bar,0) AS IsCashAsset
	,A.DTAusErstellt AS DTOutCreated
	,A.DTAusDatum AS DTOutCreatedDate
	,A.DTAusBearbeiter AS DTOutCreatedFromI3D
	,ROUND(A.Bezahlt,2) AS Payed
FROM dbo.LiGutKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftI3D = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonI3D = Pers.I3D
LEFT OUTER JOIN dbo.cvw_SupplierCreditVoucherHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kreditor AS K ON A.KreditorI3D = K.I3D
LEFT OUTER JOIN dbo.Zahkond AS ZK ON ZK.I3D = A.ZahlKondI3D
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.GutschriftsNr
	,A.GutschriftsDatum
	,A.Empfanger
	,A.Status
	,A.LieferscheinDatum
	,A.Version
	,A.KreditorI3D
	,A.PersonalI3D
	,A.MwStAusweisen
	,K.Name
	,ZK.I3D
	,ZK.Kurztext
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,A.DTAusErstellt
	,A.DTAusDatum
	,A.DTAusBearbeiter
	,A.Bezahlt
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
GO
/****** Object:  Table [dbo].[AssetManagementCheckStatusReports]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCheckStatusReports](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[CheckConfigurationI3D] [int] NOT NULL,
	[CheckI3D] [int] NOT NULL,
	[CheckTypeID] [int] NOT NULL,
	[CheckName] [nvarchar](256) NOT NULL,
	[CheckStatus] [int] NOT NULL,
	[TransactionTime] [datetime] NOT NULL,
	[DriveName] [nvarchar](2000) NOT NULL,
	[ServiceName] [nvarchar](2000) NOT NULL,
	[Active] [bit] NOT NULL,
	[DisplayCheckName] [nvarchar](1000) NULL,
 CONSTRAINT [PK_AssetManagementCheckStatusReports] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementCheckStatusReportsOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementCheckStatusReportsOverview]
        AS
	      SELECT dbo.AssetManagementCheckStatusReports.I3D, dbo.AssetManagementCheckStatusReports.CheckI3D, dbo.AssetManagementCheckStatusReports.CheckName, 
			      dbo.AssetManagementCheckStatusReports.DisplayCheckName, dbo.AssetManagementCheckStatusReports.CheckStatus, dbo.AssetManagementCheckStatusReports.DriveName, 
			      dbo.AssetManagementCheckStatusReports.CheckConfigurationI3D, dbo.AssetManagementCheckStatusReports.CustomerI3D, dbo.Kunden.Name AS CustomerName, 
			      dbo.AssetManagementCheckStatusReports.DeviceI3D, dbo.AssetManagementDevices.ShortName AS DeviceName, dbo.AssetManagementDevices.DeviceClass, 
			      dbo.AssetManagementDevices.IsOnline, dbo.AssetManagementCheckStatusReports.ServiceName, dbo.AssetManagementCheckStatusReports.TransactionTime, 
			      dbo.AssetManagementCheckStatusReports.CheckTypeID, T.LastActionDate, T.LastActionResult, T.CheckStatusIndicator, dbo.AssetManagementCheckStatusReports.Active, 
			      dbo.AssetManagementDevices.SystemCrawlerStatus
	      FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) INNER JOIN
		      dbo.AssetManagementDevices WITH (NOLOCK) ON dbo.AssetManagementCheckStatusReports.DeviceI3D = dbo.AssetManagementDevices.I3D INNER JOIN
		      dbo.Kunden WITH (NOLOCK) ON dbo.AssetManagementDevices.KundenI3D = dbo.Kunden.I3D INNER JOIN
		      (SELECT DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator FROM 
			      dbo.cfn_LastActionCheckResultStatusDetails() AS cfn_LastActionCheckResultStatusDetails_1) AS T ON dbo.AssetManagementDevices.I3D = T.DeviceI3D
	      WHERE (dbo.Kunden.Status = 1) AND (dbo.Kunden.Gesperrt IS NULL OR dbo.Kunden.Gesperrt = 0) AND (dbo.AssetManagementDevices.IsSystemCralwerInstalled = 1)
      
GO
/****** Object:  Table [dbo].[WarenFilialeErloeskonto]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WarenFilialeErloeskonto](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WarengruppeI3D] [int] NULL,
	[BranchI3D] [int] NULL,
	[Erloeskonto] [int] NULL,
	[EUErloeskonto] [int] NULL,
	[AuslandErloeskonto] [int] NULL,
	[AufwandKTO] [int] NULL,
	[EUAufwandKTO] [int] NULL,
	[AuslandAufwandKTO] [int] NULL,
	[RCErloeskonto] [int] NULL,
	[RCAufwandKTO] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelBranchErloeskonto]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelBranchErloeskonto](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[BranchI3D] [int] NULL,
	[ErloesKonto] [int] NULL,
	[EUErloeskonto] [int] NULL,
	[AuslandErloeskonto] [int] NULL,
	[Status] [int] NULL,
	[AufwandKTO] [int] NULL,
	[EUAufwandKTO] [int] NULL,
	[AuslandAufwandKTO] [int] NULL,
	[RCErloeskonto] [int] NULL,
	[RCAufwandKTO] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[UnterwarenFilialeErloeskonto]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UnterwarenFilialeErloeskonto](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[UnterwarengruppeI3D] [int] NULL,
	[BranchI3D] [int] NULL,
	[ErloesKonto] [int] NULL,
	[EUErloeskonto] [int] NULL,
	[AuslandErloeskonto] [int] NULL,
	[AufwandKTO] [int] NULL,
	[EUAufwandKTO] [int] NULL,
	[AuslandAufwandKTO] [int] NULL,
	[RCErloeskonto] [int] NULL,
	[RCAufwandKTO] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_ProfitAndLossAccounts]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ProfitAndLossAccounts]
AS
-- Docu

-- BranchI3D
-- 0: Standard, >0: Richtige Branch

-- Priority
-- 0: Country, 1: Mehrwertsteuer, 2: Warengruppe, 3: Unter-Warengruppe, 4: Artikel

-- Artikel

SELECT
  ObjectKind = 9,
  ObjectI3D = I3D,
  BranchI3D = 0,
  RevenueInlandAccount = CASE WHEN ErloesKTO <= 0 THEN NULL ELSE ErloesKTO END,
  RevenueEuropeAccount = CASE WHEN EUErloesKTO <= 0 THEN NULL ELSE EUErloesKTO END,
  RevenueOverseasAccount = CASE WHEN AuslandErloesKTO <= 0 THEN NULL ELSE AuslandErloesKTO END,
  RevenueReverseChargeAccount = CASE WHEN RCErloesKTO <= 0 THEN NULL ELSE RCErloesKTO END,
  ExpenseInlandAccount = CASE WHEN AufwandKTO <= 0 THEN NULL ELSE AufwandKTO END,
  ExpenseEuropeAccount = CASE WHEN EUAufwandKTO <= 0 THEN NULL ELSE EUAufwandKTO END,
  ExpenseOverseasAccount = CASE WHEN AuslandAufwandKTO <= 0 THEN NULL ELSE AuslandAufwandKTO END,
  ExpenseReverseChargeAccount = CASE WHEN RCAufwandKTO <= 0 THEN NULL ELSE RCAufwandKTO END,
  Priority = 4
FROM ARTIK
WHERE 
  ErloesKTO IS NOT NULL AND ErloesKTO > 0 OR
  EUErloesKTO IS NOT NULL AND EUErloesKTO > 0 OR
  AuslandErloesKTO IS NOT NULL AND AuslandErloesKTO > 0 OR
  RCErloesKTO IS NOT NULL AND RCErloesKTO > 0 OR
  AufwandKTO IS NOT NULL AND AufwandKTO > 0 OR
  EUAufwandKTO IS NOT NULL AND EUAufwandKTO > 0 OR
  AuslandAufwandKTO IS NOT NULL AND AuslandAufwandKTO > 0 OR
  RCAufwandKTO IS NOT NULL AND RCAufwandKTO > 0

UNION ALL

SELECT
  ObjectKind = 9,
  ObjectI3D = ArtikelI3D,
  BranchI3D = BranchI3D,
  RevenueInlandAccount = CASE WHEN ErloesKonto <= 0 THEN NULL ELSE ErloesKonto END,
  RevenueEuropeAccount = CASE WHEN EUErloeskonto <= 0 THEN NULL ELSE EUErloeskonto END,
  RevenueOverseasAccount = CASE WHEN AuslandErloeskonto <= 0 THEN NULL ELSE AuslandErloeskonto END,
  RevenueReverseChargeAccount = CASE WHEN RCErloeskonto <= 0 THEN NULL ELSE RCErloeskonto END,
  ExpenseInlandAccount = CASE WHEN AufwandKTO <= 0 THEN NULL ELSE AufwandKTO END,
  ExpenseEuropeAccount = CASE WHEN EUAufwandKTO <= 0 THEN NULL ELSE EUAufwandKTO END,
  ExpenseOverseasAccount = CASE WHEN AuslandAufwandKTO <= 0 THEN NULL ELSE AuslandAufwandKTO END,
  ExpenseReverseChargeAccount = CASE WHEn RCAufwandKTO <= 0 THEN NULL ELSE RCAufwandKTO END,
  Priority = 4
FROM ArtikelBranchErloeskonto
WHERE
  BranchI3D IS NOT NULL AND BranchI3D > 0 AND
  (
    Erloeskonto IS NOT NULL AND ErloesKonto > 0 OR
    EUErloeskonto IS NOT NULL AND EUErloeskonto > 0 OR
    AuslandErloeskonto IS NOT NULL AND AuslandErloeskonto > 0 OR
    RCErloeskonto IS NOT NULL AND RCErloeskonto > 0 OR
    AufwandKTO IS NOT NULL AND AufwandKTO > 0 OR
    EUAufwandKTO IS NOT NULL AND EUAufwandKTO > 0 OR
    AuslandAufwandKTO IS NOT NULL AND AuslandAufwandKTO > 0 OR
    RCAufwandKTO IS NOT NULL AND RCAufwandKTO > 0
  )

UNION ALL

-- Unterwarengruppen

SELECT
  ObjectKind = 136,
  ObjectI3D = I3D,
  BranchI3D = 0,
  RevenueInlandAccount = CASE WHEN ErloesKTO <= 0 THEN NULL ELSE ErloesKTO END,
  RevenueEuropeAccount = CASE WHEN EUErloesKTO <= 0 THEN NULL ELSE EUErloesKTO END,
  RevenueOverseasAccount = CASE WHEN AuslandErloesKTO <= 0 THEN NULL ELSE AuslandErloesKTO END,
  RevenueReverseChargeAccount = CASE WHEN RCErloesKTO <= 0 THEN NULL ELSE RCErloesKTO END,
  ExpenseInlandAccount = CASE WHEN AufwandKTO <= 0 THEN NULL ELSE AufwandKTO END,
  ExpenseEuropeAccount = CASE WHEN EUAufwandKTO <= 0 THEN NULL ELSE EUAufwandKTO END,
  ExpenseOverseasAccount = CASE WHEN AuslandAufwandKTO <= 0 THEN NULL ELSE AuslandAufwandKTO END,
  ExpenseReverseChargeAccount = CASE WHEN RCAufwandKTO <= 0 THEN NULL ELSE RCAufwandKTO END,
  Priority = 3
FROM UNTERWAREN
WHERE 
  ErloesKTO IS NOT NULL AND ErloesKTO > 0 OR
  EUErloesKTO IS NOT NULL AND EUErloesKTO > 0 OR
  AuslandErloesKTO IS NOT NULL AND AuslandErloesKTO > 0 OR
  RCErloesKTO IS NOT NULL AND RCErloesKTO > 0 OR
  AufwandKTO IS NOT NULL AND AufwandKTO > 0 OR
  EUAufwandKTO IS NOT NULL AND EUAufwandKTO > 0 OR
  AuslandAufwandKTO IS NOT NULL AND AuslandAufwandKTO > 0 OR
  RCAufwandKTO IS NOT NULL AND RCAufwandKTO > 0

UNION ALL

SELECT
  ObjectKind = 136,
  ObjectI3D = UnterwarengruppeI3D,
  BranchI3D = BranchI3D,
  RevenueInlandAccount = CASE WHEN ErloesKonto <= 0 THEN NULL ELSE ErloesKonto END,
  RevenueEuropeAccount = CASE WHEN EUErloeskonto <= 0 THEN NULL ELSE EUErloeskonto END,
  RevenueOverseasAccount = CASE WHEN AuslandErloeskonto <= 0 THEN NULL ELSE AuslandErloeskonto END,
  RevenueReverseChargeAccount = CASE WHEN RCErloeskonto <= 0 THEN NULL ELSE RCErloeskonto END,
  ExpenseInlandAccount = CASE WHEN AufwandKTO <= 0 THEN NULL ELSE AufwandKTO END,
  ExpenseEuropeAccount = CASE WHEN EUAufwandKTO <= 0 THEN NULL ELSE EUAufwandKTO END,
  ExpenseOverseasAccount = CASE WHEN AuslandAufwandKTO <= 0 THEN NULL ELSE AuslandAufwandKTO END,
  ExpenseReverseChargeAccount = CASE WHEn RCAufwandKTO <= 0 THEN NULL ELSE RCAufwandKTO END,
  Priority = 3
FROM UnterwarenFilialeErloeskonto
WHERE 
  BranchI3D IS NOT NULL AND BranchI3D > 0 AND
  (
    Erloeskonto IS NOT NULL AND ErloesKonto > 0 OR
    EUErloeskonto IS NOT NULL AND EUErloeskonto > 0 OR
    AuslandErloeskonto IS NOT NULL AND AuslandErloeskonto > 0 OR
    RCErloeskonto IS NOT NULL AND RCErloeskonto > 0 OR
    AufwandKTO IS NOT NULL AND AufwandKTO > 0 OR
    EUAufwandKTO IS NOT NULL AND EUAufwandKTO > 0 OR
    AuslandAufwandKTO IS NOT NULL AND AuslandAufwandKTO > 0 OR
    RCAufwandKTO IS NOT NULL AND RCAufwandKTO > 0
  )

UNION ALL

-- Warengruppen

SELECT
  ObjectKind = 70,
  ObjectI3D = I3D,
  BranchI3D = 0,
  RevenueInlandAccount = CASE WHEN ErloesKTO <= 0 THEN NULL ELSE ErloesKTO END,
  RevenueEuropeAccount = CASE WHEN EUErloesKTO <= 0 THEN NULL ELSE EUErloesKTO END,
  RevenueOverseasAccount = CASE WHEN AuslandErloesKTO <= 0 THEN NULL ELSE AuslandErloesKTO END,
  RevenueReverseChargeAccount = CASE WHEN RCErloesKTO <= 0 THEN NULL ELSE RCErloesKTO END,
  ExpenseInlandAccount = CASE WHEN AufwandKTO <= 0 THEN NULL ELSE AufwandKTO END,
  ExpenseEuropeAccount = CASE WHEN EUAufwandKTO <= 0 THEN NULL ELSE EUAufwandKTO END,
  ExpenseOverseasAccount = CASE WHEN AuslandAufwandKTO <= 0 THEN NULL ELSE AuslandAufwandKTO END,
  ExpenseReverseChargeAccount = CASE WHEN RCAufwandKTO <= 0 THEN NULL ELSE RCAufwandKTO END,
  Priority = 2
FROM WAREN
WHERE 
  ErloesKTO IS NOT NULL AND ErloesKTO > 0 OR
  EUErloesKTO IS NOT NULL AND EUErloesKTO > 0 OR
  AuslandErloesKTO IS NOT NULL AND AuslandErloesKTO > 0 OR
  RCErloesKTO IS NOT NULL AND RCErloesKTO > 0 OR
  AufwandKTO IS NOT NULL AND AufwandKTO > 0 OR
  EUAufwandKTO IS NOT NULL AND EUAufwandKTO > 0 OR
  AuslandAufwandKTO IS NOT NULL AND AuslandAufwandKTO > 0 OR
  RCAufwandKTO IS NOT NULL AND RCAufwandKTO > 0

UNION ALL

SELECT
  ObjectKind = 70,
  ObjectI3D = WarengruppeI3D,
  BranchI3D = BranchI3D,
  RevenueInlandAccount = CASE WHEN ErloesKonto <= 0 THEN NULL ELSE ErloesKonto END,
  RevenueEuropeAccount = CASE WHEN EUErloeskonto <= 0 THEN NULL ELSE EUErloeskonto END,
  RevenueOverseasAccount = CASE WHEN AuslandErloeskonto <= 0 THEN NULL ELSE AuslandErloeskonto END,
  RevenueReverseChargeAccount = CASE WHEN RCErloeskonto <= 0 THEN NULL ELSE RCErloeskonto END,
  ExpenseInlandAccount = CASE WHEN AufwandKTO <= 0 THEN NULL ELSE AufwandKTO END,
  ExpenseEuropeAccount = CASE WHEN EUAufwandKTO <= 0 THEN NULL ELSE EUAufwandKTO END,
  ExpenseOverseasAccount = CASE WHEN AuslandAufwandKTO <= 0 THEN NULL ELSE AuslandAufwandKTO END,
  ExpenseReverseChargeAccount = CASE WHEn RCAufwandKTO <= 0 THEN NULL ELSE RCAufwandKTO END,
  Priority = 2
FROM WarenFilialeErloeskonto
WHERE 
  BranchI3D IS NOT NULL AND BranchI3D > 0 AND
  (
    Erloeskonto IS NOT NULL AND ErloesKonto > 0 OR
    EUErloeskonto IS NOT NULL AND EUErloeskonto > 0 OR
    AuslandErloeskonto IS NOT NULL AND AuslandErloeskonto > 0 OR
    RCErloeskonto IS NOT NULL AND RCErloeskonto > 0 OR
    AufwandKTO IS NOT NULL AND AufwandKTO > 0 OR
    EUAufwandKTO IS NOT NULL AND EUAufwandKTO > 0 OR
    AuslandAufwandKTO IS NOT NULL AND AuslandAufwandKTO > 0 OR
    RCAufwandKTO IS NOT NULL AND RCAufwandKTO > 0
  )

UNION ALL

-- Mehrwertsteuer

SELECT
  ObjectKind = 169,
  ObjectI3D = I3D,
  BranchI3D = 0,
  RevenueInlandAccount = ErloesKTO,
  RevenueEuropeAccount = NULL,
  RevenueOverseasAccount = NULL,
  RevenueReverseChargeAccount = NULL,
  ExpenseInlandAccount = AufwandKTO,
  ExpenseEuropeAccount = NULL,
  ExpenseOverseasAccount = NULL,
  ExpenseReverseChargeAccount = NULL,
  Priority = 1
FROM MwstSatz
WHERE 
  ErloesKTO IS NOT NULL AND ErloesKTO > 0 OR
  AufwandKTO IS NOT NULL AND AufwandKTO > 0

UNION ALL

-- Land

SELECT
  ObjectKind = 5002720,
  ObjectI3D = I3D,
  BranchI3D = 0,
  RevenueInlandAccount = ErloesKTO,
  RevenueEuropeAccount = NULL,
  RevenueOverseasAccount = NULL,
  RevenueReverseChargeAccount = NULL,
  ExpenseInlandAccount = AufwandKTO,
  ExpenseEuropeAccount = NULL,
  ExpenseOverseasAccount = NULL,
  ExpenseReverseChargeAccount = NULL,
  Priority = 1
FROM Laenkenn
WHERE 
  ErloesKTO IS NOT NULL AND ErloesKTO > 0 OR
  AufwandKTO IS NOT NULL AND AufwandKTO > 0

GO
/****** Object:  View [dbo].[cvw_OfferPosLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OfferPosLC]
AS
SELECT AP.I3D
	,AP.VATI3D
	,AP.InternalPosition
	,AP.Kind
	,AP.Expanded
	,AP.ArticlePositionKind
	,AP.GroupID
	,AP.Indent
	,CASE WHEN AP.isReverseCharge = 1 AND AP.VATI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.ReceiptI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotalComplete AS NetPriceTotal
	, Calc.TaxPriceTotalComplete AS TaxPriceTotal
	, Calc.NetPriceTotalComplete AS NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete AS TaxPriceTotalComplete
	, Calc.NetPriceTotalFCComplete AS NetPriceTotalFC
	, Calc.TaxPriceTotalFCComplete AS TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete AS NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete AS TaxPriceTotalFCComplete
	, Calc.NetPurchasePrice
	, Calc.TaxPurchasePrice
	, Calc.NetPurchasePriceFC
	, Calc.TaxPurchasePriceFC
	, Calc.NetPurchasePriceTotalComplete AS NetPurchasePriceTotal
	, Calc.TaxPurchasePriceTotalComplete AS TaxPurchasePriceTotal
	, Calc.NetPurchasePriceTotalComplete AS NetPurchasePriceTotalComplete
	, Calc.NetPurchasePriceTotalFCComplete AS NetPurchasePriceTotalFC
	, Calc.TaxPurchasePriceTotalFCComplete AS TaxPurchasePriceTotalFC
	, Calc.NetPurchasePriceTotalFCComplete AS NetPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Discount,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.ExclusiveOfVAT = 1 THEN 0 ELSE ROUND(ISNULL(AP.VATRate,0),2)END) AS VATRate
FROM dbo.OfferItems AS AP
INNER JOIN dbo.Offers AS A ON AP.ReceiptI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArticleI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Kind IN (1,3) THEN 1 ELSE 0 END
	,CASE WHEN AP.Kind IN (1,3) AND AP.ArticlePositionKind IN (0,50) THEN 1 ELSE 0 END
	,AP.BasePrice, AP.PurchaseBasePrice, ISNULL(AR.Nachkommastellen,2), ISNULL(AP.Discount,0), A.CurrencyFactor, CONVERT(bit,A.ExclusiveOfVAT), AP.VATRate, A.IsCashAsset, AP.QuantityComplete, 0) AS Calc
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.CountryI3D
GO
/****** Object:  Table [dbo].[AbholKopf]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbholKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[Version] [int] NOT NULL,
	[Datum] [datetime] NOT NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NOT NULL,
	[AnschriftID] [int] NOT NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LandI3D] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](255) NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[DocDirI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[AbholscheinGrundI3D] [int] NULL,
	[AbholscheinGrundText] [varchar](500) NULL,
	[FilialgeberI3D] [int] NULL,
	[InfoAnzeigen] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[Rabatt] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[VertragsI3D] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
 CONSTRAINT [PK_AbholKopf] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [ixAbholKopf_Status]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixAbholKopf_Status] ON [dbo].[AbholKopf]
(
	[Status] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  View [dbo].[PickupLists]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[PickupLists] AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.Datum AS Date
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptConditionText
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN A.AbholscheinGrundI3D <= 0 THEN NULL ELSE A.AbholscheinGrundI3D END AS ReceiptReasonI3D
	,A.AbholscheinGrundText AS ReceiptReasonText
    ,0 AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.VertragsI3D AS ContractI3D
	,0 AS UsedAlternativeDeliveryAddress
	,A.GUI3D AS ConcurrencyControlGuid
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.CampaignI3D
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.AbholKopf AS A
GO
/****** Object:  Table [dbo].[AbholPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbholPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AbholKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[Liefermenge] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockId] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Status] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungLiefNr] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[KundenRMAI3D] [int] NULL,
	[KundenRMANummer] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[OriginalI3D] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[RMAPosI3D] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Artikelpositionsart] [int] NULL,
	[RabattTextNichtAnzeigen] [int] NULL,
	[IsBillingPartList] [bit] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[IsReverseCharge] [bit] NULL,
 CONSTRAINT [PK_AbholPos] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [ixAbholPos_AbholKopfI3D]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixAbholPos_AbholKopfI3D] ON [dbo].[AbholPos]
(
	[AbholKopfI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  View [dbo].[PickupListItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[PickupListItems]
AS
SELECT AP.I3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.AbholKopfI3D, 0) AS ReceiptI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.Ursprung AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
	,'' AS PurchaseInformations
    ,AP.WEEE AS WEEE
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,AP.IsReverseCharge
FROM dbo.AbholPos AS AP
GO
/****** Object:  View [dbo].[cvw_PickupListPosLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_PickupListPosLC]
AS
SELECT AP.I3D
	,AP.VATI3D
	,AP.InternalPosition
	,AP.Kind
	,AP.Expanded
	,AP.ArticlePositionKind
	,AP.GroupID
	,AP.Indent
	,CASE WHEN AP.isReverseCharge = 1 AND AP.VATI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.ReceiptI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotalComplete AS NetPriceTotal
	, Calc.TaxPriceTotalComplete AS TaxPriceTotal
	, Calc.NetPriceTotalComplete AS NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete AS TaxPriceTotalComplete
	, Calc.NetPriceTotalFCComplete AS NetPriceTotalFC
	, Calc.TaxPriceTotalFCComplete AS TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete AS NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete AS TaxPriceTotalFCComplete
	, Calc.NetPurchasePrice
	, Calc.TaxPurchasePrice
	, Calc.NetPurchasePriceFC
	, Calc.TaxPurchasePriceFC
	, Calc.NetPurchasePriceTotalComplete AS NetPurchasePriceTotal
	, Calc.TaxPurchasePriceTotalComplete AS TaxPurchasePriceTotal
	, Calc.NetPurchasePriceTotalComplete AS NetPurchasePriceTotalComplete
	, Calc.NetPurchasePriceTotalFCComplete AS NetPurchasePriceTotalFC
	, Calc.TaxPurchasePriceTotalFCComplete AS TaxPurchasePriceTotalFC
	, Calc.NetPurchasePriceTotalFCComplete AS NetPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Discount,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.ExclusiveOfVAT = 1 THEN 0 ELSE ROUND(ISNULL(AP.VATRate,0),2)END) AS VATRate
FROM dbo.PickupListItems AS AP
INNER JOIN dbo.PickupLists AS A ON AP.ReceiptI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArticleI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Kind IN (1,3) THEN 1 ELSE 0 END
	,CASE WHEN AP.Kind IN (1,3) AND AP.ArticlePositionKind IN (0,50) THEN 1 ELSE 0 END
	,AP.BasePrice, AP.PurchaseBasePrice, ISNULL(AR.Nachkommastellen,2), ISNULL(AP.Discount,0), A.CurrencyFactor, CONVERT(bit,A.ExclusiveOfVAT), AP.VATRate, A.IsCashAsset, AP.QuantityComplete, 0) AS Calc
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.CountryI3D
GO
/****** Object:  Table [dbo].[GutKopf]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GutKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[Version] [int] NULL,
	[Datum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[AusAuf] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LandI3D] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](255) NULL,
	[Archiviert] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[DocDirI3D] [int] NULL,
	[Bereitstellung] [datetime] NULL,
	[BestNr] [varchar](50) NULL,
	[Zusatztext] [varchar](70) NULL,
	[Direktlieferung] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LieferbedingungsText] [varchar](255) NULL,
	[Lieferdatum] [datetime] NULL,
	[LiefKundFremd] [int] NULL,
	[LSuREvVersand] [int] NULL,
	[ProjNr] [varchar](50) NULL,
	[RechKundFremd] [int] NULL,
	[Teillieferung] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[GutschriftGrundI3D] [int] NULL,
	[GutschriftGrundText] [varchar](500) NULL,
	[FilialgeberI3D] [int] NULL,
	[InfoAnzeigen] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[Rabatt] [float] NULL,
	[WertGutschrift] [int] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[FIBUSammelkonto] [varchar](24) NULL,
	[IsPositionProvision] [bit] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[VertragsI3D] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
 CONSTRAINT [PK_GutKopf] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [ixGutKopf_Status]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixGutKopf_Status] ON [dbo].[GutKopf]
(
	[Status] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  View [dbo].[CreditVouchers]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[CreditVouchers] AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptConditionText
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN A.GutschriftGrundI3D <= 0 THEN NULL ELSE A.GutschriftGrundI3D END AS ReceiptReasonI3D
	,A.GutschriftGrundText AS ReceiptReasonText
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.VertragsI3D AS ContractI3D
	,ISNULL(A.LiefKundFremd, 0) AS UsedAlternativeDeliveryAddress
	,ISNULL(A.RechKundFremd, 0) AS UsedAlternativeInvoiceAddress
	,A.GUI3D AS ConcurrencyControlGuid
	,ISNULL(A.WertGutschrift, 0) AS OnlyPriceValue
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.CampaignI3D
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
FROM dbo.GutKopf AS A
GO
/****** Object:  Table [dbo].[GutPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GutPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GutKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNr] [int] NULL,
	[Farbe] [int] NULL,
	[FontSize] [int] NULL,
	[FontStyle] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[KundenRMAI3D] [int] NULL,
	[KundenRMANummer] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Status] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Artikelpositionsart] [int] NULL,
	[WertGutschrift] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[IsBillingPartList] [bit] NULL,
	[ReceiptItemServiceArticleClassificationI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[IsReverseCharge] [bit] NULL,
	[RMAPosI3D] [int] NULL,
 CONSTRAINT [PK_GutPos] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [ixGutPos_GutKopfI3D]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixGutPos_GutKopfI3D] ON [dbo].[GutPos]
(
	[GutKopfI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  View [dbo].[CreditVoucherItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[CreditVoucherItems]
AS
SELECT AP.I3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.GutKopfI3D, 0) AS ReceiptI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.Ursprung AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
	,'' AS PurchaseInformations
    ,AP.WEEE AS WEEE
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,AP.ReceiptItemServiceArticleClassificationI3D
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,ISNULL(AP.WertGutschrift, 0) AS OnlyPriceValue
	,AP.IsReverseCharge
	,AP.RMAPosI3D as RMAItemI3D
FROM dbo.GutPos AS AP 
GO
/****** Object:  View [dbo].[cvw_CreditVoucherPosLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_CreditVoucherPosLC]
AS
SELECT AP.I3D
	,AP.VATI3D
	,AP.InternalPosition
	,AP.Kind
	,AP.Expanded
	,AP.ArticlePositionKind
	,AP.GroupID
	,AP.Indent
	,CASE WHEN AP.isReverseCharge = 1 AND AP.VATI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.ReceiptI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotalComplete AS NetPriceTotal
	, Calc.TaxPriceTotalComplete AS TaxPriceTotal
	, Calc.NetPriceTotalComplete AS NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete AS TaxPriceTotalComplete
	, Calc.NetPriceTotalFCComplete AS NetPriceTotalFC
	, Calc.TaxPriceTotalFCComplete AS TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete AS NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete AS TaxPriceTotalFCComplete
	, Calc.NetPurchasePrice
	, Calc.TaxPurchasePrice
	, Calc.NetPurchasePriceFC
	, Calc.TaxPurchasePriceFC
	, Calc.NetPurchasePriceTotalComplete AS NetPurchasePriceTotal
	, Calc.TaxPurchasePriceTotalComplete AS TaxPurchasePriceTotal
	, Calc.NetPurchasePriceTotalComplete AS NetPurchasePriceTotalComplete
	, Calc.NetPurchasePriceTotalFCComplete AS NetPurchasePriceTotalFC
	, Calc.TaxPurchasePriceTotalFCComplete AS TaxPurchasePriceTotalFC
	, Calc.NetPurchasePriceTotalFCComplete AS NetPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Discount,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.ExclusiveOfVAT = 1 THEN 0 ELSE ROUND(ISNULL(AP.VATRate,0),2)END) AS VATRate
FROM dbo.CreditVoucherItems AS AP
INNER JOIN dbo.CreditVouchers AS A ON AP.ReceiptI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArticleI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Kind IN (1,3) THEN 1 ELSE 0 END
	,CASE WHEN AP.Kind IN (1,3) AND AP.ArticlePositionKind IN (0,50) THEN 1 ELSE 0 END
	,AP.BasePrice * -1, AP.PurchaseBasePrice * -1, ISNULL(AR.Nachkommastellen,2), ISNULL(AP.Discount,0), A.CurrencyFactor, CONVERT(bit,A.ExclusiveOfVAT), AP.VATRate, A.IsCashAsset, AP.QuantityComplete, 0) AS Calc
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.CountryI3D
GO
/****** Object:  View [dbo].[Invoices]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[Invoices] AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentConditionText
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryConditionText
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN YEAR(ISNULL(A.Var1Rechnung,0)) < 1905 THEN NULL ELSE A.Var1Rechnung END AS VariableDateField
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.ESRBetrag AS EsrAmount
	,A.ESRKodierzeileBetrag AS EsrCodelineAmount
	,A.ESRReferenznummer AS EsrReferenceNumber
	,A.IsFixed
	,A.VertragsI3D AS ContractI3D
	,ISNULL(A.LiefKundFremd, 0) AS UsedAlternativeDeliveryAddress
	,ISNULL(A.RechKundFremd, 0) AS UsedAlternativeInvoiceAddress
	,A.SepaMandateI3D AS MandatI3D
	,A.GUI3D AS ConcurrencyControlGuid
	,ISNULL(A.Bezahlt, 0) AS PaidFC
	,CASE WHEN YEAR(ISNULL(A.FaelligAm,0)) < 1905 THEN NULL ELSE A.FaelligAm END AS PaymentDueDate
	,A.ExternalInvoiceDate AS ExternalInvoiceDate
	,A.ExternalInvoiceNumber AS ExternalInvoiceNumber
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.FIBUSammelkonto AS CollectiveAccount
	,A.CampaignI3D	
	,A.Trackingnummer AS TrackingNumber
	,A.TrackingNumberURL
	,A.ReceiptUserStateI3D
	,A.DownPaymentForOrderI3D
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.RechKopf AS A
GO
/****** Object:  Table [dbo].[RechPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RechPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RechKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNr] [int] NULL,
	[GutAbholArt] [int] NULL,
	[GutAbholNr] [int] NULL,
	[numGutAbhol] [float] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[Import] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[StkStorno] [float] NULL,
	[SummeKalkStorno] [float] NULL,
	[VertragI3DAutoRechnung] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[RMAPosI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Status] [int] NULL,
	[VKBasisWert] [float] NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[LizenzDatum] [datetime] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[RundungsDiff] [float] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[NoCalculateTime] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[IsBillingPartList] [bit] NULL,
	[ReceiptItemServiceArticleClassificationI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalComplete] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFCComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFCComplete] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFCComplete] [decimal](19, 2) NULL,
	[IsReverseCharge] [bit] NULL,
 CONSTRAINT [PK_RechPos] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [ixRechPos_RechKopfI3D]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixRechPos_RechKopfI3D] ON [dbo].[RechPos]
(
	[RechKopfI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  View [dbo].[InvoiceItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[InvoiceItems]
AS
SELECT AP.I3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.RechKopfI3D, 0) AS ReceiptI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.numGutAbhol, 0)) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.Ursprung AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
    ,AP.WEEE AS WEEE
	,AP.Bestellinformation AS PurchaseInformations
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,AP.BestellNr AS PurchaseOrderNumber
	,CASE WHEN YEAR(ISNULL(AP.LizenzDatum, 0)) < 1905 THEN NULL ELSE AP.LizenzDatum END AS LicenseDate
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,AP.ReceiptItemServiceArticleClassificationI3D
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,CASE WHEN AP.GeraeteBarcodeI3D <= 0 THEN NULL ELSE AP.GeraeteBarcodeI3D END AS MasterDataListSerialNumberI3D
	,AP.IsReverseCharge
	,AP.RMAPosI3D AS RMAItemI3D
FROM dbo.RechPos AS AP
GO
/****** Object:  View [dbo].[cvw_InvoicePosLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


CREATE VIEW [dbo].[cvw_InvoicePosLC]
AS
SELECT AP.I3D
	,AP.VATI3D
	,AP.InternalPosition
	,AP.Kind
	,AP.Expanded
	,AP.ArticlePositionKind
	,AP.GroupID
	,AP.Indent
	,CASE WHEN AP.isReverseCharge = 1 AND AP.VATI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.ReceiptI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0) - ISNULL(AP.QuantityProcessed, 0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityProcessed,0)) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotal
	, Calc.TaxPriceTotal
	, Calc.NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete
	, Calc.NetPriceTotalFC
	, Calc.TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete
	, Calc.NetPurchasePrice
	, Calc.TaxPurchasePrice
	, Calc.NetPurchasePriceFC
	, Calc.TaxPurchasePriceFC
	, Calc.NetPurchasePriceTotal
	, Calc.TaxPurchasePriceTotal
	, Calc.NetPurchasePriceTotalComplete
	, Calc.TaxPurchasePriceTotalComplete
	, Calc.NetPurchasePriceTotalFC
	, Calc.TaxPurchasePriceTotalFC
	, Calc.NetPurchasePriceTotalFCComplete
	, Calc.TaxPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Discount,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.ExclusiveOfVAT = 1 THEN 0 ELSE ROUND(ISNULL(AP.VATRate,0),2)END) AS VATRate
FROM dbo.InvoiceItems AS AP
INNER JOIN dbo.Invoices AS A ON AP.ReceiptI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArticleI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Kind IN (1,3) THEN 1 ELSE 0 END
	,CASE WHEN AP.Kind IN (1,3) AND AP.ArticlePositionKind IN (0,50) THEN 1 ELSE 0 END
	,AP.BasePrice, AP.PurchaseBasePrice, ISNULL(AR.Nachkommastellen,2), ISNULL(AP.Discount,0), A.CurrencyFactor, CONVERT(bit,A.ExclusiveOfVAT), AP.VATRate, A.IsCashAsset, AP.QuantityComplete, AP.QuantityProcessed) AS Calc
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.CountryI3D
GO
/****** Object:  View [dbo].[SupplierInvoices]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[SupplierInvoices] AS
SELECT
	I3D = K.I3D,

	Number = K.Nummer,
	Date = K.Datum,
	Version = K.Version,
	State = K.Status,
	EditorI3D = IIF(K.PersonalI3D <= 0, NULL, K.PersonalI3D),
	DirectoryI3D = IIF(K.DocDirI3D <= 0, NULL, K.DocDirI3D),

	BranchI3D = IIF(K.BranchI3D <= 0, NULL, K.BranchI3D),
	BranchOrigin = ISNULL(K.BranchOrigin, 0),

	CurrencyI3D = IIF(ISNULL(K.CurrencyI3D, 0) <= 0, NULL, K.CurrencyI3D),
	CurrencyFactor = ISNULL(K.CurrencyFactor, 1),
	CurrencyString = ISNULL(K.CurrencyString, '€'),
	ExclusiveOfVat = ISNULL(K.MwStAusweisen, 0),

	Receiver = ISNULL(K.Empfanger, ''),
	Phone = ISNULL(K.Tel, ''),
	Fax = ISNULL(K.Fax, ''),
	Email = ISNULL(K.Mail, ''),

	SupplierI3D = IIF(ISNULL(K.KreditorI3D, 0) <= 0, 0, K.KreditorI3D),
	AddressI3D = IIF(K.AnschriftI3D <= 0, NULL, K.AnschriftI3D),
	ContactPersonI3D = IIF(K.PersonI3D <= 0, NULL, K.PersonI3D),
	Street = ISNULL(K.Street, ''),
	HasPostOfficeBox = ISNULL(K.HasPostOfficeBox, 0),
	PostOfficeBox = ISNULL(K.PostOfficeBox, ''),
	Zip = ISNULL(K.Zip, ''),
	City = ISNULL(K.City, ''),
	ContactName = ISNULL(K.ContactName, ''),
	CountryI3D = IIF(ISNULL(K.LandI3D, 0) <= 0, NULL, K.LandI3D),

	CreatedByI3D = IIF(K.ErstelltVonI3D <= 0, NULL, K.ErstelltVonI3D),
	CreatedAt = IIF(YEAR(ISNULL(K.ErstelltDatum,0)) < 1905, NULL, K.ErstelltDatum),
	CreatedThroughApplicationVersion = ISNULL(K.ErstelltVersion, ''),
	ChangedByI3D = IIF(K.GeaendertVonI3D <= 0, NULL, K.GeaendertVonI3D),
	ChangedAt = IIF(YEAR(ISNULL(K.GeaendertDatum,0)) < 1905, NULL, K.GeaendertDatum),
	ChangedThroughApplicationVersion = ISNULL(K.GeaendertVersion, ''),
	ChangedThroughApplication = ISNULL(K.ChangedThroughApplication, 0),

	ConcurrencyControlGuid = K.ConcurrencyControlGuid,
	ExternalInvoiceDate = IIF(YEAR(K.RechnungsDatum) < 1905, NULL, K.RechnungsDatum),
	ExternalInvoiceNumber = K.RechnungsNr,
	SupplierPaymentConditionI3D = IIF(K.ZahlKondI3D <= 0, NULL, K.ZahlKondI3D),
	SupplierPaymentConditionText = K.ZahlKondText,
	FreightAmount = K.Frachtkosten,
	FreightDistribution = K.FrachtVerteilung,
	InsuranceAmount = K.Versicherung,
	InsuranceDistribution = K.VersicherungsVerteilung,
	PaymentDueDate = IIF(YEAR(ISNULL(K.FaelligAm,0)) < 1905, NULL, K.FaelligAm),
	Information = K.Notiz,
	ProjectNumber = K.ProjNr,
	K.WEKalkulationGrundI3D AS ReceiptReasonI3D,
	K.WEKalkulationGrundText AS ReceiptReasonText,
	K.BankVerbNummer AS BankContactI3D,
	K.ESRCodierzeile AS ESRCodeLine,
	K.FibuGesamtPreis AS ReceiptGrossPrice,
	K.VarFeld1 AS VariableField1,
	K.ReceiptLink AS ReceiptLink,
    K.IsSupplierInvoiceStandalone AS IsSupplierInvoiceStandalone,
	ReceiptReceiverI3D = K.ReceiptReceiverI3D,
	ReceiptReceiverInvoiceI3D = K.ReceiptReceiverInvoiceI3D,
	ReceiptReceiverDeliveryI3D = K.ReceiptReceiverDeliveryI3D,
	ReceiptReceiverLicenseI3D = K.ReceiptReceiverLicenseI3D
FROM dbo.KalkKopf K
        
GO
/****** Object:  View [dbo].[DeliveryLists]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[DeliveryLists] AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentConditionText
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryConditionText
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN A.LieferscheinGrundI3D <= 0 THEN NULL ELSE A.LieferscheinGrundI3D END AS ReceiptReasonI3D
	,A.LieferscheinGrundText AS ReceiptReasonText
	,CASE WHEN YEAR(ISNULL(A.Var2Lieferschein,0)) < 1905 THEN NULL ELSE A.Var2Lieferschein END AS VariableDateField
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.VertragsI3D AS ContractI3D
	,ISNULL(A.LiefKundFremd, 0) AS UsedAlternativeDeliveryAddress
	,A.GUI3D AS ConcurrencyControlGuid
	,CASE WHEN YEAR(ISNULL(A.LiefEskDatum, 0)) < 1905 THEN NULL ELSE A.LiefEskDatum END AS EscalationDate
	,A.SendDateOfProduct AS SendDateOfProduct
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.CampaignI3D
	,A.Trackingnummer AS TrackingNumber
	,A.TrackingNumberURL
	,A.ReceiptUserStateI3D
    ,IIF(ISNULL(A.Var1Lieferschein, 0) <= 0, NULL, A.Var1Lieferschein) AS VariableComboBoxFieldI3D
	,A.DurchRMAGeschlossen AS ClosedThroughRMA
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.LiefKopf AS A
GO
/****** Object:  Table [dbo].[LiefPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiefPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LiefKopfI3D] [int] NOT NULL,
	[VertragI3D] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockId] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbruch] [int] NULL,
	[Status] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungNr] [int] NULL,
	[UrsprungArt] [int] NULL,
	[RechLiefNr] [int] NULL,
	[RechLiefArt] [int] NULL,
	[AbholNr] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[Ausgeliefert] [int] NULL,
	[Import] [int] NULL,
	[MwstI3d] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellPos] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[Abbuchung] [int] NULL,
	[OriginalI3D] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[RMAPosI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[VKBasisWert] [float] NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[Artikelpositionsart] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[RundungsDiff] [float] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[NoCalculateTime] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[IsBillingPartList] [bit] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalComplete] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFCComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFCComplete] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFCComplete] [decimal](19, 2) NULL,
	[LizenzDatum] [datetime2](0) NULL,
	[numAbhol_old] [float] NULL,
	[NumAbhol]  AS ([dbo].[cfn_PickUpCount]([I3D])),
	[IsReverseCharge] [bit] NULL,
 CONSTRAINT [PK_LiefPos] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [ixLiefPos_LiefKopfI3D]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [ixLiefPos_LiefKopfI3D] ON [dbo].[LiefPos]
(
	[LiefKopfI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  View [dbo].[DeliveryListItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[DeliveryListItems]
AS
SELECT AP.I3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.LiefKopfI3D, 0) AS ReceiptI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.numAbhol, 0)) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.Ursprung AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
    ,AP.WEEE AS WEEE
	,AP.Bestellinformation AS PurchaseInformations
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,AP.LizenzDatum AS LicenseDate	
	,CASE WHEN AP.GeraeteBarcodeI3D <= 0 THEN NULL ELSE AP.GeraeteBarcodeI3D END AS MasterDataListSerialNumberI3D
	,AP.IsReverseCharge
	,AP.RMAPosI3D AS RMAItemI3D
FROM dbo.LiefPos AS AP
GO
/****** Object:  View [dbo].[cvw_DeliveryListPosLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_DeliveryListPosLC]
AS
SELECT AP.I3D
	,AP.VATI3D
	,AP.InternalPosition
	,AP.Kind
	,AP.Expanded
	,AP.ArticlePositionKind
	,AP.GroupID
	,AP.Indent
	,CASE WHEN AP.isReverseCharge = 1 AND AP.VATI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.ReceiptI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0) - ISNULL(AP.QuantityProcessed, 0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityProcessed,0)) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotal
	, Calc.TaxPriceTotal
	, Calc.NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete
	, Calc.NetPriceTotalFC
	, Calc.TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete
	, Calc.NetPurchasePrice
	, Calc.TaxPurchasePrice
	, Calc.NetPurchasePriceFC
	, Calc.TaxPurchasePriceFC
	, Calc.NetPurchasePriceTotal
	, Calc.TaxPurchasePriceTotal
	, Calc.NetPurchasePriceTotalComplete
	, Calc.TaxPurchasePriceTotalComplete
	, Calc.NetPurchasePriceTotalFC
	, Calc.TaxPurchasePriceTotalFC
	, Calc.NetPurchasePriceTotalFCComplete
	, Calc.TaxPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Discount,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.ExclusiveOfVAT = 1 THEN 0 ELSE ROUND(ISNULL(AP.VATRate,0),2)END) AS VATRate
FROM dbo.DeliveryListItems AS AP
INNER JOIN dbo.DeliveryLists AS A ON AP.ReceiptI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArticleI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Kind IN (1,3) THEN 1 ELSE 0 END
	,CASE WHEN AP.Kind IN (1,3) AND AP.ArticlePositionKind IN (0,50) THEN 1 ELSE 0 END
	,AP.BasePrice, AP.PurchaseBasePrice, ISNULL(AR.Nachkommastellen,2), ISNULL(AP.Discount,0), A.CurrencyFactor, CONVERT(bit,A.ExclusiveOfVAT), AP.VATRate, A.IsCashAsset, AP.QuantityComplete, AP.QuantityProcessed) AS Calc
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.CountryI3D
GO
/****** Object:  View [dbo].[SupplierInvoiceItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[SupplierInvoiceItems] AS
SELECT
	I3D = P.I3D,
	Kind = P.Art,
	ReceiptI3D = P.KalkKopfI3D,
	Text = ISNULL(CASE WHEN P.Art IN (1,3,4,5,11,12) THEN P.Text ELSE P.Freitext END, ''),
	FontStyle = P.FontStyle,
	FontSize = P.FontSize,
	FontName = P.FontName,
	FontColor = P.FontColor,
	InternalPosition = P.Pos,
	ArticleI3D = P.ArtikelI3D,
	ArticleCode = P.Artikelcode,
	EANCode = P.EANCode,
	ManufacturerCode = P.Herstellercode,
	SupplierManufacturerCode = P.Kreditorcode,
	ChangeStock = CASE WHEN P.Art = 1 THEN TRY_CAST(IIF(ISNULL(A.Abbuchung, 'N')='J' OR ISNULL(A.Abbuchung, 'N')='1',1,0) AS bit) 
		ELSE TRY_CAST(IIF(ISNULL(P.Abbuchung, 'N')='J' OR ISNULL(P.Abbuchung, 'N')='1',1,0) AS bit) END,
	
	CONVERT(DECIMAL(19,7), ROUND(P.Stk,7)) AS QuantityComplete,
	CONVERT(DECIMAL(19,7), ROUND(P.StkGutgeschrieben,7)) AS QuantityProcessed,
	BasePrice = P.Preis,
	VATI3D = P.MwStI3D,
	CONVERT(DECIMAL(9,2), ROUND(ISNULL(P.MwstSatz,0),2)) AS VATRate,
	SpecialAgreementI3D = P.SondervereinbarungI3D,
	CostCenterI3D = P.Kostenstelle,
	CostObjectI3D = P.Kostentraeger,
	WarehouseI3D = P.NebenlagerI3D,
	WEEE = P.WEEE,

    --Anderes
	ExpenseAccount = P.AufwandKTO,
	OriginReceiptItemI3D = P.UebernommenAusI3D,
    OriginReceiptI3D = WP.WareKopfI3D,
	OriginKind = P.UebernommenAusArt,
	FreightAmount = Fracht,
	InsuranceAmount = Versicherung,
	ReceiptOrderItemI3D = P.EKAusAufPosI3D,
	ReceiptOrderI3D = P.AuftragI3D,
	PurchaseOrderQuantity = CONVERT(DECIMAL(19,7), ROUND(P.StkBestellt,7)),
	SupplierDeliveryListQuantity = CONVERT(DECIMAL(19,7), ROUND(P.StkWareneingang,7)),
	IsBooked = CAST(IIF(P.Gebucht = 1, 1, 0) AS BIT),
	DeliveryDatePlanned = P.LieferDatumSoll,
	DeliveryDate = P.LieferDatumIst,
	DeliveryNumber = P.LieferscheinNr,
	RMAItemI3D = P.RMAPosI3D,
    CopyFromI3D = P.CopyFromI3D,
	CopyFromKind = P.CopyFromKind
FROM dbo.KalkPos P
LEFT OUTER JOIN dbo.ARTIK A ON A.I3D = P.ArtikelI3D
LEFT OUTER JOIN dbo.WarePos WP ON WP.I3D = P.UebernommenAusI3D AND P.UebernommenAusArt = 8 --SupplierDeliveryList
        
GO
/****** Object:  Table [dbo].[GeschaeftspartnerTextbausteine]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeschaeftspartnerTextbausteine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TextbausteinName] [varchar](60) NULL,
	[TextbausteinBeschreibung] [text] NULL,
	[KundenI3D] [int] NULL,
	[Status] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[GruppeI3D] [int] NULL,
	[TextbausteinRichtext] [text] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[AccountTextBlocks]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[AccountTextBlocks]
AS
SELECT GT.I3D, ISNULL(GT.TextbausteinName,'') AS Caption, GT.TextbausteinBeschreibung AS Description, 
	GT.TextbausteinRichtext AS DescriptionRTF, ISNULL(GT.Status,0) AS IsActive,
	CASE WHEN GT.KundenI3D <= 0 THEN NULL ELSE GT.KundenI3D END AS AccountI3D, 
	CASE WHEN GT.GruppeI3D <= 0 THEN NULL ELSE GT.GruppeI3D END AS GroupI3D,
	CASE WHEN ISNULL(GT.KundenI3D,0) = 0 THEN 0 ELSE 1 END AS IsOnlyForTickets

FROM GeschaeftspartnerTextbausteine GT
GO
/****** Object:  View [dbo].[Orders]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[Orders] AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptConditionText
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryConditionText
	,CASE WHEN A.ZahlKondRechI3D <= 0 THEN NULL ELSE A.ZahlKondRechI3D END AS PaymentConditionI3D
	,A.RechnungskonditionsText AS PaymentConditionText
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN YEAR(ISNULL(A.Var1Auftrag,0)) < 1905 THEN NULL ELSE A.Var1Auftrag END AS VariableDateField
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,CASE WHEN A.ToDoKomI3D <= 0 THEN NULL ELSE A.ToDoKomI3D END AS CommisionToDoI3D
    ,CASE WHEN A.ToDoMonI3D <= 0 THEN NULL ELSE A.ToDoMonI3D END AS MountingToDoI3D
    ,CASE WHEN A.Produziert > 0 THEN 1 ELSE 0 END AS Produced
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,ISNULL(A.BestellSperre, 0) AS IsPurchasingBlocked
	,ISNULL(A.Leasing, 0) AS IsLeasingActive
	,ISNULL(A.LeasingGebuehr, 0) AS LeasingFee
	,ISNULL(A.LeasingMonate, 0) AS LeasingMonths
	,ISNULL(A.LeasingSatz, 0) AS LeasingRatePercent
	,ISNULL(A.LeasingRate, 0) AS LeasingRatePerMonth
	,ISNULL(A.IsServiceShare, 0) AS IsServiceActive
	,ISNULL(A.ServiceGebuehr, 0) AS ServiceFee
	,ISNULL(A.ServiceMonate, 0) AS ServiceMonths
	,ISNULL(A.ServiceSatz, 0) AS ServiceRatePercent
	,ISNULL(A.ServiceRate, 0) AS ServiceRatePerMonth
	,A.VertragsI3D AS ContractI3D
	,A.CreateHelpdesks AS CreateHelpdesks
	,A.GUI3D AS ConcurrencyControlGuid
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,ISNULL(A.Direktlieferung, 0) AS IsDirectDeliveryPossible
	,A.CampaignI3D
	,A.ReceiptUserStateI3D
    ,A.CommissionMailSetting
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.AufKopf AS A
WHERE ISNULL(A.TerminplanungI3D, 0) = 0
GO
/****** Object:  View [dbo].[cvw_ConsignmentArticleQuantity]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ConsignmentArticleQuantity] AS 
SELECT 
	CASE WHEN a.BarcodeScanen = 1 OR (bc.cnt > 0 and ap.Kommisioniert < bc.cnt) THEN ISNULL(bc.cnt,0) ELSE ISNULL(ap.Kommisioniert,0) END AS ConsignmentQuantity 
	,ap.I3D AS OrderPosI3D, ap.ArtikelI3D AS ArticleI3D  
	FROM dbo.AufPos ap 
	INNER JOIN dbo.AufKopf ak ON ak.I3D = ap.AufKopfI3D AND ak.Status = 1  
	INNER JOIN dbo.ARTIK a ON a.i3d = ap.ArtikelI3D  
LEFT OUTER JOIN  
		(select count(*) cnt, b.AufPosI3D   from barcode b 
		where b.Status = 2 group by  b.AufPosI3D) bc 
   ON bc.AufPosI3D = ap.I3D
GO
/****** Object:  View [dbo].[OrderItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[OrderItems] AS
SELECT AP.I3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.AufKopfI3D, 0) AS ReceiptI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Liefermenge, 0)) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.UrsprungPosI3D AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
	,CONVERT(DECIMAL(19,7), ISNULL(CAQ.ConsignmentQuantity, 0)) AS QuantityPicked
	,AP.WEEE AS WEEE
	,AP.Bestellinformation AS PurchaseInformations
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,CASE WHEN AP.HelpdeskI3D <= 0 THEN NULL ELSE AP.HelpdeskI3D END AS HelpdeskI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.EKStkBestellt, 0)) AS QuantityOrdered
	,AP.PurchasePriceSupplierI3D AS PurchasePriceSupplierI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,AP.InternalNote AS InternalNote
	,AP.PlannedDurationInHours AS PlannedDurationInHours
	,AP.LizenzDatum AS LicenseDate
	,AP.BVLInfo AS SuggestionInfo
	,AP.Direktlieferung AS IsDirectDeliveryPossible
	,CASE WHEN AP.GeraeteBarcodeI3D <= 0 THEN NULL ELSE AP.GeraeteBarcodeI3D END AS MasterDataListSerialNumberI3D
	,AP.IsReverseCharge
	,CAST(ISNULL(AP.isLeasing,0) AS BIT) AS IsLeasing
	,CAST(ISNULL(AP.isService,0) AS BIT) AS IsService
FROM dbo.AufPos AS AP
LEFT OUTER JOIN dbo.cvw_ConsignmentArticleQuantity CAQ ON CAQ.OrderPosI3D = AP.I3D
GO
/****** Object:  View [dbo].[cvw_OrderPosLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OrderPosLC]
AS
SELECT AP.I3D
	,AP.VATI3D
	,AP.InternalPosition
	,AP.Kind
	,AP.Expanded
	,AP.ArticlePositionKind
	,AP.GroupID
	,AP.Indent
	,CASE WHEN AP.isReverseCharge = 1 AND AP.VATI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.ReceiptI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0) - ISNULL(AP.QuantityProcessed, 0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityComplete,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.QuantityProcessed,0)) AS QuantityProcessed
	, Calc.NetPrice
	, Calc.TaxPrice
	, Calc.NetPriceFC
	, Calc.TaxPriceFC
	, Calc.NetPriceTotal
	, Calc.TaxPriceTotal
	, Calc.NetPriceTotalComplete
	, Calc.TaxPriceTotalComplete
	, Calc.NetPriceTotalFC
	, Calc.TaxPriceTotalFC
	, Calc.NetPriceTotalFCComplete
	, Calc.TaxPriceTotalFCComplete
	, Calc.NetPurchasePrice
	, Calc.TaxPurchasePrice
	, Calc.NetPurchasePriceFC
	, Calc.TaxPurchasePriceFC
	, Calc.NetPurchasePriceTotal
	, Calc.TaxPurchasePriceTotal
	, Calc.NetPurchasePriceTotalComplete
	, Calc.TaxPurchasePriceTotalComplete
	, Calc.NetPurchasePriceTotalFC
	, Calc.TaxPurchasePriceTotalFC
	, Calc.NetPurchasePriceTotalFCComplete
	, Calc.TaxPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Discount,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.ExclusiveOfVAT = 1 THEN 0 ELSE ROUND(ISNULL(AP.VATRate,0),2)END) AS VATRate
FROM dbo.OrderItems AS AP
INNER JOIN dbo.Orders AS A ON AP.ReceiptI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArticleI3D = AR.I3D
CROSS APPLY dbo.cfn_CalculateReceiptAmounts(
	CASE WHEN AP.Kind IN (1,3) THEN 1 ELSE 0 END
	,CASE WHEN AP.Kind IN (1,3) AND AP.ArticlePositionKind IN (0,50) THEN 1 ELSE 0 END
	,AP.BasePrice, AP.PurchaseBasePrice, ISNULL(AR.Nachkommastellen,2), ISNULL(AP.Discount,0), A.CurrencyFactor, CONVERT(bit,A.ExclusiveOfVAT), AP.VATRate, A.IsCashAsset, AP.QuantityComplete, AP.QuantityProcessed) AS Calc
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.CountryI3D
GO
/****** Object:  View [dbo].[cvw_OfferHeadVATPriceSplitLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OfferHeadVATPriceSplitLC]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
FROM dbo.cvw_OfferPosLC
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_OrderHeadVATPriceSplitLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OrderHeadVATPriceSplitLC]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFCComplete
FROM dbo.cvw_OrderPosLC AS AP
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_DeliveryListHeadVATPriceSplitLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_DeliveryListHeadVATPriceSplitLC]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFCComplete
FROM dbo.cvw_DeliveryListPosLC
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  Table [dbo].[RechKopfVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RechKopfVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[Datum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[LieferBedID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[AusAuf] [varchar](10) NULL,
	[Service] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[Garantie] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[FaelligAm] [datetime] NULL,
	[Mahnung1Datum] [datetime] NULL,
	[Mahnung1BearbeiterI3D] [int] NULL,
	[Mahnung2Datum] [datetime] NULL,
	[Mahnung3Datum] [datetime] NULL,
	[MahnInfo] [varchar](max) NULL,
	[Mahnstufe] [int] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[Bezahlt] [int] NULL,
	[AbwKundeI3D] [int] NULL,
	[AbwAnschriftI3D] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[Zusatztext] [varchar](70) NULL,
	[BestNr] [varchar](50) NULL,
	[ProjNr] [varchar](50) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[RechKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[MahnStop] [int] NULL,
	[Bar] [int] NULL,
	[MahnStopp] [int] NULL,
	[Archiviert] [int] NULL,
	[VertragsI3D] [int] NULL,
	[Nachkalkulation] [int] NULL,
	[OriginalI3D] [int] NULL,
	[Direktlieferung] [int] NULL,
	[ToDoI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[OposImportInfo] [varchar](255) NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](1000) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[DTinErstellt] [int] NULL,
	[DTinDatum] [datetime] NULL,
	[DTinBearbeiter] [int] NULL,
	[Mahnung2BearbeiterI3D] [int] NULL,
	[Mahnung3BearbeiterI3D] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[Trackingnummer] [varchar](500) NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[ExportHaben] [float] NULL,
	[LiefEskDatum] [datetime] NULL,
	[Var1Rechnung] [datetime] NULL,
	[Rabatt] [float] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[ESRKodierzeileBetrag] [varchar](30) NULL,
	[ESRReferenznummer] [varchar](40) NULL,
	[ESRBetrag] [varchar](20) NULL,
	[SummeEKOriginal] [float] NULL,
	[BezahltDifferenz] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[EDIExport] [int] NULL,
	[EDIExportVonI3D] [int] NULL,
	[EDIExportAm] [datetime] NULL,
	[FIBUSammelkonto] [varchar](24) NULL,
	[IsPositionProvision] [bit] NULL,
	[SepaMandateI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFCComplete] [decimal](19, 2) NOT NULL,
	[IsFixed] [bit] NOT NULL,
	[ExternalInvoiceNumber] [nvarchar](50) NULL,
	[ExternalInvoiceDate] [datetime2](7) NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[TrackingNumberURL] [nvarchar](2000) NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[DunningStopBegin] [datetime2](0) NULL,
	[DunningStopEnd] [datetime2](0) NULL,
	[DownPaymentForOrderI3D] [int] NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[InvoiceVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[InvoiceVersions] AS
SELECT A.I3D
	,A.OriginalI3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentConditionText
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryConditionText
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN YEAR(ISNULL(A.Var1Rechnung,0)) < 1905 THEN NULL ELSE A.Var1Rechnung END AS VariableDateField
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.ESRBetrag AS EsrAmount
	,A.ESRKodierzeileBetrag AS EsrCodelineAmount
	,A.ESRReferenznummer AS EsrReferenceNumber
	,A.IsFixed
	,A.VertragsI3D AS ContractI3D
	,ISNULL(A.LiefKundFremd, 0) AS UsedAlternativeDeliveryAddress
	,ISNULL(A.RechKundFremd, 0) AS UsedAlternativeInvoiceAddress
	,A.SepaMandateI3D AS MandatI3D
	,A.GUI3D AS ConcurrencyControlGuid
	,ISNULL(A.Bezahlt, 0) AS PaidFC
	,CASE WHEN YEAR(ISNULL(A.FaelligAm,0)) < 1905 THEN NULL ELSE A.FaelligAm END AS PaymentDueDate
	,A.ExternalInvoiceDate AS ExternalInvoiceDate
	,A.ExternalInvoiceNumber AS ExternalInvoiceNumber
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.FIBUSammelkonto AS CollectiveAccount
	,A.CampaignI3D	
	,A.Trackingnummer AS TrackingNumber
	,A.TrackingNumberURL
	,A.ReceiptUserStateI3D
	,A.DownPaymentForOrderI3D
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.RechKopfVersions AS A
GO
/****** Object:  Table [dbo].[SeriennummerToPosition]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SeriennummerToPosition](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SNI3D] [int] NOT NULL,
	[PosI3D] [int] NOT NULL,
	[KopfI3D] [int] NOT NULL,
	[KopfNummer] [int] NOT NULL,
	[Datum] [datetime] NOT NULL,
	[ObjektArt] [int] NULL,
	[AktuelleVersion] [int] NULL,
	[Aktuell] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Taetigkeiten]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Taetigkeiten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundeI3D] [int] NULL,
	[AnsprechI3D] [int] NULL,
	[TaetigkeitsTYP] [int] NULL,
	[Name] [varchar](255) NULL,
	[Text] [varchar](5000) NULL,
	[TaetDirI3D] [int] NULL,
	[DocI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Faelligkeitsdatum] [datetime] NULL,
	[WiedervorlageDatum] [datetime] NULL,
	[EndDatum] [datetime] NULL,
	[Status] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[ImageIndex] [int] NULL,
	[EmpfaengerI3D] [int] NULL,
	[NeuKunde] [int] NULL,
	[ToDoI3D] [int] NULL,
	[OutlookI3D] [int] NULL,
	[OutlookTermI3D] [varchar](500) NULL,
	[OutlookSync] [int] NULL,
	[EmailNachricht] [int] NULL,
	[SonderaktionI3D] [int] NULL,
	[BesuchsberichtDocI3D] [int] NULL,
	[CRMProjektI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
	[ObjektNr] [int] NULL,
	[BarcodeI3D] [int] NULL,
	[Bewertung] [int] NULL,
	[TargetEmployeI3D] [int] NULL,
 CONSTRAINT [PK_Taetigkeiten] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Produktfamilie]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Produktfamilie](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProduktfamilieHerstellerI3D] [int] NULL,
	[Bezeichnung] [varchar](200) NULL,
	[Status] [int] NULL,
	[LaufzeitMonate] [int] NULL,
	[ErinnerungTage] [int] NULL,
	[LaufzeitEndeBestimmtMwSt] [bit] NULL,
	[OfferTemplateI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProduktfamilieKundenSperren]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProduktfamilieKundenSperren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[ProduktfamilieI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProduktfamiliePositionSperren]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProduktfamiliePositionSperren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProduktfamilieI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
	[BarcodeI3D] [int] NULL,
	[PosI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_InvoicePos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

       CREATE VIEW [dbo].[cvw_InvoicePos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END AS Text
	,AP.RichText
	,AP.BestellNr AS PurchaseOrderNumber
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.Lieferdatum AS DeliveryDate
	,AP.Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,ISNULL(AP.Artikelpositionsart,0) AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,CASE WHEN AP.IsReverseCharge = 1 AND AP.MwstI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.RechKopfI3D AS InvoiceHeadI3D
	,AP.RechKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0) - ISNULL(AP.numGutAbhol, 0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.numGutAbhol,0)) AS QuantityProcessed
	,AP.CalculatedNetPrice                           AS NetPrice
	,AP.CalculatedTaxPrice                           AS TaxPrice
	,AP.CalculatedNetPriceFC                         AS NetPriceFC
	,AP.CalculatedTaxPriceFC                         AS TaxPriceFC
	,AP.CalculatedNetPriceTotal                      AS NetPriceTotal
	,AP.CalculatedTaxPriceTotal                      AS TaxPriceTotal
	,AP.CalculatedNetPriceTotalComplete              AS NetPriceTotalComplete
	,AP.CalculatedTaxPriceTotalComplete              AS TaxPriceTotalComplete
	,AP.CalculatedNetPriceTotalFC                    AS NetPriceTotalFC
	,AP.CalculatedTaxPriceTotalFC                    AS TaxPriceTotalFC
	,AP.CalculatedNetPriceTotalFCComplete            AS NetPriceTotalFCComplete
	,AP.CalculatedTaxPriceTotalFCComplete            AS TaxPriceTotalFCComplete
	,AP.CalculatedNetPurchasePrice                   AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,AP.CalculatedNetPurchasePriceFC                 AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,AP.CalculatedNetPurchasePriceTotal              AS NetPurchasePriceTotal
	,NULL AS TaxPurchasePriceTotal
	,AP.CalculatedNetPurchasePriceTotalComplete      AS NetPurchasePriceTotalComplete
	,NULL AS TaxPurchasePriceTotalComplete
	,AP.CalculatedNetPurchasePriceTotalFC            AS NetPurchasePriceTotalFC
	,NULL AS TaxPurchasePriceTotalFC
	,AP.CalculatedNetPurchasePriceTotalFCComplete    AS NetPurchasePriceTotalFCComplete
	,NULL AS TaxPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Rabatt,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStNichtAusweisbar = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
	,AP.IsReverseCharge
FROM dbo.RechPos AS AP
INNER JOIN dbo.RechKopf AS A ON AP.RechKopfI3D = A.I3D
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.LandI3D
    
GO
/****** Object:  Table [dbo].[GeraeteKopf]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SeriennummerI3D] [int] NULL,
	[Seriennummer] [varchar](50) NULL,
	[Code] [varchar](60) NULL,
	[Text] [varchar](1000) NULL,
	[RechPosI3D] [int] NULL,
	[Rechnummer] [int] NULL,
	[Rechdatum] [datetime] NULL,
	[ErstellerPersonalI3D] [int] NULL,
	[Erstelldatum] [datetime] NULL,
	[Aenderungsdatum] [datetime] NULL,
	[AenderungPersonI3D] [int] NULL,
	[ClickGeraet] [int] NULL,
	[KundenI3D] [int] NULL,
	[HauptgeraetI3D] [int] NULL,
	[EOL] [int] NULL,
	[CManID] [varchar](255) NULL,
	[Status] [int] NULL,
	[Nummer] [int] NULL,
	[CurrencyI3D] [int] NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyString] [varchar](10) NULL,
	[Bar] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[Version] [int] NULL,
	[Standort] [varchar](150) NULL,
	[StandortLang] [text] NULL,
	[CentronVersion] [varchar](20) NULL,
	[DocDiri3D] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[AnschriftID] [int] NULL,
	[Datum] [datetime] NULL,
	[Empfaenger] [varchar](500) NULL,
	[Strasse] [varchar](50) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Info] [varchar](8000) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[BearbeiterI3D] [int] NULL,
	[Tel] [varchar](30) NULL,
	[InfoAnzeigen] [int] NULL,
	[Brutto] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[Netto] [float] NULL,
	[NettoOriginal] [float] NULL,
	[PersonID] [int] NULL,
	[Ansprech] [varchar](60) NULL,
	[Rabatt] [float] NULL,
	[LandI3D] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[ToDoI3D] [int] NULL,
	[AussendienstID] [int] NULL,
	[Ersteller] [varchar](50) NULL,
	[FilialI3D] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[InnendienstID] [int] NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[FreeInventoryNumber] [nvarchar](50) NULL,
	[IsMsp] [bit] NOT NULL,
 CONSTRAINT [PK_GeraeteKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_InvoiceLicenseOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_InvoiceLicenseOverview]
AS
SELECT
ROW_NUMBER() OVER (ORDER BY KU.I3D,RP.ArticleI3D,RP.I3D) AS RowNumber
,RP.ArticleI3D
,RP.ArticleCode
,RP.QuantityComplete
,IPCalc.NetPrice
,IPCalc.NetPriceTotal
,(DATEADD( MONTH, ISNULL(PF.LaufzeitMonate, 0), ISNULL(RP.LicenseDate, RK.Datum))) AS ExpirationDate
,A.Artikelbeschreibung AS ArticleDescription
,RP.ManufacturerCode
,RP.EANCode
,KU.I3D AS CustomerNumber
,KU.Name AS CustomerName
,KU.Fon AS CustomerPhone
,KU.KdEMail AS CustomerEMail
,ISNULL(PFKS.Status, 0) AS CustomerLockedForPLM
,SIGN(ISNULL(PFPS.Status, 0) + ISNULL(PFKS.Status, 0)) AS ReceiptItemLockedForPLM
,RK.I3D AS InvoiceI3D
,RK.Nummer AS InvoiceNumber
,RK.Datum AS InvoiceDate
,B.Barcode AS Serialnumber
,B.I3D AS SerialnumberI3D
,PIDM.KurzZeich AS Adviser1ShortSign
,PADM.KurzZeich AS Adviser2ShortSign
,PTECH.KurzZeich AS Adviser3ShortSign
,PTECH2.KurzZeich AS Adviser4ShortSign
,ISNULL(GERK.[Count],0) AS DeviceCount
,CONVERT(BIT,IIF(ISNULL(T.Count,0) > 0, 1, 0)) AS HasCrmActivity
,AN.Plz AS CustomerZip
,AN.Ort AS CustomerCity
,PF.Bezeichnung AS ProductFamilyCaption
,PF.LaufzeitMonate AS LifeCycleInMonths
FROM dbo.InvoiceItems RP
INNER JOIN dbo.cvw_InvoicePos IPCalc ON IPCalc.I3D = RP.I3D
INNER JOIN dbo.Artik A ON RP.ArticleI3D = A.I3D
INNER JOIN dbo.RechKopf RK ON RK.I3D = RP.ReceiptI3D
INNER JOIN dbo.Kunden KU ON KU.I3D = RK.KundenID
LEFT OUTER JOIN dbo.Anschrif AN ON AN.Kunde = KU.I3D AND AN.KundeDefault = 1 AND AN.Status = 1
LEFT OUTER JOIN dbo.SeriennummerToPosition STP ON RP.I3D = STP.PosI3D AND STP.Aktuell = 1 AND STP.ObjektArt = 4
LEFT OUTER JOIN dbo.Barcode B ON B.I3D = STP.SNI3D
LEFT OUTER JOIN dbo.ProduktfamilieKundenSperren PFKS ON PFKS.KundenI3D = KU.I3D
LEFT OUTER JOIN dbo.ProduktfamiliePositionSperren PFPS ON PFPS.ArtikelI3D = RP.ArticleI3D AND PFPS.BarcodeI3D = B.I3D
INNER JOIN Produktfamilie PF ON PF.I3D = A.ProduktfamilieI3D
LEFT OUTER JOIN Personal PADM ON PADM.I3D = RK.AussendienstID
LEFT OUTER JOIN Personal PIDM ON PIDM.I3D = RK.InnendienstID
LEFT OUTER JOIN Personal PTECH ON PTECH.I3D = RK.TechnikerID
LEFT OUTER JOIN Personal PTECH2 ON PTECH2.I3D = RK.Techniker2ID
LEFT OUTER JOIN
(
SELECT GK.SeriennummerI3D, COUNT(*) AS [Count]
FROM dbo.GeraeteKopf GK
GROUP BY GK.SeriennummerI3D
) GERK ON GERK.SeriennummerI3D = STP.SNI3D
LEFT OUTER JOIN
(
SELECT T.KundeI3D, T.BarcodeI3D, COUNT(*) AS [Count]
FROM dbo.Taetigkeiten T
WHERE T.ObjektArt = 5000012
GROUP BY T.KundeI3D, T.BarcodeI3D
) T ON T.KundeI3D = RK.KundenID AND T.BarcodeI3D = B.I3D
AND A.KeineProduktfamilienPflicht = 0

GO
/****** Object:  View [dbo].[cvw_InvoiceHeadVATPriceSplitLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_InvoiceHeadVATPriceSplitLC]
AS
SELECT        
	IP.HeadI3D, 
	IP.VATI3D, 
	IP.VATRate, 
	IP.IsReverseChargeActive,
	SUM(IP.NetPriceTotal) AS NetPriceTotal, 
	CONVERT(NUMERIC(19, 2), SUM(IP.TaxPriceTotal)) AS TaxPriceTotal, 
	SUM(IP.NetPriceTotalComplete) AS NetPriceTotalComplete, 
	CONVERT(NUMERIC(19, 2), SUM(IP.TaxPriceTotalComplete)) AS TaxPriceTotalComplete, 
	SUM(IP.NetPriceTotalFC) AS NetPriceTotalFC, 
	CONVERT(NUMERIC(19, 2), SUM(IP.TaxPriceTotalFC)) AS TaxPriceTotalFC, 
	SUM(IP.NetPriceTotalFCComplete) AS NetPriceTotalFCComplete, 
	CONVERT(NUMERIC(19, 2), SUM(IP.TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete, 
	SUM(IP.NetPurchasePriceTotal) AS NetPurchasePriceTotal, 
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal, 
	SUM(IP.NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete, 
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalComplete, 
	SUM(IP.NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC, 
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC, 
	SUM(IP.NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete, 
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFCComplete
FROM dbo.cvw_InvoicePosLC IP
WHERE (IP.Kind IN (1, 3)) 
AND (ISNULL(IP.ArticlePositionKind, 0) IN (0, 50)) 
AND (IP.Expanded IS NULL)
GROUP BY 
	IP.HeadI3D, 
	IP.VATI3D, 
	IP.VATRate, 
	IP.IsReverseChargeActive
GO
/****** Object:  UserDefinedFunction [dbo].[cfn_FormatArticleCaption]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[cfn_FormatArticleCaption]
(	
	@I3D int,
	@ArticleCode nvarchar(60),
	@ShortDescription nvarchar(150),
	@Description nvarchar(max),
	@MaxCaptionLength int
)
RETURNS TABLE 
AS
RETURN 
(
	SELECT 
		@I3D AS I3D
		,CASE WHEN LTRIM(@ShortDescription) <> '' THEN 
			SUBSTRING(REPLACE(REPLACE(LTRIM(@ShortDescription), CHAR(10), ''), CHAR(13),''), 0, @MaxCaptionLength) + ' (' + @ArticleCode + ')' 
		ELSE SUBSTRING(REPLACE(REPLACE(LTRIM(@Description), CHAR(10), ''), CHAR(13),''), 0, @MaxCaptionLength) + ' (' + @ArticleCode + ')'
		END AS ArticleCaption
)
GO
/****** Object:  Table [dbo].[BarcodeConditions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BarcodeConditions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](200) NOT NULL,
	[ConditionInPercent] [tinyint] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[IsDefault] [bit] NOT NULL,
 CONSTRAINT [PK_BarcodeConditions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_BarcodesOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_BarcodesOverview] AS
SELECT 
	B.I3D
	,B.Status
	,B.Barcode AS Caption
	,B.Beschreibung AS Description
	,A.I3D AS ArticleI3D
	,A.Artikelcode AS ArticleCode
	,AC.ArticleCaption AS ArticleCaption
	,CASE WHEN ISNULL(B.VerlustInventurI3D,0) <= 0 THEN NULL ELSE B.VerlustInventurI3D END AS LostInInventoryI3D
	,CASE WHEN B.LagerI3D = 0 THEN -1 ELSE B.LagerI3D END AS WarehouseI3D
	,W.Caption AS WarehouseCaption
	,BC.I3D AS ConditionI3D
	,BC.ConditionInPercent
	,BC.Caption AS ConditionCaption
FROM Barcode B
INNER JOIN ARTIK A ON A.I3D = B.ArtikelI3D
LEFT OUTER JOIN Warehouses W ON W.I3D = CASE WHEN B.LagerI3D = 0 THEN -1 ELSE B.LagerI3D END
LEFT OUTER JOIN (SELECT TOP 1 I3D FROM BarcodeConditions WHERE IsDefault = 1) AS DefBC ON DefBC.I3D IS NOT NULL
LEFT OUTER JOIN BarcodeConditions BC ON BC.I3D = ISNULL(B.BarcodeConditionI3D,DefBC.I3D)
CROSS APPLY dbo.cfn_FormatArticleCaption(A.I3D, A.Artikelcode, A.Kurzbegriff, A.Artikelbeschreibung, 30) AS AC
GO
/****** Object:  Table [dbo].[AssetManagementCrawlerConfigurations]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCrawlerConfigurations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[IsHardDriveCheckEnabled] [bit] NOT NULL,
	[HardDriveCheckInterval] [int] NOT NULL,
	[IsPatchesCheckEnabled] [bit] NOT NULL,
	[PatchesCheckInterval] [int] NOT NULL,
	[IsWindowsServiceCheckEnabled] [bit] NOT NULL,
	[WindowsServiceCheckInterval] [int] NOT NULL,
	[IsAntivirusCheckEnabled] [bit] NOT NULL,
	[AntivirusCheckInterval] [int] NOT NULL,
	[IsPingCheckEnabled] [bit] NOT NULL,
	[PingCheckInterval] [int] NOT NULL,
	[IsSnmpBackupCheckEnabled] [bit] NOT NULL,
	[SnmpBackupCheckInterval] [int] NOT NULL,
	[IsSqlCheckEnabled] [bit] NOT NULL,
	[SqlCheckInterval] [int] NOT NULL,
	[IsEventLogCheckEnabled] [bit] NOT NULL,
	[EventLogCheckInterval] [int] NOT NULL,
	[IsPowerShellCheckEnabled] [bit] NOT NULL,
	[PowerShellCheckInterval] [int] NOT NULL,
	[IsVendorWarrantyCheckEnabled] [bit] NOT NULL,
	[VendorWarrantyCheckInterval] [int] NOT NULL,
	[IsMSBackupCheckEnabled] [bit] NOT NULL,
	[MSBackupCheckInterval] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[IsBackupStatusCheckEnabled] [bit] NOT NULL,
	[BackupStatusCheckInterval] [int] NOT NULL,
	[IsHttpCheckEnabled] [bit] NOT NULL,
	[HttpCheckInterval] [int] NOT NULL,
	[IsSnmpCheckEnabled] [bit] NOT NULL,
	[SnmpCheckInterval] [int] NOT NULL,
	[ExecutionTypeI3D] [int] NOT NULL,
	[IsImmediateExecute] [bit] NOT NULL,
	[IsImmediateExecutePicked] [bit] NOT NULL,
	[IsHardDriveCheckExecutionStart] [bit] NOT NULL,
	[IsPatchesCheckExecutionStart] [bit] NOT NULL,
	[IsWindowsServiceCheckExecutionStart] [bit] NOT NULL,
	[IsAntivirusCheckExecutionStart] [bit] NOT NULL,
	[IsPingCheckExecutionStart] [bit] NOT NULL,
	[IsSnmpBackupCheckExecutionStart] [bit] NOT NULL,
	[IsSqlCheckExecutionStart] [bit] NOT NULL,
	[IsEventLogCheckExecutionStart] [bit] NOT NULL,
	[IsPowerShellCheckExecutionStart] [bit] NOT NULL,
	[IsVendorWarrantyCheckExecutionStart] [bit] NOT NULL,
	[IsMSBackupCheckExecutionStart] [bit] NOT NULL,
	[IsBackupStatusCheckExecutionStart] [bit] NOT NULL,
	[IsHttpCheckExecutionStart] [bit] NOT NULL,
	[IsSnmpCheckExecutionStart] [bit] NOT NULL,
	[IsSslCertificateCheckEnabled] [bit] NOT NULL,
	[SslCertificateCheckInterval] [int] NOT NULL,
	[IsSslCertificateCheckExecutionStart] [int] NOT NULL,
	[IsCreateHelpdesk] [bit] NOT NULL,
	[HelpdeskStartTime] [datetime] NULL,
	[HelpdeskEndTime] [datetime] NULL,
	[IsPerformanceCheckEnabled] [bit] NOT NULL,
	[PerformanceCheckInterval] [int] NOT NULL,
	[IsPerformanceCheckExecutionStart] [bit] NOT NULL,
	[IsLoginFailedCheckEnabled] [bit] NOT NULL,
	[LoginFailedCheckInterval] [int] NOT NULL,
	[IsLoginFailedCheckExecutionStart] [bit] NOT NULL,
 CONSTRAINT [PK_CSI_AssetManagementCrawlerConfigurations] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementCrawlerConfigurationsOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementCrawlerConfigurationsOverview]
        AS
	      SELECT AMCC.I3D, AMCC.CustomerI3D, Cust.Name AS CustomerName, AMCC.DeviceI3D, ISNULL(AMD.ShortName, '') AS DeviceName, AMCC.IsHardDriveCheckEnabled, AMCC.HardDriveCheckInterval,
			      AMCC.IsPatchesCheckEnabled, AMCC.PatchesCheckInterval, AMCC.IsWindowsServiceCheckEnabled, AMCC.WindowsServiceCheckInterval, AMCC.IsAntivirusCheckEnabled, 
			      AMCC.AntivirusCheckInterval, AMCC.IsPingCheckEnabled, AMCC.PingCheckInterval, AMCC.IsSnmpBackupCheckEnabled, AMCC.SnmpBackupCheckInterval, AMCC.IsSqlCheckEnabled, 
			      AMCC.SqlCheckInterval, AMCC.IsEventLogCheckEnabled, AMCC.EventLogCheckInterval, AMCC.IsPowerShellCheckEnabled, AMCC.PowerShellCheckInterval, AMCC.IsVendorWarrantyCheckEnabled, 
			      AMCC.VendorWarrantyCheckInterval, AMCC.IsMSBackupCheckEnabled, AMCC.MSBackupCheckInterval, AMCC.IsActive, AMCC.IsBackupStatusCheckEnabled, AMCC.BackupStatusCheckInterval, 
			      AMCC.IsHttpCheckEnabled, AMCC.HttpCheckInterval, AMCC.IsSnmpCheckEnabled, AMCC.SnmpCheckInterval, AMCC.ExecutionTypeI3D, AMCC.IsImmediateExecute, 
			      AMCC.IsImmediateExecutePicked, AMCC.IsHardDriveCheckExecutionStart, AMCC.IsPatchesCheckExecutionStart, AMCC.IsWindowsServiceCheckExecutionStart, 
			      AMCC.IsAntivirusCheckExecutionStart, AMCC.IsPingCheckExecutionStart, AMCC.IsSnmpBackupCheckExecutionStart, AMCC.IsSqlCheckExecutionStart, 
			      AMCC.IsEventLogCheckExecutionStart, AMCC.IsPowerShellCheckExecutionStart, AMCC.IsVendorWarrantyCheckExecutionStart, AMCC.IsMSBackupCheckExecutionStart, 
			      AMCC.IsBackupStatusCheckExecutionStart, AMCC.IsHttpCheckExecutionStart, AMCC.IsSnmpCheckExecutionStart, AMCC.IsSslCertificateCheckEnabled, 
			      AMCC.SslCertificateCheckInterval, AMCC.IsSslCertificateCheckExecutionStart, AMCC.IsCreateHelpdesk, AMCC.HelpdeskStartTime, AMCC.HelpdeskEndTime, 
			      AMCC.IsLoginFailedCheckEnabled, AMCC.LoginFailedCheckInterval, AMCC.IsLoginFailedCheckExecutionStart, AMCC.IsPerformanceCheckEnabled, 
			      AMCC.PerformanceCheckInterval, AMCC.IsPerformanceCheckExecutionStart
	      FROM dbo.AssetManagementCrawlerConfigurations AS AMCC INNER JOIN
			      dbo.AssetManagementDevices AS AMD ON AMD.I3D = AMCC.DeviceI3D INNER JOIN
			      dbo.Kunden AS Cust ON Cust.I3D = AMCC.CustomerI3D
	      WHERE (Cust.Status = 1) AND (Cust.Gesperrt IS NULL OR Cust.Gesperrt = 0)
      
GO
/****** Object:  View [dbo].[cvw_PickupListHeadVATPriceSplitLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_PickupListHeadVATPriceSplitLC]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
FROM dbo.cvw_PickupListPosLC
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  Table [dbo].[Vertriebssteuerung]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Vertriebssteuerung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kurztext] [varchar](30) NULL,
	[Langtext] [varchar](250) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenHerkunft]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenHerkunft](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kurztext] [varchar](50) NULL,
	[Langtext] [varchar](500) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountOrderProcessingContracts]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountOrderProcessingContracts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[State] [tinyint] NOT NULL,
	[WordDocument] [varbinary](max) NULL,
	[DocumentI3D] [int] NULL,
	[Name] [nvarchar](128) NULL,
	[ContactI3D] [int] NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedBy] [int] NULL,
	[ChangedDate] [datetime2](7) NULL,
	[TestMode] [bit] NOT NULL,
	[TestModeMailAddress] [nvarchar](128) NULL,
	[DeclineReason] [nvarchar](max) NULL,
	[MailSubject] [nvarchar](128) NULL,
	[MailBody] [nvarchar](max) NULL,
	[AcceptMailSubject] [nvarchar](128) NULL,
	[AcceptMailBody] [nvarchar](max) NULL,
	[CreatorAcceptMailSubject] [nvarchar](128) NULL,
	[CreatorAcceptMailBody] [nvarchar](max) NULL,
	[DeclinedMailSubject] [nvarchar](128) NULL,
	[DeclinedMailBody] [nvarchar](max) NULL,
	[UseOwnTemplateText] [bit] NOT NULL,
	[AlternativeEmailContactI3D] [int] NULL,
	[ContractNameForCustomerPdf] [nvarchar](256) NULL,
	[ContractNameForCentronFiles] [nvarchar](256) NULL,
 CONSTRAINT [PK_AccountOrderProcessingContracts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenKlassifizierung]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenKlassifizierung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundeToKonzern]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundeToKonzern](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[KonzernI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteConnections]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteConnections](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ConnectionName] [nvarchar](255) NOT NULL,
	[DisplayName] [nvarchar](255) NULL,
	[Description] [nvarchar](255) NULL,
	[RemoteTypeI3D] [int] NOT NULL,
	[FolderI3D] [int] NULL,
	[CustomerI3D] [int] NOT NULL,
	[SettingValue] [int] NULL,
	[CredetialValue] [int] NULL,
	[SettingGroupValue] [nvarchar](253) NULL,
	[CredentialGroupValue] [nvarchar](253) NULL,
	[DeviceI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Vertriebsgebiete]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Vertriebsgebiete](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kurztext] [varchar](30) NULL,
	[Langtext] [varchar](250) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AccountSearch]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_AccountSearch]
AS
SELECT 
    K.I3D AS AccountI3D
    , 1 AS AccountType
    , 'Kunde' AS AccountTypeCaptions
    , NULL AS AccountNumber
    , K.I3D AS CustomerNumber
    , NULL AS SupplierNumber
    , KClassif.I3D AS ClassificationI3D
    , KClassif.Name AS ClassificationCaption
    , KVert.I3D AS SalesControllingI3D
    , KVert.Kurztext AS SalesControllingCaption
    , K.Freitext01 AS FreeText01
    , ISNULL(K.Status, 0) AS IsActive
    , ISNULL(K.Gesperrt,0) AS IsLocked
    , ISNULL(K.Kurzbezeichnung,'') AS AccountMatchcode
    , K.Name AS AccountName
    , ISNULL(K.Fon,'') AS AccountPhone
    , ISNULL(K.Fax,'') AS AccountFax
    , ISNULL(K.KdEMail,'') AS AccountEMail
    , ISNULL(K.KdWWW,'') AS AccountWebsite
    , PA1.I3D AS Adviser1I3D
    , dbo.cfn_CreateEmployeeFullName(PA1.Vorname, PA1.Name, PA1.KurzZeich) AS Adviser1FullName
    , PA1.EMail AS Adviser1EMail
    , PA2.I3D AS Adviser2I3D
    , dbo.cfn_CreateEmployeeFullName(PA2.Vorname, PA2.Name, PA2.KurzZeich) AS Adviser2FullName
    , PA2.EMail AS Adviser2EMail
    , PA3.I3D AS Adviser3I3D
    , dbo.cfn_CreateEmployeeFullName(PA3.Vorname, PA3.Name, PA3.KurzZeich) AS Adviser3FullName
    , PA3.EMail AS Adviser3EMail
    , PA4.I3D AS Adviser4I3D
    , dbo.cfn_CreateEmployeeFullName(PA4.Vorname, PA4.Name, PA4.KurzZeich) AS Adviser4FullName
    , PA4.EMail AS Adviser4EMail
    , PA5.I3D AS Adviser5I3D
    , dbo.cfn_CreateEmployeeFullName(PA5.Vorname, PA5.Name, PA5.KurzZeich) AS Adviser5FullName
    , PA5.EMail AS Adviser5EMail
    , PA6.I3D AS Adviser6I3D
    , dbo.cfn_CreateEmployeeFullName(PA6.Vorname, PA6.Name, PA6.KurzZeich) AS Adviser6FullName
    , PA6.EMail AS Adviser6EMail
    , ISNULL(K.Firmenkunde,0) AS IsAccountKind1
    , ISNULL(K.Endkunde,0) AS IsAccountKind2
    , ISNULL(K.Haendler,0) AS IsAccountKind3
    , ISNULL(K.Interessent,0) AS IsAccountKind4
    , ISNULL(K.KundenArt5, 0) AS IsAccountKind5
    , K.RootDirI3D AS RootDirectoryI3D
    , KO.I3D AS AccountOriginI3D
    , KO.Kurztext AS AccountOriginName
    , A.I3D AS AddressI3D
    , A.I3D AS AddressOldReferenceI3D
    , ISNULL(A.KundeDefault,0) AS IsDefaultAddress
    , A.Abteilung AS AddressDepartment
    , A.Strasse AS AddressStreet
    , A.Plz AS AddressZip
    , A.Ort AS AddressCity
    , A.PostfachAktiv AS IsAddressPostboxActive
    , A.Postfach AS AddressPostbox
	, ISNULL(A.DruckAbteilung, 0) AS PrintDepartment
	, ISNULL(A.DruckAbteilungAnsprech, 0) AS PrintDepartmentAddressContact
	, ISNULL(A.DruckAnsprech, 0) AS PrintAddressContact
	, ISNULL(A.DruckArt, 0) AS PrintName
    , AL.I3D AS AddressCountryI3D
    , AL.Land AS AddressCountryName
    , ISNULL(P.I3D, 0) AS AddressContactI3D
    , ISNULL(P.I3D, 0) AS AddressContactOldReferenceI3D
    , CASE WHEN P.I3D IS NULL THEN 1 ELSE ISNULL(P.Standard,0) END AS IsDefaultAddressContact
    , PA.I3D AS AddressContactTitleI3D
    , PA.Anrede AS AddressContactTitle
    , P.AnsprechVorname AS AddressContactFirstname
    , P.Ansprech AS AddressContactLastname
	  , PA.Briefanrede AS AddressContactLetterSalutation
    , P.AbteilungText AS AddressContactDepartment
    , P.Email1 AS AddressContactEMail1
	  , P.Mailing1 AS AddressContactMailing1
    , P.Email2 AS AddressContactEMail2
	  , P.Mailing2 AS AddressContactMailing2
    , P.Tel1 AS AddressContactPhone1
    , P.Tel2 AS AddressContactPhone2
    , P.Tel3 AS AddressContactPhone3
    , P.Tel4 AS AddressContactPhone4
    , P.Tel5 AS AddressContactPhone5
    , P.Fax1 AS AddressContactFax1
    , P.Fax2 AS AddressContactFax2
    , CASE WHEN RC.CustomerI3D IS NOT NULL THEN 1 ELSE 0 END AS HasRemoteConnections
    , SArea.I3D AS SalesAreaI3D
    , SArea.Kurztext AS SalesAreaCaption
    , CAST(0 AS BIT) AS AddressGeoInfoUpdateFailed
    , CAST(NULL AS FLOAT) AS AddressGeoInfoLongitude
    , CAST(NULL AS FLOAT) AddressGeoInfoLatitude
    , KTK.KonzernI3D AS CompanyGroupI3D
    , KON.Name AS CompanyGroupName
    , K.BuchhaltNr AS BookKeepingNumber
	, (SELECT TOP 1 C.State FROM dbo.AccountOrderProcessingContracts C WHERE C.CustomerI3D = K.I3D ORDER BY CASE WHEN C.State = 2 THEN 1 WHEN C.State = 1 THEN 2 WHEN C.State = 5 THEN 3 WHEN C.State = 3 THEN 4 WHEN C.State = 4 THEN 5 ELSE 6 END) AS AccountOrderProcessingContractState
	, ISNULL(A.Status, 0) AS AddressIsActive
	, ISNULL(P.Status, 0) AS AddressContactIsActive
	, K.AnlaDatum AS CustomerCreatedDate
	, K.Aenderung AS CustomerChangedDate	
    , (SELECT MAX(val) FROM (VALUES(ISNULL(K.Aenderung, K.AnlaDatum)), (ISNULL(A.GeaendertDatum, A.AnlaDatum)), (ISNULL(P.GeaendertDatum, P.AnlaDatum))) AS VALUE(val)) AS ChangedDate 
	, NULL AS OwnCustomerNumberSupplier
	, NULL As EgisSupplierNumber
	, NULL AS ItScopeSupplierNumber 
	, NULL AS ConcertoSupplierNumber
	, pNew.DefaultTicket AS DefaultTicket
	 
FROM dbo.Kunden K
LEFT OUTER JOIN dbo.Personal PA1 ON PA1.I3D = K.InnendienstID
LEFT OUTER JOIN dbo.Personal PA2 ON PA2.I3D = K.AussendienstID
LEFT OUTER JOIN dbo.Personal PA3 ON PA3.I3D = K.TechnikerID
LEFT OUTER JOIN dbo.Personal PA4 ON PA4.I3D = K.Techniker2ID
LEFT OUTER JOIN dbo.Personal PA5 ON PA5.I3D = K.Betreuer5I3D
LEFT OUTER JOIN dbo.Personal PA6 ON PA6.I3D = K.Betreuer6I3D
LEFT OUTER JOIN dbo.KundenHerkunft KO ON KO.I3D = K.KundenHerkunftI3D
LEFT OUTER JOIN dbo.Anschrif A ON (A.Kunde = K.I3D)
LEFT OUTER JOIN dbo.Laenkenn AL ON AL.I3D = A.Land
LEFT OUTER JOIN dbo.Personen P ON (P.AnschriftID = A.I3D)
LEFT OUTER JOIN dbo.Anrede PA ON PA.I3D = P.AnredeI3D
LEFT OUTER JOIN (SELECT CustomerI3D, COUNT(*) AS RemoteCount FROM dbo.RemoteConnections GROUP BY CustomerI3D) RC ON RC.CustomerI3D = K.I3D
LEFT OUTER JOIN dbo.Vertriebsgebiete SArea ON SArea.I3D = K.VertriebsgebietI3D
LEFT OUTER JOIN dbo.KundenKlassifizierung KClassif ON KClassif.I3D = K.KlassifizierungI3D
LEFT OUTER JOIN dbo.Vertriebssteuerung KVert ON Kvert.I3D = K.VertriebssteuerungI3D
LEFT OUTER JOIN (SELECT TOP (1) * FROM KundeToKonzern Order By I3D) KTK ON KTK.KundenI3D = K.I3D
LEFT OUTER JOIN dbo.Kunden KON ON Kon.I3D = KTK.KonzernI3D
LEFT OUTER JOIN dbo.AccountAddressContacts pNew ON pNew.OldReferenceI3D = P.I3D

UNION ALL

SELECT 
    S.I3D AS AccountI3D
    , 2 AS AccountType
    , 'Lieferant' AS AccountTypeCaptions
    , NULL AS AccountNumber
    , NULL AS CustomerNumber
    , S.I3D AS SupplierNumber
    , NULL AS ClassificationI3D
    , NULL AS ClassificationCaption
    , NULL AS SalesControllingI3D
    , NULL AS SalesControllingCaption
    , NULL AS FreeText01
    , ISNULL(S.Status, 0) AS IsActive
    , ISNULL(S.Loeschung,0) AS IsLocked
    , ISNULL(S.Kurzbezeichnung,'') AS AccountMatchcode
    , S.Name AS AccountName
    , ISNULL(S.Fon,'') AS AccountPhone
    , ISNULL(S.Fax,'') AS AccountFax
    , ISNULL(S.EMail,'') AS AccountEMail
    , ISNULL(S.WWW,'') AS AccountWebsite
    , NULL AS Adviser1I3D
    , NULL AS Adviser1FullName
    , NULL AS Adviser1EMail
    , NULL AS Adviser2I3D
    , NULL AS Adviser2FullName
    , NULL AS Adviser2EMail
    , NULL AS Adviser3I3D
    , NULL AS Adviser3FullName
    , NULL AS Adviser3EMail
    , NULL AS Adviser4I3D
    , NULL AS Adviser4FullName
    , NULL AS Adviser4EMail
    , NULL AS Adviser5I3D
    , NULL AS Adviser5FullName
    , NULL AS Adviser5EMail
    , NULL AS Adviser6I3D
    , NULL AS Adviser6FullName
    , NULL AS Adviser6EMail
    , 0 AS IsAccountKind1
    , 0 AS IsAccountKind2
    , ISNULL(S.Haendler,0) AS IsAccountKind3
    , 0 AS IsAccountKind4
    , 0 AS IsAccountKind5
    , S.RootDirI3D AS RootDirectoryI3D
    , NULL AS AccountOriginI3D
    , NULL AS AccountOriginName
    , A.I3D AS AddressI3D
    , A.I3D AS AddressOldReferenceI3D
    , ISNULL(A.KreditorDefault,0) AS IsDefaultAddress
    , A.Abteilung AS AddressDepartment
    , A.Strasse AS AddressStreet
    , A.Plz AS AddressZip
    , A.Ort AS AddressCity
    , A.PostfachAktiv AS IsAddressPostboxActive
    , A.Postfach AS AddressPostbox
	, ISNULL(A.DruckAbteilung, 0) AS PrintDepartment
	, ISNULL(A.DruckAbteilungAnsprech, 0) AS PrintDepartmentAddressContact
	, ISNULL(A.DruckAnsprech, 0) AS PrintAddressContact
	, ISNULL(A.DruckArt, 0) AS PrintName
    , AL.I3D AS AddressCountryI3D
    , AL.Land AS AddressCountryName
    , ISNULL(P.I3D, 0) AS AddressContactI3D
    , ISNULL(P.I3D, 0) AS AddressContactOldReferenceI3D
    , CASE WHEN P.I3D IS NULL THEN 1 ELSE ISNULL(P.Standard,0) END AS IsDefaultAddressContact
    , PA.I3D AS AddressContactTitleI3D
    , PA.Anrede AS AddressContactTitle
	, PA.Briefanrede AS AddressContactLetterSalutation
    , P.AnsprechVorname AS AddressContactFirstname
    , P.Ansprech AS AddressContactLastname
    , P.AbteilungText AS AddressContactDepartment
    , P.Email1 AS AddressContactEMail1
	  , P.Mailing1 AS AddressContactMailing1
    , P.Email2 AS AddressContactEMail2
  	, P.Mailing2 AS AddressContactMailing2
    , P.Tel1 AS AddressContactPhone1
    , P.Tel2 AS AddressContactPhone2
    , P.Tel3 AS AddressContactPhone3
    , P.Tel4 AS AddressContactPhone4
    , P.Tel5 AS AddressContactPhone5
    , P.Fax1 AS AddressContactFax1
    , P.Fax2 AS AddressContactFax2
    , CASE WHEN RC.CustomerI3D IS NOT NULL THEN 1 ELSE 0 END AS HasRemoteConnections
    , NULL AS SalesAreaI3D
    , NULL AS SalesAreaCaption
    , CAST(0 AS BIT) AS AddressGeoInfoUpdateFailed
    , CAST(NULL AS FLOAT) AS AddressGeoInfoLongitude
    , CAST(NULL AS FLOAT) AddressGeoInfoLatitude
    , NULL AS CompanyGroupI3D
    , NULL AS CompanyGroupName
    , NULL AS BookKeepingNumber
	, NULL AS AccountOrderProcessingContractState
	, ISNULL(A.Status, 0) AS AddressIsActive
	, ISNULL(P.Status, 0) AS AddressContactIsActive
	, S.AnlaDatum AS CustomerCreatedDate
	, S.Aenderung AS CustomerChangedDate
    , (SELECT MAX(val) FROM (VALUES(ISNULL(S.Aenderung, S.AnlaDatum)), (ISNULL(A.GeaendertDatum, A.AnlaDatum)), (ISNULL(P.GeaendertDatum, P.AnlaDatum))) AS VALUE(val)) AS ChangedDate 
	, S.KredKdnr AS OwnCustomerNumberSupplier
	, S.EgisLieferant
	, S.ITScopeLieferant
	, S.ConcertoLieferant
	, pNew.DefaultTicket AS DefaultTicket
FROM dbo.Kreditor S
LEFT OUTER JOIN dbo.Anschrif A ON (A.Kreditor = S.I3D)
LEFT OUTER JOIN dbo.Laenkenn AL ON AL.I3D = A.Land
LEFT OUTER JOIN dbo.Personen P ON (P.AnschriftID = A.I3D)
LEFT OUTER JOIN dbo.Anrede PA ON PA.I3D = P.AnredeI3D
LEFT OUTER JOIN (SELECT CustomerI3D, COUNT(*) AS RemoteCount FROM dbo.RemoteConnections GROUP BY CustomerI3D) RC ON RC.CustomerI3D = S.I3D
LEFT OUTER JOIN dbo.AccountAddressContacts pNew ON pNew.OldReferenceI3D = P.I3D
GO
/****** Object:  View [dbo].[cvw_CreditVoucherHeadVATPriceSplitLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_CreditVoucherHeadVATPriceSplitLC]
AS
SELECT HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
FROM dbo.cvw_CreditVoucherPosLC
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_OfferHeadLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OfferHeadLC] AS
SELECT A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,A.IsCashAsset
	,A.CountryI3D
FROM dbo.Offers AS A
LEFT OUTER JOIN dbo.cvw_OfferHeadVATPriceSplitLC AP ON AP.HeadI3D = A.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
	,A.CountryI3D
	,SD.Wert
GO
/****** Object:  View [dbo].[cvw_AssetManagementDeviceCrawlerOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementDeviceCrawlerOverview]
        AS
	      SELECT Dev.I3D, Dev.KundenI3D AS CustomerI3D, K.Name AS CustomerName, Dev.ShortName, Dev.DeviceClass, Dev.IsOnline, Dev.SystemCrawlerVersion, 
			      Dev.SystemCrawlerStatus, Dev.SystemCrawlerNeedToInstall, Dev.SystemCrawlerNeedToUnInstall, Dev.IsSystemCrawlerUnInstalling, 
			      CASE (SELECT TOP 1 LOWER(LogType) FROM (SELECT Dense_Rank() OVER (PARTITION BY LogType ORDER BY sc.LogDate DESC) AS Row, 
				      sc.* FROM AssetManagementServiceConnectorLogs sc WHERE LogDate >= GetDate() - 20 AND (LOWER(LogType) = 'error' OR 
				      LOWER(LogType) = 'ok') AND DeviceI3D = Dev.I3D) AS HardDriveCheckResult WHERE Row = 1 ORDER BY LogDate DESC) 
				      WHEN 'error' THEN 1 ELSE 0 END AS ErrorExists, dev.IsSystemCrawlerRestart, dev.SystemCrawlerRestartLog
	      FROM AssetManagementDevices Dev INNER JOIN Kunden K ON K.I3D = Dev.KundenI3D
	      WHERE (K.Status = 10) AND (K.Gesperrt IS NULL OR K.Gesperrt = 0)
      
GO
/****** Object:  View [dbo].[cvw_OrderHeadLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OrderHeadLC]
AS
SELECT A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotalComplete,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotalComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFCComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,SUM(ISNULL(AP.TaxPurchasePriceTotal,0)) AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotalComplete,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.TaxPurchasePriceTotalComplete,0)) AS TaxPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,SUM(ISNULL(AP.TaxPurchasePriceTotalFC,0)) AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFCComplete,0)) AS NetPurchasePriceFCComplete
	,SUM(ISNULL(AP.TaxPurchasePriceTotalFCComplete,0)) AS TaxPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,A.IsCashAsset
	,A.CountryI3D
FROM dbo.Orders AS A
LEFT OUTER JOIN dbo.cvw_OrderHeadVATPriceSplitLC AP ON AP.HeadI3D = A.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
	,A.CountryI3D
	,SD.Wert
GO
/****** Object:  View [dbo].[cvw_AssetManagementSystemCrawlerInstallLogs]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementSystemCrawlerInstallLogs]
        AS
        SELECT        t .I3D, STUFF
                                     ((SELECT        '~' + i.LogMessage + '- ' + CONVERT(VARCHAR(16), i.LogDate, 120) + CHAR(13) + CHAR(10) AS [text()]
                                         FROM            AssetManagementServiceConnectorLogs i
                                         WHERE        i.DeviceI3D = t .I3D AND i.LogDate >= GetDate() - 20 AND i.LogType = 'error'
                                         ORDER BY i.LogDate DESC FOR XML PATH('')), 1, 1, '') AS ExceptionMessage
        FROM            AssetManagementDevices t
      
GO
/****** Object:  View [dbo].[cvw_DeliveryListHeadLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_DeliveryListHeadLC]
AS
SELECT A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotalComplete,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotalComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFCComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,SUM(ISNULL(AP.TaxPurchasePriceTotal,0)) AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotalComplete,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.TaxPurchasePriceTotalComplete,0)) AS TaxPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,SUM(ISNULL(AP.TaxPurchasePriceTotalFC,0)) AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFCComplete,0)) AS NetPurchasePriceFCComplete
	,SUM(ISNULL(AP.TaxPurchasePriceTotalFCComplete,0)) AS TaxPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,A.IsCashAsset
	,A.CountryI3D
FROM dbo.DeliveryLists AS A
LEFT OUTER JOIN dbo.cvw_DeliveryListHeadVATPriceSplitLC AP ON AP.HeadI3D = A.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
	,A.CountryI3D
	,SD.Wert
GO
/****** Object:  View [dbo].[cvw_PickupListHeadLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_PickupListHeadLC]
AS
SELECT A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,A.IsCashAsset
	,A.CountryI3D
FROM dbo.PickupLists AS A
LEFT OUTER JOIN dbo.cvw_PickupListHeadVATPriceSplitLC AP ON AP.HeadI3D = A.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
	,A.CountryI3D
	,SD.Wert
GO
/****** Object:  Table [dbo].[VertragKontingentAnlagePositionen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKontingentAnlagePositionen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnlageKopfI3D] [int] NULL,
	[AnlageNummer] [int] NULL,
	[AnlagePositionI3D] [int] NULL,
	[AnlageArt] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[ArtikelCode] [varchar](60) NULL,
	[Stk] [float] NULL,
	[VKKalk] [float] NULL,
	[VertragKopfI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Status] [int] NULL,
	[KontingentArt] [int] NULL,
	[AusgleichStk] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[ContractItemsContingent]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[ContractItemsContingent] AS
SELECT vp.I3D
	   ,vp.AnlageKopfI3D AssetI3D
	   ,vp.AnlageNummer AssetNumber
	   ,vp.AnlagePositionI3D AssetItemI3D
	   ,vp.AnlageArt AssetKind
	   ,vp.VertragKopfI3D ContractI3D
	   ,vp.Stk  Quantity
	   ,vp.AusgleichStk  BalanceQuantity
	   ,vp.VKKalk Price
	   ,vp.Datum Date
	   ,vp.KontingentArt ContingentKind
	   ,vp.Status State
FROM VertragKontingentAnlagePositionen vp
      
GO
/****** Object:  View [dbo].[cvw_InvoiceHeadLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_InvoiceHeadLC]
AS
SELECT A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotalComplete,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotalComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFCComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,SUM(ISNULL(AP.TaxPurchasePriceTotal,0)) AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotalComplete,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.TaxPurchasePriceTotalComplete,0)) AS TaxPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,SUM(ISNULL(AP.TaxPurchasePriceTotalFC,0)) AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFCComplete,0)) AS NetPurchasePriceFCComplete
	,SUM(ISNULL(AP.TaxPurchasePriceTotalFCComplete,0)) AS TaxPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor AS CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,A.IsCashAsset
	,A.CountryI3D
FROM dbo.Invoices AS A
LEFT OUTER JOIN dbo.cvw_InvoiceHeadVATPriceSplitLC AP ON AP.HeadI3D = A.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
	,A.CountryI3D
	,SD.Wert
GO
/****** Object:  Table [dbo].[ArticleUnit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleUnit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SmallDescription] [nvarchar](20) NOT NULL,
	[LongDescription] [nvarchar](200) NULL,
	[TimeUnit] [bit] NULL,
	[SecondCount] [int] NULL,
	[State] [bit] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[TimeArticleUnit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

           CREATE VIEW [dbo].[TimeArticleUnit] AS
              SELECT a.I3D ArticleI3D, ae.Bezeichnung Description,
               	CASE WHEN a.AWFaktor*ae.FaktorZuSekunde < 3600 THEN 1.0 *a.AWFaktor*ae.FaktorZuSekunde / 60
               		ELSE  1.0 * a.AWFaktor*ae.FaktorZuSekunde / 3600 END multiplier,
               	CASE WHEN a.AWFaktor*ae.FaktorZuSekunde < 3600 THEN (SELECT I3D FROM ArticleUnit WHERE SecondCount = 60 AND Timeunit = 1 AND State = 1 )
               		ELSE (SELECT I3D FROM ArticleUnit WHERE SecondCount = 3600 AND TimeUnit = 1 AND State = 1 ) END ArticleUnitI3D	      
              FROM artik a
              INNER JOIN  ArtikelEinheit ae on ae.I3D = a.Einheit and ae.Zeiteinheit = 1 and ae.Status = 1
              WHERE a.IsArbeitswert = 1 
GO
/****** Object:  View [dbo].[cvw_CreditVoucherHeadLC]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_CreditVoucherHeadLC]
AS
SELECT A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,A.IsCashAsset
	,A.CountryI3D
FROM dbo.CreditVouchers AS A
LEFT OUTER JOIN dbo.cvw_CreditVoucherHeadVATPriceSplitLC AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Number
	,A.Date
	,A.CustomerI3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
	,A.CountryI3D
	,SD.Wert
GO
/****** Object:  View [dbo].[cvw_CreditVoucherPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_CreditVoucherPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END AS Text
	,AP.RichText
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,ISNULL(AP.Artikelpositionsart,0) AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,CASE WHEN AR.isReverseCharge = 1 AND AP.MwstI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.GutKopfI3D AS CreditVoucherHeadI3D
	,AP.GutKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.CalculatedNetPrice         AS NetPrice
	,AP.CalculatedTaxPrice         AS TaxPrice
	,AP.CalculatedNetPriceFC       AS NetPriceFC
	,AP.CalculatedTaxPriceFC       AS TaxPriceFC
	,AP.CalculatedNetPriceTotal    AS NetPriceTotal
	,AP.CalculatedTaxPriceTotal    AS TaxPriceTotal
	,AP.CalculatedNetPriceTotal    AS NetPriceTotalComplete
	,AP.CalculatedTaxPriceTotal    AS TaxPriceTotalComplete
	,AP.CalculatedNetPriceTotalFC  AS NetPriceTotalFC
	,AP.CalculatedTaxPriceTotalFC  AS TaxPriceTotalFC
	,AP.CalculatedNetPriceTotalFC  AS NetPriceTotalFCComplete
	,AP.CalculatedTaxPriceTotalFC  AS TaxPriceTotalFCComplete
	,AP.CalculatedNetPurchasePrice AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,AP.CalculatedNetPurchasePriceFC AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,AP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotal
	,AP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotalComplete
	,NULL AS TaxPurchasePriceTotal
	,AP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFC
	,AP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFCComplete
	,NULL AS TaxPurchasePriceTotalFC
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Rabatt,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStNichtAusweisbar = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.GutPos AS AP
INNER JOIN dbo.GutKopf AS A ON AP.GutKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.LandI3D
GO
/****** Object:  View [dbo].[cvw_CreditVoucherHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_CreditVoucherHeadVATPriceSplit]
AS
SELECT CreditVoucherHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
FROM dbo.cvw_CreditVoucherPos
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY CreditVoucherHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_CreditVoucherHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_CreditVoucherHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,K.Name AS CustomerName
	,A.Zusatztext AS AdditionalText
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,CASE 
		WHEN A.FilialI3D <= 0
			THEN NULL
		ELSE A.FilialI3D
		END AS BranchI3D
	,CASE WHEN A.KundenID <= 0 THEN NULL ELSE A.KundenID END AS CustomerI3D
	,CASE 
		WHEN A.BearbeiterI3D <= 0
			THEN NULL
		ELSE A.BearbeiterI3D
		END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE 
		WHEN A.InnendienstID <= 0
			THEN NULL
		ELSE A.InnendienstID
		END AS Adviser1I3D
	,CASE 
		WHEN A.AussendienstID <= 0
			THEN NULL
		ELSE A.AussendienstID
		END AS Adviser2I3D
	,CASE 
		WHEN A.TechnikerID <= 0
			THEN NULL
		ELSE A.TechnikerID
		END AS Adviser3I3D
	,CASE 
		WHEN A.Techniker2ID <= 0
			THEN NULL
		ELSE A.Techniker2ID
		END AS Adviser4I3D
	,A.Status AS State
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentCondition
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,A.GeaendertDatum AS ChangeDate
FROM dbo.GutKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftID = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonID = Pers.I3D
LEFT OUTER JOIN dbo.cvw_CreditVoucherHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kunden AS K ON A.KundenID = K.I3D
LEFT OUTER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.Empfanger
	,A.ZahlKond
	,A.LiefKundEmpfaenger
	,A.RechKundEmpfaenger
	,A.Status
	,A.Lieferdatum
	,A.Version
	,A.LieferbedingungsText
	,A.KundenID
	,A.FilialI3D
	,A.BearbeiterI3D
	,A.BestNr
	,A.MwStNichtAusweisbar
	,A.Zusatztext
	,A.InnendienstID
	,A.AussendienstID
	,A.TechnikerID
	,A.Techniker2ID
	,K.Name
	,A.Bereitstellung
	,A.ProjNr
	,A.ZahlKondID
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
	,SD.Wert
	,A.GeaendertDatum
      
GO
/****** Object:  View [dbo].[cvw_InvoiceHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_InvoiceHeadVATPriceSplit]
AS
SELECT        
	IP.InvoiceHeadI3D, 
	IP.HeadI3D, 
	IP.VATI3D, 
	IP.VATRate, 
	IP.IsReverseChargeActive,
	SUM(IP.NetPriceTotal) AS NetPriceTotal, 
	CONVERT(NUMERIC(19, 2), SUM(IP.TaxPriceTotal)) AS TaxPriceTotal, 
	SUM(IP.NetPriceTotalComplete) AS NetPriceTotalComplete, 
	CONVERT(NUMERIC(19, 2), SUM(IP.TaxPriceTotalComplete)) AS TaxPriceTotalComplete, 
	SUM(IP.NetPriceTotalFC) AS NetPriceTotalFC, 
	CONVERT(NUMERIC(19, 2), SUM(IP.TaxPriceTotalFC)) AS TaxPriceTotalFC, 
	SUM(IP.NetPriceTotalFCComplete) AS NetPriceTotalFCComplete, 
	CONVERT(NUMERIC(19, 2), SUM(IP.TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete, 
	SUM(IP.NetPurchasePriceTotal) AS NetPurchasePriceTotal, 
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal, 
	SUM(IP.NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete, 
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalComplete, 
	SUM(IP.NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC, 
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC, 
	SUM(IP.NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete, 
	CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFCComplete
FROM dbo.cvw_InvoicePos IP
WHERE (IP.Kind IN (1, 3)) 
AND (ISNULL(IP.ArticlePositionKind, 0) IN (0, 50)) 
AND (IP.Expanded IS NULL)
GROUP BY 
	IP.InvoiceHeadI3D, 
	IP.HeadI3D, 
	IP.VATI3D, 
	IP.VATRate, 
	IP.IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_InvoiceHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_InvoiceHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,K.Name AS CustomerName
	,A.Lieferdatum AS DeliveryDate
	,A.Zusatztext AS AdditionalText
	,A.Bereitstellung AS SupplyDate
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,CASE WHEN A.KundenID <= 0 THEN NULL ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,A.MwStNichtAusweisbar AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS Adviser1I3D
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS Adviser2I3D
	,CASE WHEN A.TechnikerID <= 0 THEN NULL ELSE A.TechnikerID END AS Adviser3I3D
	,CASE WHEN A.Techniker2ID <= 0 THEN NULL ELSE A.Techniker2ID END AS Adviser4I3D
	,A.Status AS State
	,CASE WHEN A.LieferBedID <= 0 THEN NULL ELSE A.LieferBedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryCondition
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentCondition
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress

	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotalComplete,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotalComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFCComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotalComplete,0)) AS NetPurchasePriceComplete
	,NULL AS TaxPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFCComplete,0)) AS NetPurchasePriceFCComplete
	,NULL AS TaxPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor AS CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,ISNULL(A.Bar,0) AS IsCashAsset
	,A.DTinErstellt AS DTinCreated
	,A.DTinDatum AS DTinCreatedDate
	,A.DTinBearbeiter AS DTinCreatedFromI3D
	,A.EDIExport
	,A.EDIExportAm AS EDIExportDate
	,A.EDIExportVonI3D AS EDIExportFromI3D
	,ROUND(A.Bezahlt,2) AS Payed
	,A.GeaendertDatum AS ChangeDate
FROM dbo.RechKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftID = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonID = Pers.I3D
LEFT OUTER JOIN dbo.cvw_InvoiceHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kunden AS K ON A.KundenID = K.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.Empfanger
	,A.ZahlKond
	,A.LiefKundEmpfaenger
	,A.RechKundEmpfaenger
	,A.Status
	,A.Lieferdatum
	,A.Version
	,A.LieferbedingungsText
	,A.KundenID
	,A.FilialI3D
	,A.BearbeiterI3D
	,A.BestNr
	,A.MwStNichtAusweisbar
	,A.Zusatztext
	,A.InnendienstID
	,A.AussendienstID
	,A.TechnikerID
	,A.Techniker2ID
	,K.Name
	,A.Bereitstellung
	,A.ProjNr
	,A.LieferBedID
	,A.ZahlKondID
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,A.DTinErstellt
	,A.DTinDatum
	,A.DTinBearbeiter
	,A.EDIExport
	,A.EDIExportAm
	,A.EDIExportVonI3D
	,A.Bezahlt
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
	,SD.Wert
	,A.GeaendertDatum

      
GO
/****** Object:  View [dbo].[cvw_OrderPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OrderPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END AS Text
	,AP.RichText
	,AP.BestellNr AS PurchaseOrderNumber
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.Lieferdatum AS DeliveryDate
	,AP.Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,AP.Artikelpositionsart AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,CASE WHEN AR.isReverseCharge = 1 AND AP.MwstI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.AufKopfI3D AS OrderHeadI3D
	,AP.AufKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0) - ISNULL(AP.Liefermenge, 0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Liefermenge,0)) AS QuantityProcessed
	,AP.CalculatedNetPrice                AS NetPrice
	,AP.CalculatedTaxPrice                AS TaxPrice
	,AP.CalculatedNetPriceFC              AS NetPriceFC
	,AP.CalculatedTaxPriceFC              AS TaxPriceFC
	,AP.CalculatedNetPriceTotal           AS NetPriceTotal
	,AP.CalculatedTaxPriceTotal           AS TaxPriceTotal
	,AP.CalculatedNetPriceTotalComplete   AS NetPriceTotalComplete
	,AP.CalculatedTaxPriceTotalComplete   AS TaxPriceTotalComplete
	,AP.CalculatedNetPriceTotalFC         AS NetPriceTotalFC
	,AP.CalculatedTaxPriceTotalFC         AS TaxPriceTotalFC
	,AP.CalculatedNetPriceTotalFCComplete AS NetPriceTotalFCComplete
	,AP.CalculatedTaxPriceTotalFCComplete AS TaxPriceTotalFCComplete
	,AP.CalculatedNetPurchasePrice        AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,AP.CalculatedNetPurchasePriceFC AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,AP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotal
	,NULL AS TaxPurchasePriceTotal
	,AP.CalculatedNetPurchasePriceTotalComplete AS NetPurchasePriceTotalComplete
	,NULL AS TaxPurchasePriceTotalComplete
	,AP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFC
	,NULL AS TaxPurchasePriceTotalFC
	,AP.CalculatedNetPurchasePriceTotalFCComplete AS NetPurchasePriceTotalFCComplete
	,NULL AS TaxPurchasePriceTotalFCComplete
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Rabatt,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStNichtAusweisbar = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.AufPos AS AP
INNER JOIN dbo.AufKopf AS A ON AP.AufKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.LandI3D
GO
/****** Object:  View [dbo].[cvw_OrderHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OrderHeadVATPriceSplit]
AS
SELECT OrderHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFCComplete
FROM dbo.cvw_OrderPos AS AP
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY OrderHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_OrderHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_OrderHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,K.Name AS CustomerName
	,A.Lieferdatum AS DeliveryDate
	,A.Zusatztext AS AdditionalText
	,A.Bereitstellung AS SupplyDate
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,A.BillingBlocked
	,A.BillingBlockedReason
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,CASE WHEN A.TerminplanungI3D <= 0 THEN NULL ELSE A.TerminplanungI3D END AS CalendarI3D
	,CASE WHEN A.KundenID <= 0 THEN NULL ELSE A.KundenID END AS CustomerI3D
	,A.FinaleVersion AS FinalVersion
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,A.MwStNichtAusweisbar AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS Adviser1I3D
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS Adviser2I3D
	,CASE WHEN A.TechnikerID <= 0 THEN NULL ELSE A.TechnikerID END AS Adviser3I3D
	,CASE WHEN A.Techniker2ID <= 0 THEN NULL ELSE A.Techniker2ID END AS Adviser4I3D
	,A.Status AS State
	,A.LieferbedID AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryCondition
	,A.ZahlkondID AS OrderConditionI3D
	,A.ZahlKond AS OrderCondition
	,A.ZahlKondRechI3D AS PaymentConditionI3D
	,A.RechnungskonditionsText AS PaymentCondition
	,A.Service AS IsService
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotalComplete,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotalComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFCComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotalComplete,0)) AS NetPurchasePriceComplete
	,NULL AS TaxPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFCComplete,0)) AS NetPurchasePriceFCComplete
	,NULL AS TaxPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,ISNULL(A.Bar,0) AS IsCashAsset
	,A.GeaendertDatum AS ChangeDate
FROM dbo.AufKopf AS A
LEFT OUTER JOIN dbo.cvw_OrderHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kunden AS K ON A.KundenID = K.I3D
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftID = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonID = Pers.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.Empfanger
	,A.BillingBlocked
	,A.BillingBlockedReason
	,A.ZahlKond
	,A.LiefKundEmpfaenger
	,A.RechKundEmpfaenger
	,A.Status
	,A.Lieferdatum
	,A.TerminplanungI3D
	,A.Version
	,A.LieferbedingungsText
	,A.KundenID
	,A.FilialI3D
	,A.BearbeiterI3D
	,A.BestNr
	,A.MwStNichtAusweisbar
	,A.Zusatztext
	,A.InnendienstID
	,A.AussendienstID
	,A.TechnikerID
	,A.Techniker2ID
	,K.Name
	,A.Bereitstellung
	,A.ProjNr
	,A.FinaleVersion
	,A.LieferbedID
	,A.ZahlkondID
	,A.ZahlKondRechI3D
	,A.RechnungskonditionsText
	,A.Service
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
    ,A.Bar
	,SD.Wert
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
	,A.GeaendertDatum
      
GO
/****** Object:  View [dbo].[cvw_DeliveryListPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_DeliveryListPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END AS Text
	,AP.RichText
	,AP.BestellNr AS PurchaseOrderNumber
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.Lieferdatum AS DeliveryDate
	,AP.Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,ISNULL(AP.Artikelpositionsart,0) AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,CASE WHEN AR.isReverseCharge = 1 AND AP.MwstI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.LiefKopfI3D AS DeliveryListHeadI3D
	,AP.LiefKopfI3D AS HeadI3D
	,CONVERT(NUMERIC(19,7), ISNULL(AP.Stk,0) - ISNULL(AP.numAbhol, 0)) AS Quantity
	,CONVERT(NUMERIC(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(NUMERIC(19,7), ISNULL(AP.numAbhol,0)) AS QuantityProcessed
	,AP.CalculatedNetPrice                        AS NetPrice
	,AP.CalculatedTaxPrice                        AS TaxPrice
	,AP.CalculatedNetPriceFC                      AS NetPriceFC
	,AP.CalculatedTaxPriceFC                      AS TaxPriceFC
	,AP.CalculatedNetPriceTotal                   AS NetPriceTotal
	,AP.CalculatedTaxPriceTotal                   AS TaxPriceTotal
	,AP.CalculatedNetPriceTotalComplete           AS NetPriceTotalComplete
	,AP.CalculatedTaxPriceTotalComplete           AS TaxPriceTotalComplete
	,AP.CalculatedNetPriceTotalFC                 AS NetPriceTotalFC
	,AP.CalculatedTaxPriceTotalFC                 AS TaxPriceTotalFC
	,AP.CalculatedNetPriceTotalFCComplete         AS NetPriceTotalFCComplete
	,AP.CalculatedTaxPriceTotalFCComplete         AS TaxPriceTotalFCComplete
	,AP.CalculatedNetPurchasePrice                AS NetPurchasePrice
	,NULL AS TaxPurchasePrice                    
	,AP.CalculatedNetPurchasePriceFC              AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC                    
	,AP.CalculatedNetPurchasePriceTotal           AS NetPurchasePriceTotal
	,NULL AS TaxPurchasePriceTotal                 
	,AP.CalculatedNetPurchasePriceTotalComplete   AS NetPurchasePriceTotalComplete
	,NULL AS TaxPurchasePriceTotalComplete         
	,AP.CalculatedNetPurchasePriceTotalFC         AS NetPurchasePriceTotalFC
	,NULL AS TaxPurchasePriceTotalFC               
	,AP.CalculatedNetPurchasePriceTotalFCComplete AS NetPurchasePriceTotalFCComplete
	,NULL AS TaxPurchasePriceTotalFCComplete
	,CONVERT(NUMERIC(9,2), ROUND(ISNULL(AP.Rabatt,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStNichtAusweisbar = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.LiefPos AS AP
INNER JOIN dbo.LiefKopf AS A ON AP.LiefKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.LandI3D
GO
/****** Object:  View [dbo].[cvw_DeliveryListHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_DeliveryListHeadVATPriceSplit]
AS
SELECT DeliveryListHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFCComplete
FROM dbo.cvw_DeliveryListPos
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY DeliveryListHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_DeliveryListHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

       CREATE VIEW [dbo].[cvw_DeliveryListHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,K.Name AS CustomerName
	,A.Lieferdatum AS DeliveryDate
	,A.Zusatztext AS AdditionalText
	,A.Bereitstellung AS SupplyDate
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,CASE WHEN A.KundenID <= 0 THEN NULL ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,A.MwStNichtAusweisbar AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS Adviser1I3D
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS Adviser2I3D
	,CASE WHEN A.TechnikerID <= 0 THEN NULL ELSE A.TechnikerID END AS Adviser3I3D
	,CASE WHEN A.Techniker2ID <= 0 THEN NULL ELSE A.Techniker2ID END AS Adviser4I3D
	,A.Status AS State
	,CASE WHEN A.LieferBedID <= 0 THEN NULL ELSE A.LieferBedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryCondition
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentCondition
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,A.Trackingnummer AS TrackingNumber
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotalComplete,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotalComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFCComplete,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFCComplete,0)) + SUM(ISNULL(AP.TaxPriceTotalFCComplete,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotalComplete,0)) AS NetPurchasePriceComplete
	,NULL AS TaxPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFCComplete,0)) AS NetPurchasePriceFCComplete
	,NULL AS TaxPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,ISNULL(A.Bar,0) AS IsCashAsset
	,A.GeaendertDatum AS ChangeDate
	,A.DurchRMAGeschlossen AS ClosedThroughRMA
FROM dbo.LiefKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftID = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonID = Pers.I3D
LEFT OUTER JOIN dbo.cvw_DeliveryListHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kunden AS K ON A.KundenID = K.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.Empfanger
	,A.ZahlKond
	,A.Status
	,A.Lieferdatum
	,A.Version
	,A.LieferbedingungsText
	,A.KundenID
	,A.FilialI3D
	,A.BearbeiterI3D
	,A.BestNr
	,A.MwStNichtAusweisbar
	,A.Zusatztext
	,A.InnendienstID
	,A.AussendienstID
	,A.TechnikerID
	,A.Techniker2ID
	,K.Name
	,A.Bereitstellung
	,A.ProjNr
	,A.LieferBedID
	,A.ZahlKondID
	,A.Trackingnummer
	,A.LiefKundEmpfaenger
	,A.RechKundEmpfaenger
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
    ,A.Bar
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
	,SD.Wert
	,A.GeaendertDatum
	,A.DurchRMAGeschlossen
GO
/****** Object:  View [dbo].[cvw_PickupListPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_PickupListPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END AS Text
	,AP.RichText
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,ISNULL(AP.Artikelpositionsart,0) AS ArticlePositionKind
	,AP.MwstI3D AS VATI3D
	,CASE WHEN AR.isReverseCharge = 1 AND AP.MwstI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.AbholKopfI3D AS PickupListHeadI3D
	,AP.AbholKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.CalculatedNetPrice         AS NetPrice
	,AP.CalculatedTaxPrice         AS TaxPrice
	,AP.CalculatedNetPriceFC       AS NetPriceFC
	,AP.CalculatedTaxPriceFC       AS TaxPriceFC
	,AP.CalculatedNetPriceTotal    AS NetPriceTotal
	,AP.CalculatedTaxPriceTotal    AS TaxPriceTotal
	,AP.CalculatedNetPriceTotal    AS NetPriceTotalComplete
	,AP.CalculatedTaxPriceTotal    AS TaxPriceTotalComplete
	,AP.CalculatedNetPriceTotalFC  AS NetPriceTotalFC
	,AP.CalculatedTaxPriceTotalFC  AS TaxPriceTotalFC
	,AP.CalculatedNetPriceTotalFC  AS NetPriceTotalFCComplete
	,AP.CalculatedTaxPriceTotalFC  AS TaxPriceTotalFCComplete
	,AP.CalculatedNetPurchasePrice AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,AP.CalculatedNetPurchasePriceFC AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,AP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotal
	,AP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotalComplete
	,NULL AS TaxPurchasePriceTotal
	,AP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFC
	,AP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFCComplete
	,NULL AS TaxPurchasePriceTotalFC
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Rabatt,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStNichtAusweisbar = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.AbholPos AS AP
INNER JOIN dbo.AbholKopf AS A ON AP.AbholKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.LandI3D
GO
/****** Object:  View [dbo].[cvw_PickupListHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_PickupListHeadVATPriceSplit]
AS
SELECT PickupListHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
FROM dbo.cvw_PickupListPos
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY PickupListHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_PickupListHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_PickupListHead]
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.Datum AS Date
	,K.Name AS CustomerName
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,Ansch.PostfachAktiv AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,CASE 
		WHEN A.FilialI3D <= 0
			THEN NULL
		ELSE A.FilialI3D
		END AS BranchI3D
	,CASE WHEN A.KundenID <= 0 THEN NULL ELSE A.KundenID END AS CustomerI3D
	,CASE 
		WHEN A.BearbeiterI3D <= 0
			THEN NULL
		ELSE A.BearbeiterI3D
		END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,CASE 
		WHEN A.InnendienstID <= 0
			THEN NULL
		ELSE A.InnendienstID
		END AS Adviser1I3D
	,CASE 
		WHEN A.AussendienstID <= 0
			THEN NULL
		ELSE A.AussendienstID
		END AS Adviser2I3D
	,CASE 
		WHEN A.TechnikerID <= 0
			THEN NULL
		ELSE A.TechnikerID
		END AS Adviser3I3D
	,CASE 
		WHEN A.Techniker2ID <= 0
			THEN NULL
		ELSE A.Techniker2ID
		END AS Adviser4I3D
	,A.Status AS State
	,NULL AS DeliveryAddress
	,NULL AS InvoiceAddress
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentCondition
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,A.GeaendertDatum AS ChangeDate
FROM dbo.AbholKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftID = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonID = Pers.I3D
LEFT OUTER JOIN dbo.cvw_PickupListHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kunden AS K ON A.KundenID = K.I3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.Empfanger
	,A.ZahlKond
	,A.Status
	,A.Version
	,A.KundenID
	,A.FilialI3D
	,A.BearbeiterI3D
	,A.MwStNichtAusweisbar
	,A.InnendienstID
	,A.AussendienstID
	,A.TechnikerID
	,A.Techniker2ID
	,K.Name
	,A.ZahlKondID
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
	,SD.Wert
	,A.GeaendertDatum
      
GO
/****** Object:  View [dbo].[cvw_OfferPos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OfferPos]
AS
SELECT AP.I3D
	,CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,AP.Pos AS InternalPosition
	,AP.Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,AP.Expanded
	,AP.Art AS Kind
	,AP.Artikelpositionsart AS ArticlePositionKind
	,AP.MwstI3d AS VATI3D
	,CASE WHEN AR.isReverseCharge = 1 AND AP.MwstI3D = MSD.I3D THEN 1 ELSE 0 END AS IsReverseChargeActive
	,AP.AngKopfI3D AS OfferHeadI3D
	,AP.AngKopfI3D AS HeadI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS Quantity
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.CalculatedNetPrice         AS NetPrice
	,AP.CalculatedTaxPrice         AS TaxPrice
	,AP.CalculatedNetPriceFC       AS NetPriceFC
	,AP.CalculatedTaxPriceFC       AS TaxPriceFC
	,AP.CalculatedNetPriceTotal    AS NetPriceTotal
	,AP.CalculatedTaxPriceTotal    AS TaxPriceTotal
	,AP.CalculatedNetPriceTotal    AS NetPriceTotalComplete
	,AP.CalculatedTaxPriceTotal    AS TaxPriceTotalComplete
	,AP.CalculatedNetPriceTotalFC  AS NetPriceTotalFC
	,AP.CalculatedTaxPriceTotalFC  AS TaxPriceTotalFC
	,AP.CalculatedNetPriceTotalFC  AS NetPriceTotalFCComplete
	,AP.CalculatedTaxPriceTotalFC  AS TaxPriceTotalFCComplete
	,AP.CalculatedNetPurchasePrice AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,AP.CalculatedNetPurchasePriceFC AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,AP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotal
	,AP.CalculatedNetPurchasePriceTotal AS NetPurchasePriceTotalComplete
	,NULL AS TaxPurchasePriceTotal
	,AP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFC
	,AP.CalculatedNetPurchasePriceTotalFC AS NetPurchasePriceTotalFCComplete
	,NULL AS TaxPurchasePriceTotalFC
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.Rabatt,0),2)) AS Discount
	,CONVERT(DECIMAL(9,2), CASE WHEN A.MwStNichtAusweisbar = 1 THEN 0 ELSE ROUND(ISNULL(AP.MwstSatz,0),2)END) AS VATRate
FROM dbo.AngPos AS AP
INNER JOIN dbo.AngKopf AS A ON AP.AngKopfI3D = A.I3D
LEFT OUTER JOIN dbo.ARTIK AS AR ON AP.ArtikelI3D = AR.I3D
LEFT OUTER JOIN dbo.MwstSatz MSD ON MSD.VerwFuerMwStNichtAusweisbar = 1 AND MSD.LandI3D = A.LandI3D
GO
/****** Object:  View [dbo].[cvw_OfferHeadVATPriceSplit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OfferHeadVATPriceSplit]
AS
SELECT OfferHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
	,SUM(NetPriceTotal) AS NetPriceTotal
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotal)) AS TaxPriceTotal
	,SUM(NetPriceTotalComplete) AS NetPriceTotalComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalComplete)) AS TaxPriceTotalComplete
	,SUM(NetPriceTotalFC) AS NetPriceTotalFC
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFC)) AS TaxPriceTotalFC
	,SUM(NetPriceTotalFCComplete) AS NetPriceTotalFCComplete
	,CONVERT(NUMERIC(19, 2), SUM(TaxPriceTotalFCComplete)) AS TaxPriceTotalFCComplete
	,SUM(NetPurchasePriceTotal) AS NetPurchasePriceTotal
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotal
	,SUM(NetPurchasePriceTotalComplete) AS NetPurchasePriceTotalComplete
	,SUM(NetPurchasePriceTotalFC) AS NetPurchasePriceTotalFC
	,CONVERT(NUMERIC(19, 2), NULL) AS TaxPurchasePriceTotalFC
	,SUM(NetPurchasePriceTotalFCComplete) AS NetPurchasePriceTotalFCComplete
FROM dbo.cvw_OfferPos
WHERE (
		Kind IN (
			1
			,3
			)
		)
	AND (
		ISNULL(ArticlePositionKind, 0) IN (
			0
			,50
			)
		)
	AND (Expanded IS NULL)
GROUP BY OfferHeadI3D
	,HeadI3D
	,VATI3D
	,VATRate
	,IsReverseChargeActive
GO
/****** Object:  View [dbo].[cvw_OfferHead]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_OfferHead] 
AS
SELECT A.I3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,K.Name AS CustomerName
	,A.AngUeberschrift AS AdditionalText
	,A.Version
	,A.Empfanger AS Receiver
	,Ansch.Strasse AS AddressStreet
	,ISNULL(Ansch.PostfachAktiv, 0) AS AddressIsPostboxActive
	,Ansch.Postfach AS AddressPostbox
	,Ansch.Plz AS AddressZip
	,Ansch.Ort AS AddressCity
	,Pers.AnsprechVorname AS AddressContactFirstname
	,Pers.Ansprech AS AddressContactLastname
	,CASE 
		WHEN A.FilialI3D <= 0
			THEN NULL
		ELSE A.FilialI3D
		END AS BranchI3D
	,CASE WHEN A.KundenID <= 0 THEN NULL ELSE A.KundenID END AS CustomerI3D
	,CASE 
		WHEN A.BearbeiterI3D <= 0
			THEN NULL
		ELSE A.BearbeiterI3D
		END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.Projektnummer AS ProjectNumber
	,CASE 
		WHEN A.InnendienstID <= 0
			THEN NULL
		ELSE A.InnendienstID
		END AS Adviser1I3D
	,CASE 
		WHEN A.AussendienstID <= 0
			THEN NULL
		ELSE A.AussendienstID
		END AS Adviser2I3D
	,CASE 
		WHEN A.TechnikerID <= 0
			THEN NULL
		ELSE A.TechnikerID
		END AS Adviser3I3D
	,CASE 
		WHEN A.Techniker2ID <= 0
			THEN NULL
		ELSE A.Techniker2ID
		END AS Adviser4I3D
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptCondition
	,CASE WHEN A.ZahlKondRechI3D <= 0 THEN NULL ELSE A.ZahlKondRechI3D END AS PaymentConditionI3D
	,ZR.Kurztext AS PaymentCondition
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryCondition
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPrice
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPrice
	,SUM(ISNULL(AP.NetPriceTotal,0)) AS NetPriceComplete
	,SUM(ISNULL(AP.TaxPriceTotal,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotal,0)) + SUM(ISNULL(AP.TaxPriceTotal,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceComplete
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFC
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFC
	,SUM(ISNULL(AP.NetPriceTotalFC,0)) AS NetPriceFCComplete
	,SUM(ISNULL(AP.TaxPriceTotalFC,0)) - CASE WHEN ISNULL(SD.Wert,0) = 1 THEN (SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) - (ROUND((SUM(ISNULL(AP.NetPriceTotalFC,0)) + SUM(ISNULL(AP.TaxPriceTotalFC,0))) / 0.05,0) * 0.05) ELSE 0 END AS TaxPriceFCComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePrice
	,NULL AS TaxPurchasePrice
	,SUM(ISNULL(AP.NetPurchasePriceTotal,0)) AS NetPurchasePriceComplete
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFC
	,NULL AS TaxPurchasePriceFC
	,SUM(ISNULL(AP.NetPurchasePriceTotalFC,0)) AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,ISNULL(MAX(AP.IsReverseChargeActive),0) AS GotReverseCharge
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN A.LandI3D <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,A.GeaendertDatum AS ChangeDate
FROM dbo.AngKopf AS A
LEFT OUTER JOIN dbo.Anschrif AS Ansch ON A.AnschriftID = Ansch.I3D
LEFT OUTER JOIN dbo.Personen AS Pers ON A.PersonID = Pers.I3D
LEFT OUTER JOIN dbo.cvw_OfferHeadVATPriceSplit AP ON AP.HeadI3D = A.I3D
LEFT OUTER JOIN dbo.Kunden AS K ON A.KundenID = K.I3D
LEFT OUTER JOIN dbo.Zahkond ZR ON ZR.I3D = A.ZahlKondRechI3D
INNER JOIN dbo.Stammdat AS SD ON SD.I3D = 1113
GROUP BY A.I3D
	,A.Datum
	,A.Nummer
	,A.Empfanger
	,A.ZahlKond
	,ZR.Kurztext
	,A.LieferbedID
	,A.LieferbedingungsText
	,A.LiefKundEmpfaenger
	,A.RechKundEmpfaenger
	,A.Status
	,A.Lieferdatum
	,A.Version
	,A.LieferbedingungsText
	,A.KundenID
	,A.FilialI3D
	,A.BearbeiterI3D
	,A.BestNr
	,A.MwStNichtAusweisbar
	,A.AngUeberschrift
	,A.InnendienstID
	,A.AussendienstID
	,A.TechnikerID
	,A.Techniker2ID
	,K.Name
	,A.Bereitstellung
	,A.Projektnummer
	,A.ZahlKondID
	,A.ZahlKondRechI3D
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.Bar
	,Ansch.Strasse
	,Ansch.Postfach
	,Ansch.PostfachAktiv
	,Ansch.Plz
	,Ansch.Ort
	,Pers.AnsprechVorname
	,Pers.Ansprech
	,A.Tel
	,A.Fax
	,A.Mail
	,A.WVorlage
	,A.LandI3D
	,SD.Wert
    ,A.GeaendertDatum 

      
GO
/****** Object:  View [dbo].[ReceiptsCache]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ReceiptsCache]
AS
SELECT 
	I3D
	,1 AS ObjectKind
	,A.Number
	,A.Date
	,A.CustomerI3D AS AccountI3D
	,A.NetPrice AS NetPrice
	,A.TaxPrice AS TaxPrice
	,A.NetPrice AS NetPriceComplete
	,A.TaxPrice AS TaxPriceComplete
	,A.NetPriceFC AS NetPriceFC
	,A.TaxPriceFC AS TaxPriceFC
	,A.NetPriceFC AS NetPriceFCComplete
	,A.TaxPriceFC AS TaxPriceFCComplete
	,A.NetPurchasePrice AS NetPurchasePrice
	,A.NetPurchasePrice AS NetPurchasePriceComplete
	,A.NetPurchasePriceFC AS NetPurchasePriceFC
	,A.NetPurchasePriceFC AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
FROM cvw_OfferHead A
UNION ALL
SELECT 
	I3D
	,2 AS ObjectKind
	,A.Number
	,A.Date
	,A.CustomerI3D AS AccountI3D
	,A.NetPrice
	,A.TaxPrice
	,A.NetPriceComplete
	,A.TaxPriceComplete
	,A.NetPriceFC
	,A.TaxPriceFC
	,A.NetPriceFCComplete
	,A.TaxPriceFCComplete
	,A.NetPurchasePrice
	,A.NetPurchasePriceComplete
	,A.NetPurchasePriceFC
	,A.NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
FROM cvw_OrderHead A
UNION ALL
SELECT 
	I3D
	,3 AS ObjectKind
	,A.Number
	,A.Date
	,A.CustomerI3D AS AccountI3D
	,A.NetPrice
	,A.TaxPrice
	,A.NetPriceComplete
	,A.TaxPriceComplete
	,A.NetPriceFC
	,A.TaxPriceFC
	,A.NetPriceFCComplete
	,A.TaxPriceFCComplete
	,A.NetPurchasePrice
	,A.NetPurchasePriceComplete
	,A.NetPurchasePriceFC
	,A.NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
FROM cvw_DeliveryListHead A
UNION ALL
SELECT 
	I3D
	,4 AS ObjectKind
	,A.Number
	,A.Date
	,A.CustomerI3D AS AccountI3D
	,A.NetPrice
	,A.TaxPrice
	,A.NetPriceComplete
	,A.TaxPriceComplete
	,A.NetPriceFC
	,A.TaxPriceFC
	,A.NetPriceFCComplete
	,A.TaxPriceFCComplete
	,A.NetPurchasePrice
	,A.NetPurchasePriceComplete
	,A.NetPurchasePriceFC
	,A.NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
FROM cvw_InvoiceHead A
UNION ALL
SELECT 
	I3D
	,5 AS ObjectKind
	,A.Number
	,A.Date
	,A.CustomerI3D AS AccountI3D
	,A.NetPrice
	,A.TaxPrice
	,A.NetPrice AS NetPriceComplete
	,A.TaxPrice AS TaxPriceComplete
	,A.NetPriceFC
	,A.TaxPriceFC
	,A.NetPriceFC AS NetPriceFCComplete
	,A.TaxPriceFC AS TaxPriceFCComplete
	,A.NetPurchasePrice
	,A.NetPurchasePrice AS NetPurchasePriceComplete
	,A.NetPurchasePriceFC
	,A.NetPurchasePriceFC AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
FROM cvw_PickupListHead A
UNION ALL
SELECT 
	I3D
	,6 AS ObjectKind
	,A.Number AS Number
	,A.Date AS Date
	,A.CustomerI3D AS AccountI3D
	,A.NetPrice
	,A.TaxPrice
	,A.NetPrice AS NetPriceComplete
	,A.TaxPrice AS TaxPriceComplete
	,A.NetPriceFC
	,A.TaxPriceFC
	,A.NetPriceFC AS NetPriceFCComplete
	,A.TaxPriceFC AS TaxPriceFCComplete
	,A.NetPurchasePrice
	,A.NetPurchasePrice AS NetPurchasePriceComplete
	,A.NetPurchasePriceFC
	,A.NetPurchasePriceFC AS NetPurchasePriceFCComplete
	,A.CurrencyI3D
	,A.CurrencyFactor
	,A.CurrencyString
	,A.IsCashAsset
FROM cvw_CreditVoucherHead A
GO
/****** Object:  View [dbo].[cvw_AssetManagementSnmpMibOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementSnmpMibOverview]
        AS
        SELECT        dbo.AssetManagementSnmpMibDetails.I3D, dbo.AssetManagementSnmpMibDetails.ProviderName, dbo.AssetManagementSnmpMibDetails.ProviderCode, dbo.AssetManagementSnmpMibDetails.ServiceName, 
                                 dbo.AssetManagementSnmpMibDetails.IsActive, dbo.AssetManagementSnmpMibOidDetails.I3D AS MibOidDetailI3D, dbo.AssetManagementSnmpMibOidDetails.OidValue, 
                                 dbo.AssetManagementSnmpMibOidDetails.ResultType, dbo.AssetManagementSnmpMibOidDetails.PreCondition, dbo.AssetManagementSnmpMibOidDetails.ActualFormat, 
                                 dbo.AssetManagementSnmpMibOidDetails.SuccessFormat, dbo.AssetManagementSnmpMibOidDetails.WarningFormat, dbo.AssetManagementSnmpMibOidDetails.ErrorFormat, 
                                 dbo.AssetManagementSnmpMibOidDetails.OtherFormat, dbo.AssetManagementSnmpMibOidDetails.DependentOidValue, dbo.AssetManagementSnmpMibOidDetails.IsActive AS MibOidDetailIsActive, 
                                 dbo.AssetManagementSnmpMibOidDetails.IsRangeEnabled, dbo.AssetManagementSnmpMibOidDetails.StartRange, dbo.AssetManagementSnmpMibOidDetails.EndRange, 
                                 dbo.AssetManagementSnmpMibOidDetails.CommandType, dbo.AssetManagementSnmpMibOidDetails.IsParallelRecordsExists, dbo.AssetManagementSnmpMibOidDetails.ParentI3D, 
                                 dbo.AssetManagementSnmpMibOidDetails.SizeCheckType
        FROM            dbo.AssetManagementSnmpMibDetails INNER JOIN
                                 dbo.AssetManagementSnmpMibOidDetails ON dbo.AssetManagementSnmpMibDetails.I3D = dbo.AssetManagementSnmpMibOidDetails.SnmpMibI3D
      
GO
/****** Object:  Table [dbo].[LiefKopfVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiefKopfVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[ErstellungsArt] [varchar](50) NULL,
	[Datum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[LieferBedID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[AusAuf] [int] NULL,
	[Service] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[Lieferstatus] [int] NULL,
	[LiefPersonalI3D] [int] NULL,
	[ScanDocI3D] [int] NULL,
	[Leasing] [int] NULL,
	[LeasingMonate] [int] NULL,
	[LeasingSatz] [float] NULL,
	[LeasingRate] [float] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LeasingGebehr] [float] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[Zusatztext] [varchar](70) NULL,
	[BestNr] [varchar](50) NULL,
	[ProjNr] [varchar](50) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[RechKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[OriginalI3D] [int] NULL,
	[LeasingGebuehr] [float] NULL,
	[Direktlieferung] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](1000) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[Var1Lieferschein] [varchar](500) NULL,
	[Var2Lieferschein] [datetime] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[LieferscheinGrundI3D] [int] NULL,
	[LieferscheinGrundText] [varchar](500) NULL,
	[FilialgeberI3D] [int] NULL,
	[Trackingnummer] [varchar](500) NULL,
	[DurchRMAGeschlossen] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[LiefEskDatum] [datetime] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[Rabatt] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[CreatedFromObjectI3D] [int] NULL,
	[CreatedFromObjectKind] [int] NULL,
	[IsPositionProvision] [bit] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFCComplete] [decimal](19, 2) NOT NULL,
	[VertragsI3D] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[TrackingNumberURL] [nvarchar](2000) NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[SendDateOfProduct] [datetime2](7) NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[DeliveryListVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[DeliveryListVersions] AS
SELECT A.I3D
	,A.OriginalI3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentConditionText
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryConditionText
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN A.LieferscheinGrundI3D <= 0 THEN NULL ELSE A.LieferscheinGrundI3D END AS ReceiptReasonI3D
	,A.LieferscheinGrundText AS ReceiptReasonText
	,CASE WHEN YEAR(ISNULL(A.Var2Lieferschein,0)) < 1905 THEN NULL ELSE A.Var2Lieferschein END AS VariableDateField
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.VertragsI3D AS ContractI3D
	,ISNULL(A.LiefKundFremd, 0) AS UsedAlternativeDeliveryAddress
	,A.GUI3D AS ConcurrencyControlGuid
	,CASE WHEN YEAR(ISNULL(A.LiefEskDatum, 0)) < 1905 THEN NULL ELSE A.LiefEskDatum END AS EscalationDate
	,A.SendDateOfProduct AS SendDateOfProduct
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.CampaignI3D
	,A.Trackingnummer AS TrackingNumber
	,A.TrackingNumberURL
	,A.ReceiptUserStateI3D
    ,IIF(ISNULL(A.Var1Lieferschein, 0) <= 0, NULL, A.Var1Lieferschein) AS VariableComboBoxFieldI3D
	,A.DurchRMAGeschlossen AS ClosedThroughRMA
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.LiefKopfVersions AS A
GO
/****** Object:  Table [dbo].[AbholKopfVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbholKopfVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[Datum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LandI3D] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[OriginalI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[DocDirI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[AbholscheinGrundI3D] [int] NULL,
	[AbholscheinGrundText] [varchar](500) NULL,
	[FilialgeberI3D] [int] NULL,
	[InfoAnzeigen] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[Rabatt] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[VertragsI3D] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[PickupListVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[PickupListVersions] AS
SELECT A.I3D
	,A.OriginalI3D
	,A.Nummer AS Number
	,A.Datum AS Date
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptConditionText
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN A.AbholscheinGrundI3D <= 0 THEN NULL ELSE A.AbholscheinGrundI3D END AS ReceiptReasonI3D
	,A.AbholscheinGrundText AS ReceiptReasonText
    ,0 AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.VertragsI3D AS ContractI3D
	,0 AS UsedAlternativeDeliveryAddress
	,A.GUI3D AS ConcurrencyControlGuid
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.CampaignI3D
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.AbholKopfVersions AS A
GO
/****** Object:  Table [dbo].[GutKopfVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GutKopfVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[Datum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[AusAuf] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LandI3D] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[Archiviert] [int] NULL,
	[OriginalI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[DocDirI3D] [int] NULL,
	[Bereitstellung] [datetime] NULL,
	[BestNr] [varchar](50) NULL,
	[Zusatztext] [varchar](70) NULL,
	[Direktlieferung] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LieferbedingungsText] [varchar](255) NULL,
	[Lieferdatum] [datetime] NULL,
	[LiefKundFremd] [int] NULL,
	[LSuREvVersand] [int] NULL,
	[ProjNr] [varchar](50) NULL,
	[RechKundFremd] [int] NULL,
	[Teillieferung] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[GutschriftGrundI3D] [int] NULL,
	[GutschriftGrundText] [varchar](500) NULL,
	[FilialgeberI3D] [int] NULL,
	[InfoAnzeigen] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[Rabatt] [float] NULL,
	[WertGutschrift] [int] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[FIBUSammelkonto] [varchar](24) NULL,
	[IsPositionProvision] [bit] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[VertragsI3D] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[CreditVoucherVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[CreditVoucherVersions] AS
SELECT A.I3D
	,A.OriginalI3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptConditionText
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN A.GutschriftGrundI3D <= 0 THEN NULL ELSE A.GutschriftGrundI3D END AS ReceiptReasonI3D
	,A.GutschriftGrundText AS ReceiptReasonText
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.VertragsI3D AS ContractI3D
	,ISNULL(A.LiefKundFremd, 0) AS UsedAlternativeDeliveryAddress
	,ISNULL(A.RechKundFremd, 0) AS UsedAlternativeInvoiceAddress
	,A.GUI3D AS ConcurrencyControlGuid
	,ISNULL(A.WertGutschrift, 0) AS OnlyPriceValue
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.CampaignI3D
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
FROM dbo.GutKopfVersions AS A
GO
/****** Object:  View [dbo].[cvw_SepaMandates]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_SepaMandates] AS 
SELECT I3D, I3D AS BankAccountI3D, ObjectI3D, ObjectArt AS ObjectKind, Status, IsDefault, 
  AuthorizationNumber, AuthorizationDate, ValidFrom, ValidTo, LastUsed, DirectDebitType 
 FROM dbo.Bankverbindungen 
      
GO
/****** Object:  Table [dbo].[Kassenbuch]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kassenbuch](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[PersonalI3D] [int] NULL,
	[Buchungstext] [varchar](250) NULL,
	[Soll] [float] NULL,
	[Haben] [float] NULL,
	[Art] [int] NULL,
	[RechKopfI3D] [int] NULL,
	[ZahKondI3D] [int] NULL,
	[Bestand] [int] NULL,
	[Abschluss] [datetime] NULL,
	[Laufnummer] [int] NULL,
	[Belegart] [int] NULL,
	[Betrag] [float] NULL,
	[ReadOnly] [int] NULL,
	[Steuerschluessel] [varchar](10) NULL,
	[Sachkonto] [varchar](50) NULL,
	[RWUebergabe] [int] NULL,
	[RWPersonalI3D] [int] NULL,
	[RWDatum] [datetime] NULL,
	[BranchI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[AnlageArt] [int] NULL,
	[PersonalBranchI3D] [int] NULL,
	[Status] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[Gegenkonto] [varchar](50) NULL,
	[Belegfeld] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_CashBookCashOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_CashBookCashOverview] AS
SELECT 
	K.I3D
	,K.Datum AS TransactionDate
	,K.Laufnummer AS SequenceNumber
	,CASE WHEN ISNULL(K.FilialI3D,0) <= 0 THEN NULL ELSE K.FilialI3D END AS BranchI3D
	,RK.KundenID AS CustomerI3D
	,K.Buchungstext AS BookingText
	,K.Soll AS DebitAmount
	,K.Haben AS CreditAmount
	,SUM(CONVERT(decimal(18,2),(ISNULL(K.Soll,0) - ISNULL(K.Haben,0)))) OVER 
		(
			PARTITION BY CASE WHEN ISNULL(K.FilialI3D,0) <= 0 THEN NULL ELSE K.FilialI3D END 
			ORDER BY K.Datum, K.I3D
		) AS CurrentCashAmount
	,SUM(CONVERT(decimal(18,2),(ISNULL(K.Soll,0) - ISNULL(K.Haben,0)))) OVER 
		(
			PARTITION BY CASE WHEN ISNULL(K.FilialI3D,0) <= 0 THEN NULL ELSE K.FilialI3D END 
			ORDER BY K.Datum, K.I3D
		) - CONVERT(decimal(18,2),ISNULL(K.Soll,0) - ISNULL(K.Haben,0)) AS BeforeCashAmount
	,K.Abschluss AS ClosedDate
	,P.KurzZeich AS EmployeeShortSign
	,K.Sachkonto AS LedgerAccount
FROM Kassenbuch K
LEFT OUTER JOIN RechKopf RK ON RK.I3D = K.RechKopfI3D
LEFT OUTER JOIN Zahkond ZK ON ZK.I3D = K.ZahKondI3D
LEFT OUTER JOIN Personal P ON P.I3D = K.PersonalI3D
WHERE (ZK.I3D IS NULL OR ZK.Bar = 1)
AND K.Bestand = 1
GO
/****** Object:  View [dbo].[SupplierCreditVouchers]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[SupplierCreditVouchers]
AS
SELECT
	I3D = K.I3D,

	Number = K.Nummer,
	Date = K.Datum,
	Version = K.Version,
	State = K.Status,
	EditorI3D = IIF(K.PersonalI3D <= 0, NULL, K.PersonalI3D),
	DirectoryI3D = IIF(K.DocDirI3D <= 0, NULL, K.DocDirI3D),

	BranchI3D = IIF(K.BranchI3D <= 0, NULL, K.BranchI3D),
	BranchOrigin = ISNULL(K.BranchOrigin, 0),

	CurrencyI3D = IIF(ISNULL(K.CurrencyI3D, 0) <= 0, NULL, K.CurrencyI3D),
	CurrencyFactor = ISNULL(K.CurrencyFactor, 1),
	CurrencyString = ISNULL(K.CurrencyString, '€'),
	ExclusiveOfVat = ISNULL(K.MwStAusweisen, 0),

	Receiver = ISNULL(K.Empfanger, ''),
	Phone = ISNULL(K.Tel, ''),
	Fax = ISNULL(K.Fax, ''),
	Email = ISNULL(K.Mail, ''),

	SupplierI3D = IIF(ISNULL(K.KreditorI3D, 0) <= 0, 0, K.KreditorI3D),
	AddressI3D = IIF(K.AnschriftI3D <= 0, NULL, K.AnschriftI3D),
	ContactPersonI3D = IIF(K.PersonI3D <= 0, NULL, K.PersonI3D),
	Street = ISNULL(K.Street, ''),
	HasPostOfficeBox = ISNULL(K.HasPostOfficeBox, 0),
	PostOfficeBox = ISNULL(K.PostOfficeBox, ''),
	Zip = ISNULL(K.Zip, ''),
	City = ISNULL(K.City, ''),
	ContactName = ISNULL(K.ContactName, ''),
	CountryI3D = IIF(ISNULL(K.LandI3D, 0) <= 0, NULL, K.LandI3D),

	CreatedByI3D = IIF(K.ErstelltVonI3D <= 0, NULL, K.ErstelltVonI3D),
	CreatedAt = IIF(YEAR(ISNULL(K.ErstelltDatum,0)) < 1905, NULL, K.ErstelltDatum),
	CreatedThroughApplicationVersion = ISNULL(K.ErstelltVersion, ''),
	ChangedByI3D = IIF(K.GeaendertVonI3D <= 0, NULL, K.GeaendertVonI3D),
	ChangedAt = IIF(YEAR(ISNULL(K.GeaendertDatum,0)) < 1905, NULL, K.GeaendertDatum),
	ChangedThroughApplicationVersion = ISNULL(K.GeaendertVersion, ''),
	ChangedThroughApplication = ISNULL(K.ChangedThroughApplication, 0),

	ConcurrencyControlGuid = K.ConcurrencyControlGuid,
	ExternalCreditVoucherDate = IIF(YEAR(K.GutschriftsDatum) < 1905, NULL, K.GutschriftsDatum),
	ExternalCreditVoucherNumber = K.GutschriftsNr,
	SupplierPaymentConditionI3D = IIF(K.ZahlKondI3D <= 0, NULL, K.ZahlKondI3D),
	SupplierPaymentConditionText = K.ZahlKondText,
	Information = K.Notiz,
	K.LiGutschriftGrundI3D AS ReceiptReasonI3D,
	K.LiGutschriftGrundText AS ReceiptReasonText,
	K.BruttobetragGesamt AS ReceiptGrossPrice,
	K.VarFeld1 AS VariableField1,
	ReceiptReceiverI3D = K.ReceiptReceiverI3D,
	ReceiptReceiverInvoiceI3D = K.ReceiptReceiverInvoiceI3D,
	ReceiptReceiverDeliveryI3D = K.ReceiptReceiverDeliveryI3D,
	ReceiptReceiverLicenseI3D = K.ReceiptReceiverLicenseI3D
FROM dbo.LiGutKopf K
WHERE ISNULL(K.AktuelleVersion,1) = 1
GO
/****** Object:  View [dbo].[SupplierCreditVoucherItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[SupplierCreditVoucherItems] AS
SELECT
	I3D = P.I3D,
	
	Kind = P.Art,
	ReceiptI3D = P.LiGutKopfI3D,
	Text = ISNULL(CASE WHEN P.Art IN (1,3,4,5,11,12) THEN P.Text ELSE P.Freitext END, ''),
	FontStyle = P.FontStyle,
	FontSize = P.FontSize,
	FontName = P.FontName,
	FontColor = P.FontColor,
	InternalPosition = P.Pos,
	ArticleI3D = P.ArtikelI3D,
	ArticleCode = P.Artikelcode,
	EANCode = P.EANCode,
	ManufacturerCode = P.Herstellercode,
	SupplierManufacturerCode = P.Kreditorcode,
	ChangeStock = CASE WHEN P.Art = 1 THEN TRY_CAST(IIF(ISNULL(A.Abbuchung, 'N')='J' OR ISNULL(A.Abbuchung, 'N')='1',1,0) AS bit) 
		ELSE TRY_CAST(IIF(ISNULL(P.Abbuchung, 'N')='J' OR ISNULL(P.Abbuchung, 'N')='1',1,0) AS bit) END,
	CONVERT(DECIMAL(19,7), ROUND(P.Stk,7)) AS QuantityComplete,
	CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed,
	BasePrice = P.Preis,
	VATI3D = P.MwStI3D,
	CONVERT(DECIMAL(9,2), ROUND(ISNULL(P.MwstSatz,0),2)) AS VATRate,
	SpecialAgreementI3D = P.SondervereinbarungI3D,
	CostCenterI3D = P.Kostenstelle,
	CostObjectI3D = P.Kostentraeger,
	WarehouseI3D = P.NebenlagerI3D,
	WEEE = P.WEEE,

    --Anderes
	ExpenseAccount = P.AufwandKTO,
	OriginReceiptItemI3D = P.UebernommenAusI3D,
    OriginReceiptI3D = KP.KalkKopfI3D,
	OriginKind = P.UebernommenAusArt,
	ReceiptOrderItemI3D = P.EKAusAufPosI3D,
	ReceiptOrderI3D = P.AuftragI3D,
	IsBooked = CAST(IIF(P.Gebucht = 1, 1, 0) AS BIT),
	DeliveryDatePlanned = P.LieferDatumSoll,
	DeliveryDate = P.LieferDatumIst,
	RMAItemI3D = P.RMAPosI3D 

FROM dbo.LiGutPos P
INNER JOIN dbo.LiGutKopf H ON H.I3D = P.LiGutKopfI3D
LEFT OUTER JOIN dbo.ARTIK A ON A.I3D = P.ArtikelI3D
LEFT OUTER JOIN dbo.KalkPos KP ON KP.I3D = P.UebernommenAusI3D AND P.UebernommenAusArt = 18
WHERE ISNULL(H.AktuelleVersion,1) = 1

GO
/****** Object:  Table [dbo].[AufKopfVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufKopfVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[ErstellungsArt] [varchar](50) NULL,
	[Version] [int] NULL,
	[Datum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlkondID] [int] NULL,
	[LieferbedID] [int] NULL,
	[Status] [int] NULL,
	[Lockuser] [nvarchar](50) NULL,
	[AusAng] [int] NULL,
	[BestNr] [varchar](50) NULL,
	[ProjNr] [varchar](50) NULL,
	[Zusatztext] [varchar](70) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[Service] [int] NULL,
	[Kommisioniert] [int] NULL,
	[KommisioniertAm] [datetime] NULL,
	[Produziert] [int] NULL,
	[ProduziertAm] [datetime] NULL,
	[WorkFlowI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[AufScanDocI3D] [int] NULL,
	[BestScanDocI3D] [int] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[ToDoI3D] [int] NULL,
	[ToDoKomI3D] [int] NULL,
	[ToDoMonI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[RechKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[ZahlKondRechI3D] [int] NULL,
	[OriginalI3D] [int] NULL,
	[Direktlieferung] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[hlpdsk_requestsI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](1000) NULL,
	[RechnungskonditionsText] [varchar](1000) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[Var1Auftrag] [datetime] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[Abholung] [int] NULL,
	[LiefEskDatum] [datetime] NULL,
	[TerminplanungI3D] [int] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[Rabatt] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[FinaleVersion] [int] NULL,
	[BestellSperre] [int] NULL,
	[CreatedFromObjectI3D] [int] NULL,
	[CreatedFromObjectKind] [int] NULL,
	[BillingInterval] [int] NULL,
	[BillingBlocked] [bit] NULL,
	[BillingBlockedReason] [nvarchar](4000) NULL,
	[IsPositionProvision] [bit] NULL,
	[LeasingMonate] [int] NULL,
	[LeasingSatz] [float] NULL,
	[LeasingRate] [float] NULL,
	[Leasing] [int] NULL,
	[LeasingGebuehr] [float] NULL,
	[ServiceMonate] [int] NULL,
	[ServiceSatz] [float] NULL,
	[ServiceRate] [float] NULL,
	[IsServiceShare] [int] NULL,
	[ServiceGebuehr] [float] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFCComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceComplete] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFCComplete] [decimal](19, 2) NOT NULL,
	[VertragsI3D] [int] NULL,
	[CreateHelpdesks] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[ContractTypeI3D] [int] NULL,
	[ContractPositionCombinationDecision] [int] NOT NULL,
	[TakeOnlyArticles] [bit] NOT NULL,
	[CommissionMailSetting] [int] NOT NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[OrderVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[OrderVersions] AS
SELECT A.I3D
	,A.OriginalI3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptConditionText
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryConditionText
	,CASE WHEN A.ZahlKondRechI3D <= 0 THEN NULL ELSE A.ZahlKondRechI3D END AS PaymentConditionI3D
	,A.RechnungskonditionsText AS PaymentConditionText
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,CASE WHEN YEAR(ISNULL(A.Var1Auftrag,0)) < 1905 THEN NULL ELSE A.Var1Auftrag END AS VariableDateField
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,CASE WHEN A.ToDoKomI3D <= 0 THEN NULL ELSE A.ToDoKomI3D END AS CommisionToDoI3D
    ,CASE WHEN A.ToDoMonI3D <= 0 THEN NULL ELSE A.ToDoMonI3D END AS MountingToDoI3D
    ,CASE WHEN A.Produziert > 0 THEN 1 ELSE 0 END AS Produced
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,ISNULL(A.BestellSperre, 0) AS IsPurchasingBlocked
	,ISNULL(A.Leasing, 0) AS IsLeasingActive
	,ISNULL(A.LeasingGebuehr, 0) AS LeasingFee
	,ISNULL(A.LeasingMonate, 0) AS LeasingMonths
	,ISNULL(A.LeasingSatz, 0) AS LeasingRatePercent
	,ISNULL(A.LeasingRate, 0) AS LeasingRatePerMonth
	,ISNULL(A.IsServiceShare, 0) AS IsServiceActive
	,ISNULL(A.ServiceGebuehr, 0) AS ServiceFee
	,ISNULL(A.ServiceMonate, 0) AS ServiceMonths
	,ISNULL(A.ServiceSatz, 0) AS ServiceRatePercent
	,ISNULL(A.ServiceRate, 0) AS ServiceRatePerMonth
	,A.VertragsI3D AS ContractI3D
	,A.CreateHelpdesks AS CreateHelpdesks
	,A.GUI3D AS ConcurrencyControlGuid
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,ISNULL(A.Direktlieferung, 0) AS IsDirectDeliveryPossible
	,A.CampaignI3D
	,A.ReceiptUserStateI3D
	,A.CommissionMailSetting
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.AufKopfVersions AS A
WHERE ISNULL(A.TerminplanungI3D, 0) = 0
GO
/****** Object:  View [dbo].[cvw_ArticleDemand]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_ArticleDemand] AS 
SELECT t.ArtikelI3D Articlei3D, t.LagerI3D StorageI3D, sum(t.Zulauf) Quantity  
 FROM  (
		SELECT bp.i3d,  
				bp.ArtikelI3D, ISNULL(bp.NebenlagerI3D,-1) LagerI3D,  
				CASE WHEN bp.stk * BP.Verpackungsmenge > ISNULL(wp.cnt,0) THEN bp.stk * BP.Verpackungsmenge ELSE ISNULL(wp.cnt,0) END
							-  (ISNULL(wp.DMcnt,0) + ISNULL(kp.cnt,0))  Zulauf 
		FROM BestPos2 BP 
		INNER JOIN BestKopf2 BK ON BK.I3D = BP.BestKopfI3D 
		LEFT OUTER JOIN (SELECT SUM(p.stk* abs(k.SpaeteBuchung-1)) DMcnt, SUM(p.stk) cnt, p.UebernommenAusI3D 
								FROM WarePos p  
								INNER JOIN WareKopf k ON k.I3D = p.WareKopfI3D 
								INNER JOIN BestPos2 bpw ON bpw.I3D = p.UebernommenAusI3D 
								INNER JOIN BestKopf2 bkw ON bkw.I3D = bpw.BestKopfI3D 
								WHERE bkw.Status = 1 AND bkw.AktuelleVersion = 1
								GROUP BY  p.UebernommenAusI3D) wp ON wp.UebernommenAusI3D = bp.I3D 
		LEFT OUTER JOIN (SELECT SUM(p.stk) cnt, wp.UebernommenAusI3D 
								FROM KalkPos p 
								INNER JOIN KalkKopf k ON k.I3D = p.KalkKopfI3D AND k.Status = 2 
								INNER JOIN WarePos wp ON wp.I3D = p.UebernommenAusI3D 
								INNER JOIN  WareKopf wk ON wk.I3D = wp.WareKopfI3D 
								INNER JOIN BestPos2 bpk ON bpk.I3D = wp.UebernommenAusI3D 
								INNER JOIN BestKopf2 bkk ON bkk.I3D = bpk.BestKopfI3D 
								WHERE bkk.Status = 1 AND bkk.AktuelleVersion = 1 AND  wk.SpaeteBuchung = 1 
								GROUP BY  wp.UebernommenAusI3D ) kp ON kp.UebernommenAusI3D = bp.I3D 
		WHERE  BK.Status = 1  AND 
	  			 BK.AktuelleVersion = 1 AND 
				 BP.ArtikelI3D > 0 ) t 
WHERE t.Zulauf > 0 
GROUP BY t.ArtikelI3D, t.LagerI3D
GO
/****** Object:  View [dbo].[cvw_DeliveryCount]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_DeliveryCount] 
	AS 
SELECT ap.I3D apI3D, 
IsNull((select sum(Stk) from LiefPos lp where lp.Ursprung=ap.I3D and lp.UrsprungArt = 1 ),0) + 
IsNull((select sum(Stk) from VertragPos vp where vp.Ursprung=ap.I3D and vp.UrsprungArt = 1 ),0) + 
IsNull((select sum(rp.Stk) from RechPos rp 
			inner join RechKopf rk on rk.I3D = rp.RechKopfI3D and rk.Status != 3 
			where rp.Ursprung=ap.I3D and rp.UrsprungArt = 1 
			),0) dynLiefermenge 
FROM AufPos ap  
WHERE ap.ArtikelI3D > 0
GO
/****** Object:  Table [dbo].[Zahlungseingang]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Zahlungseingang](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RechKopfI3D] [int] NULL,
	[Nummer] [int] NULL,
	[AngelegtAm] [datetime] NULL,
	[Betrag] [float] NULL,
	[Restbetrag] [float] NULL,
	[Rechnungsbetrag] [float] NULL,
	[Kontoauszug] [int] NULL,
	[DatumKontoauszug] [datetime] NULL,
	[PersonalI3D] [int] NULL,
	[Kommentar] [varchar](300) NULL,
	[Status] [varchar](1) NULL,
	[Bankverbindung] [varchar](120) NULL,
	[BetragUeberwiesenAm] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptUserState]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptUserState](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_ReceiptState] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_InvoicePaymentTransaction]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_InvoicePaymentTransaction]
AS
SELECT RK.I3D
	,RK.Nummer AS Number
	,RK.FaelligAm AS DueDate
	,RK.Datum AS Date
	,RK.Empfanger AS Recipient
	,ISNULL(IH.NetPriceFCComplete, 0) + CASE 
		WHEN RK.MwStNichtAusweisbar = 1
			THEN 0
		ELSE IH.TaxPriceFCComplete
		END AS InvoicePriceFC
	,RK.Status
	,RK.FilialI3D AS BranchI3D
	,ISNULL(RK.DTinErstellt, 0) AS DebitCreated
	,ISNULL(RK.EDIExport, 0) AS IsExportedThroughEdi
	,RK.CurrencyI3D
	,RK.CurrencyString
	,ISNULL(Z1.DTALastschrift, 0) AS IsPaymentThroughDebit
	,ISNULL(Z1.DTAAuswahl, 0) AS ExportDirectDebitType
	,K.NAME AS CustomerName
	,K.I3D AS CustomerNumber
	,Z1.LaenPer1 AS SkontoTimespan1
	,Z1.LaenPer2 AS SkontoTimespan2
	,Z1.LaenPer3 AS SkontoTimespan3
	,Z1.Skonto1 AS SkontoRate1
	,Z1.Skonto2 AS SkontoRate2
	,0 AS SkontoRate3
	,CONVERT(DECIMAL(19, 2), ISNULL(SUM(ISNULL(CP.NetPriceTotalFC, 0) + CASE 
					WHEN GK.MwStNichtAusweisbar = 1
						THEN 0
					ELSE ISNULL(CP.TaxPriceTotalFC, 0)
					END), 0)) AS AmountCreditVoucherFC
	,CONVERT(DECIMAL(38, 2), ROUND(ISNULL((
					SELECT ISNULL(SUM(ISNULL(Betrag, 0)), 0) AS Expr1
					FROM dbo.Zahlungseingang AS ZG
					WHERE (RechKopfI3D = RK.I3D)
					), 0), 2)) AS AmountIncomingPaymentsFC
	,K.Freitext01 AS CustomerVariableField
	,RK.SepaMandateI3D
	,VK.Nummer AS ContractNumber
	,rUserState.Caption AS ReceiptUserState
FROM dbo.RechKopf AS RK
INNER JOIN dbo.Kunden AS K ON K.I3D = CASE 
		WHEN (RK.RechKundFremd = 1)
			AND (RK.RechKundI3D > 0)
			THEN RK.RechKundI3D
		ELSE RK.KundenID
		END
INNER JOIN dbo.cvw_InvoiceHead AS IH ON IH.I3D = RK.I3D
INNER JOIN dbo.Zahkond AS Z1 ON Z1.I3D = RK.ZahlKondID
LEFT OUTER JOIN dbo.GutPos AS GP ON RK.I3D = GP.UrsprungI3D
	AND GP.Expanded IS NULL
LEFT OUTER JOIN dbo.cvw_CreditVoucherPos AS CP ON CP.I3D = GP.I3D
LEFT OUTER JOIN dbo.GutKopf AS GK ON GK.I3D = GP.GutKopfI3D
LEFT OUTER JOIN dbo.VertragKopf VK ON VK.I3D = RK.VertragsI3D
LEFT OUTER JOIN ReceiptUserState rUserState ON rUserState.I3D = RK.ReceiptUserStateI3D
WHERE RK.Nummer > 0
GROUP BY RK.I3D
	,RK.Nummer
	,RK.FaelligAm
	,RK.Datum
	,RK.Empfanger
	,IH.NetPriceFCComplete
	,IH.TaxPriceFCComplete
	,RK.MwStNichtAusweisbar
	,RK.Status
	,RK.FilialI3D
	,RK.CurrencyI3D
	,RK.CurrencyString
	,K.NAME
	,K.I3D
	,Z1.LaenPer1
	,Z1.LaenPer2
	,Z1.LaenPer3
	,Z1.Skonto1
	,Z1.Skonto2
	,RK.DTinErstellt
	,Z1.DTALastschrift
	,Z1.DTAAuswahl
	,RK.EDIExport
	,K.Freitext01
	,RK.SepaMandateI3D
	,VK.Nummer
	,rUserState.Caption
GO
/****** Object:  Table [dbo].[SonderaktionenReferenzen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SonderaktionenReferenzen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SonderaktionenI3D] [int] NULL,
	[ParentI3D] [int] NULL,
	[ReferenzArt] [int] NULL,
	[ReferenzI3D] [int] NULL,
	[Status] [int] NULL,
	[Suche] [varchar](50) NULL,
	[FlagI3D] [int] NULL,
	[TelemarketingTexteI3D] [int] NULL,
 CONSTRAINT [PK_SonderaktionenReferenzen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Branche]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Branche](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Kontakte]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kontakte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
	[Nummer] [int] NULL,
	[Name] [varchar](240) NULL,
	[Tel1] [varchar](30) NULL,
	[Fax1] [varchar](30) NULL,
	[EMail1] [varchar](255) NULL,
	[URL1] [varchar](255) NULL,
	[KonzernI3D] [int] NULL,
	[RootDirI3D] [int] NULL,
	[ImportBezeichnung] [varchar](500) NULL,
	[ImportDatum] [datetime] NULL,
	[ImportPersonalI3D] [int] NULL,
	[MailDirI3D] [int] NULL,
	[AkqWiedervorlage] [int] NULL,
	[AkqWiedervorlageArt] [int] NULL,
	[AkqWiedervorlageDatum] [datetime] NULL,
	[AkqWiedervorlageDauer] [int] NULL,
	[TaetDirI3D] [int] NULL,
	[Betreuer1I3D] [int] NULL,
	[Betreuer2I3D] [int] NULL,
	[VertriebssteuerungI3D] [int] NULL,
	[VertriebsgebietI3D] [int] NULL,
	[HerkunftI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KontaktePersonen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KontaktePersonen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
	[KontakteAnschriftenI3D] [int] NULL,
	[Standard] [int] NULL,
	[Kommentar] [varchar](1000) NULL,
	[Name] [varchar](60) NULL,
	[Vorname] [varchar](60) NULL,
	[TitelI3D] [int] NULL,
	[AnredeI3D] [int] NULL,
	[AbteilungI3D] [int] NULL,
	[AbteilungText] [varchar](255) NULL,
	[Beruf] [varchar](100) NULL,
	[Geburtstag] [datetime] NULL,
	[Tel1] [varchar](30) NULL,
	[Tel2] [varchar](30) NULL,
	[Tel3] [varchar](30) NULL,
	[Fax1] [varchar](30) NULL,
	[Fax2] [varchar](30) NULL,
	[EMail1] [varchar](255) NULL,
	[EMail2] [varchar](255) NULL,
	[Mailing1] [int] NULL,
	[Mailing2] [int] NULL,
	[Tel5] [varchar](30) NULL,
	[Kommentar2] [varchar](255) NULL,
	[Kommentar3] [varchar](255) NULL,
	[Bild] [image] NULL,
	[BildExt] [varchar](5) NULL,
	[IsDsgvoDeleted] [bit] NULL,
	[DsgvoDeletedEmployeeI3D] [int] NULL,
	[DsgvoDeletedDate] [datetime2](0) NULL,
	[AccountAddressContactReferenceI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_TelemarketingReferences]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_TelemarketingReferences]
AS
SELECT        SR.I3D, SR.SonderaktionenI3D AS TelemarketingI3D, CASE WHEN SR.ParentI3D <= 0 THEN NULL ELSE SR.ParentI3D END AS ParentI3D, 
                         SR.ReferenzArt AS ReferenceKind, SR.ReferenzI3D AS ReferenceI3D, ISNULL(SR.Status, 0) AS Status, 
                         CASE SR.ReferenzArt WHEN 1 THEN CONVERT(nvarchar, K.I3D) + ' ' + K.Name WHEN 2 THEN CONVERT(nvarchar, AK.Nummer) + ' ' + CONVERT(nvarchar, 
                         AK.Datum, 7) WHEN 3 THEN CONVERT(nvarchar, RK.Nummer) + ' ' + CONVERT(nvarchar, RK.Datum, 7) 
                         WHEN 4 THEN B.Name WHEN 5 THEN CASE WHEN P.I3D IS NULL THEN ISNULL(KonP.Vorname, '') + ' ' + ISNULL(KonP.Name, '') 
                         ELSE ISNULL(P.AnsprechVorname, '') + ' ' + ISNULL(P.Ansprech, '') END WHEN 6 THEN CONVERT(nvarchar, CASE WHEN ISNULL(Kon.Nummer, 0) 
                         = 0 THEN Kon.I3D ELSE Kon.Nummer END) + ' ' + Kon.Name END AS Caption
FROM            dbo.SonderaktionenReferenzen AS SR LEFT OUTER JOIN
                         dbo.Kunden AS K ON K.I3D = SR.ReferenzI3D AND SR.ReferenzArt = 1 LEFT OUTER JOIN
                         dbo.Kontakte AS Kon ON Kon.I3D = SR.ReferenzI3D AND SR.ReferenzArt = 6 LEFT OUTER JOIN
                         dbo.Personen AS P ON P.I3D = SR.ReferenzI3D AND SR.ReferenzArt = 5 AND
                             (SELECT        SRR.I3D
                               FROM            dbo.SonderaktionenReferenzen AS SRR INNER JOIN
                                                         dbo.Kunden AS SRRK ON SRRK.I3D = SRR.ReferenzI3D AND SRR.ReferenzArt = 1
                               WHERE        (SRR.I3D = SR.ParentI3D)) IS NOT NULL LEFT OUTER JOIN
                         dbo.KontaktePersonen AS KonP ON KonP.I3D = SR.ReferenzI3D AND SR.ReferenzArt = 5 LEFT OUTER JOIN
                         dbo.AngKopf AS AK ON AK.I3D = SR.ReferenzI3D AND SR.ReferenzArt = 2 LEFT OUTER JOIN
                         dbo.RechKopf AS RK ON RK.I3D = SR.ReferenzI3D AND SR.ReferenzArt = 3 LEFT OUTER JOIN
                         dbo.Branche AS B ON B.I3D = SR.ReferenzI3D AND SR.ReferenzArt = 4
WHERE        (ISNULL(SR.ParentI3D, 0) <= 0) OR
                         (ISNULL(SR.ParentI3D, 0) IN
                             (SELECT        I3D
                               FROM            dbo.SonderaktionenReferenzen))  
    
GO
/****** Object:  View [dbo].[cvw_PickUpCount]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_PickUpCount] 
	AS 
SELECT lp.I3D lpI3D, 
IsNull((select sum(Stk) from AbholPos ap where ap.Ursprung=lp.I3D and ap.UrsprungArt = 2 ),0) + 
IsNull((select sum(rp.Stk) from RechPos rp  
      inner join RechKopf rk on rk.I3D = rp.RechKopfI3D and rk.Status != 3 
      where rp.Ursprung=lp.I3D and rp.UrsprungArt = 2 
       ),0) dynNumAbhol 
FROM LiefPos lp  
WHERE lp.ArtikelI3D > 0
GO
/****** Object:  Table [dbo].[Sonderaktionen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sonderaktionen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Bezeichnung] [varchar](250) NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[ErstelltVon] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[GeaendertVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[RootDirI3D] [int] NULL,
	[ProductFamilyActionI3D] [int] NULL,
	[WithAction] [int] NULL,
 CONSTRAINT [PK_Sonderaktionen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SonderaktionenAktion]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SonderaktionenAktion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SonderaktionenReferenzenI3D] [int] NULL,
	[SonderaktionenAktionVorlagenI3D] [int] NULL,
	[Status] [int] NULL,
	[Kommentar] [varchar](500) NULL,
	[ReferenzArt] [int] NULL,
	[Datum] [datetime] NULL,
	[StartDate] [datetime] NULL,
	[DueDate] [datetime] NULL,
	[CRMActivityI3D] [int] NULL,
	[Caption] [nvarchar](128) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SonderaktionenAktionVorlagen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SonderaktionenAktionVorlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](200) NULL,
	[Status] [int] NULL,
	[Sortierung] [int] NULL,
	[SonderaktionenI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_TelemarketingReferenceActions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_TelemarketingReferenceActions]
AS
SELECT        SA.I3D, S.I3D AS TelemarketingI3D, SA.SonderaktionenReferenzenI3D AS TelemarketingReferenceI3D, SR.Caption AS TelemarketingReferenceCaption, 
                         SA.SonderaktionenAktionVorlagenI3D AS TelemarketingActionTemplateI3D, ISNULL(SA.Caption, SAV.Bezeichnung) AS Caption, SA.Status, 
                         SA.Kommentar AS Comment, SA.Datum AS ChangedDate, SA.StartDate, SA.DueDate, SA.CRMActivityI3D, T.EmpfaengerI3D AS EditorI3D
FROM            dbo.SonderaktionenAktion AS SA INNER JOIN
                         dbo.cvw_TelemarketingReferences AS SR ON SR.I3D = SA.SonderaktionenReferenzenI3D INNER JOIN
                         dbo.Sonderaktionen AS S ON S.I3D = SR.TelemarketingI3D LEFT OUTER JOIN
                         dbo.SonderaktionenAktionVorlagen AS SAV ON SAV.I3D = SA.SonderaktionenAktionVorlagenI3D LEFT OUTER JOIN
                         dbo.Taetigkeiten AS T ON T.I3D = SA.CRMActivityI3D
      
GO
/****** Object:  Table [dbo].[AccountAddresses]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountAddresses](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[Street] [nvarchar](300) NULL,
	[Zip] [nvarchar](10) NULL,
	[City] [nvarchar](30) NULL,
	[CountryI3D] [int] NOT NULL,
	[LanguageI3D] [int] NOT NULL,
	[CurrencyI3D] [int] NOT NULL,
	[IsPostOfficeBoxActive] [bit] NOT NULL,
	[PostOfficeBox] [nvarchar](50) NULL,
	[Comment] [nvarchar](500) NULL,
	[CreatedByI3D] [int] NULL,
	[CreatedDate] [datetime2](7) NULL,
	[CreatedVersion] [nvarchar](16) NULL,
	[ChangedByI3D] [int] NULL,
	[ChangedDate] [datetime2](7) NULL,
	[ChangedVersion] [nvarchar](16) NULL,
	[Department] [nvarchar](255) NULL,
	[AddressKind] [int] NOT NULL,
	[PrintName] [bit] NOT NULL,
	[PrintAddressContact] [bit] NOT NULL,
	[PrintDepartment] [bit] NOT NULL,
	[PrintDepartmentAddressContact] [bit] NOT NULL,
	[IsRMARequired] [bit] NOT NULL,
	[VariableBoolField01] [bit] NULL,
	[OldReferenceI3D] [int] NULL,
	[OldReferenceKind] [int] NULL,
	[GeoInfoUpdateFailed] [bit] NOT NULL,
	[GeoInfoLatitude] [float] NULL,
	[GeoInfoLongitude] [float] NULL,
	[GeoInfo]  AS (case when [GeoInfoLatitude] IS NOT NULL AND [GeoInfoLongitude] IS NOT NULL then [GEOGRAPHY]::Point([GeoInfoLatitude],[GeoInfoLongitude],(4326)) else CONVERT([geography],NULL) end) PERSISTED,
	[StateI3D] [int] NULL,
	[BookKeepingNumber] [int] NULL,
 CONSTRAINT [PK_AccountAddresses] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountTypes]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountTypes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[Kind] [varchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[IsFavorite] [bit] NULL,
 CONSTRAINT [PK_AccountTypes] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AccountSearchAcc]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_AccountSearchAcc]
AS
SELECT 
       IIF(P.I3D IS NULL, ABS(CHECKSUM(NewId())) % 999999999, P.I3D) AS RowNumber
       ,K.I3D AS AccountI3D
       , IIF(CUS.CustomerNumber IS NOT NULL, 1, IIF(SUP.SupplierNumber IS NOT NULL, 2, NULL)) AS AccountType -- obsolete
       , (SELECT 
             STUFF((SELECT 
                    '; ' + ACT.Name
             FROM dbo.AccountTypeToAccounts ATA
             INNER JOIN dbo.AccountTypes ACT ON ACT.I3D = ATA.AccountTypeI3D
             WHERE ACT.IsActive = 1
             AND ATA.AccountI3D = K.I3D
             FOR XML PATH('')),1,2, '')) AS AccountTypeCaptions
       , K.Number AS AccountNumber
       , CUS.CustomerNumber AS CustomerNumber
       , SUP.SupplierNumber AS SupplierNumber
       , KClassif.I3D AS ClassificationI3D
       , KClassif.Name AS ClassificationCaption
       , KVert.I3D AS SalesControllingI3D
       , KVert.Kurztext AS SalesControllingCaption
       , K.FreeText01
       , K.IsActive
       , K.IsLocked
       , ISNULL(K.Matchcode,'') AS AccountMatchcode
       , K.Name AS AccountName
       , ISNULL(K.Phone,'') AS AccountPhone
       , ISNULL(K.Fax,'') AS AccountFax
       , ISNULL(K.Email,'') AS AccountEMail
       , ISNULL(K.WebSite,'') AS AccountWebsite
       , PA1.I3D AS Adviser1I3D
       , dbo.cfn_CreateEmployeeFullName(PA1.Vorname, PA1.Name, PA1.KurzZeich) AS Adviser1FullName
       , PA1.EMail AS Adviser1EMail
       , PA2.I3D AS Adviser2I3D
       , dbo.cfn_CreateEmployeeFullName(PA2.Vorname, PA2.Name, PA2.KurzZeich) AS Adviser2FullName
       , PA2.EMail AS Adviser2EMail
       , PA3.I3D AS Adviser3I3D
       , dbo.cfn_CreateEmployeeFullName(PA3.Vorname, PA3.Name, PA3.KurzZeich) AS Adviser3FullName
       , PA3.EMail AS Adviser3EMail
       , PA4.I3D AS Adviser4I3D
       , dbo.cfn_CreateEmployeeFullName(PA4.Vorname, PA4.Name, PA4.KurzZeich) AS Adviser4FullName
       , PA4.EMail AS Adviser4EMail
       , PA5.I3D AS Adviser5I3D
       , dbo.cfn_CreateEmployeeFullName(PA5.Vorname, PA5.Name, PA5.KurzZeich) AS Adviser5FullName
       , PA5.EMail AS Adviser5EMail
       , PA6.I3D AS Adviser6I3D
       , dbo.cfn_CreateEmployeeFullName(PA6.Vorname, PA6.Name, PA6.KurzZeich) AS Adviser6FullName
       , PA6.EMail AS Adviser6EMail
	   , A.AddressKind 
       , CONVERT(BIT,0) AS IsAccountKind1 -- obsolete
       , CONVERT(BIT,0) AS IsAccountKind2 -- obsolete
       , CONVERT(BIT,0) AS IsAccountKind3 -- obsolete
       , CONVERT(BIT,0) AS IsAccountKind4 -- obsolete
       , CONVERT(BIT,0) AS IsAccountKind5 -- obsolete
       , NULL AS RootDirectoryI3D -- TODO
       , KO.I3D AS AccountOriginI3D
       , KO.Kurztext AS AccountOriginName
       , A.I3D AS AddressI3D
       , A.OldReferenceI3D AS AddressOldReferenceI3D
       , A.IsDefault AS IsDefaultAddress
       , A.Department AS AddressDepartment
       , A.Street AS AddressStreet
       , A.Zip AS AddressZip
       , A.City AS AddressCity
       , A.IsPostOfficeBoxActive AS IsAddressPostboxActive
       , A.PostOfficeBox AS AddressPostbox
	   , A.PrintName
	   , A.PrintDepartmentAddressContact
	   , A.PrintDepartment
	   , A.PrintAddressContact	   
       , AL.I3D AS AddressCountryI3D
       , AL.Land AS AddressCountryName
       , ISNULL(P.I3D, 0) AS AddressContactI3D
       , ISNULL(P.OldReferenceI3D, 0) AS AddressContactOldReferenceI3D
       , CONVERT(BIT,CASE WHEN P.I3D IS NULL THEN 1 ELSE P.IsDefault END) AS IsDefaultAddressContact
       , PA.I3D AS AddressContactTitleI3D
       , PA.Anrede AS AddressContactTitle
       , PA.Briefanrede AS AddressContactLetterSalutation
       , P.Firstname AS AddressContactFirstname
       , P.Lastname AS AddressContactLastname
       , P.DepartmentText AS AddressContactDepartment
       , P.Email1 AS AddressContactEMail1
	   , P.IsMailingAtEmail1Active AS AddressContactMailing1
       , P.Email2 AS AddressContactEMail2
	   , P.IsMailingAtEmail2Active AS AddressContactMailing2
       , P.Phone1 AS AddressContactPhone1
       , P.Phone2 AS AddressContactPhone2
       , P.Phone3 AS AddressContactPhone3
       , P.Phone4 AS AddressContactPhone4
       , P.Phone5 AS AddressContactPhone5
       , P.Fax1 AS AddressContactFax1
       , P.Fax2 AS AddressContactFax2
       , CONVERT(BIT,CASE WHEN RC.AccountI3D IS NOT NULL THEN 1 ELSE 0 END) AS HasRemoteConnections
       , K.SalesAreaI3D
       , SArea.Kurztext AS SalesAreaCaption
       , A.GeoInfoUpdateFailed AS AddressGeoInfoUpdateFailed
       , A.GeoInfoLatitude AS AddressGeoInfoLatitude
       , A.GeoInfoLongitude AS AddressGeoInfoLongitude
       , K.CompanyGroupI3D
       , ACgroup.Name AS CompanyGroupName
       , AC.BookKeepingNumber 
       , (SELECT TOP 1 C.State FROM dbo.AccountOrderProcessingContracts C WHERE C.CustomerI3D = AC.Number ORDER BY CASE WHEN C.State = 2 THEN 1 WHEN C.State = 1 THEN 2 WHEN C.State = 5 THEN 3 WHEN C.State = 3 THEN 4 WHEN C.State = 4 THEN 5 ELSE 6 END) AS AccountOrderProcessingContractState
       , A.IsActive AS AddressIsActive
       , P.IsActive AS AddressContactIsActive
	   , K.CreatedDate AS CustomerCreatedDate
	   , K.ChangedDate AS CustomerChangedDate
       , (SELECT MAX(val) FROM (VALUES(ISNULL(K.ChangedDate, K.CreatedDate)), (ISNULL(A.ChangedDate, A.CreatedDate)), (ISNULL(P.ChangedDate, P.CreatedDate))) AS VALUE(val)) AS ChangedDate
	   , SUP.OwnCustomerNumber AS OwnCustomerNumberSupplier
	   , SUP.ItScopeSupplierNumber 
	   , SUP.EgisSupplierNumber  
	   , SUP.ConcertoSupplierNumber 
	   , P.DefaultTicket
FROM dbo.Accounts K
LEFT OUTER JOIN dbo.Personal PA1 ON PA1.I3D = K.Adviser1I3D
LEFT OUTER JOIN dbo.Personal PA2 ON PA2.I3D = K.Adviser2I3D
LEFT OUTER JOIN dbo.Personal PA3 ON PA3.I3D = K.Adviser3I3D
LEFT OUTER JOIN dbo.Personal PA4 ON PA4.I3D = K.Adviser4I3D
LEFT OUTER JOIN dbo.Personal PA5 ON PA5.I3D = K.Adviser5I3D
LEFT OUTER JOIN dbo.Personal PA6 ON PA6.I3D = K.Adviser6I3D
LEFT OUTER JOIN dbo.KundenHerkunft KO ON KO.I3D = K.OriginI3D
LEFT OUTER JOIN dbo.AccountAddresses A ON (A.AccountI3D = K.I3D)
LEFT OUTER JOIN dbo.Laenkenn AL ON AL.I3D = A.CountryI3D
LEFT OUTER JOIN dbo.AccountAddressContacts P ON (P.AccountAddressI3D = A.I3D)
LEFT OUTER JOIN dbo.Anrede PA ON PA.I3D = P.SalutationI3D
LEFT OUTER JOIN dbo.Accounts ACgroup ON ACgroup.I3D = K.CompanyGroupI3D
LEFT OUTER JOIN dbo.Vertriebsgebiete SArea ON SArea.I3D = K.SalesAreaI3D
LEFT OUTER JOIN 
(
       SELECT ATA.AccountI3D, COUNT(*) AS RemoteCount 
       FROM dbo.RemoteConnections RC
       INNER JOIN dbo.AccountCustomers AC ON AC.Number = RC.CustomerI3D
       INNER JOIN dbo.AccountTypeToAccounts ATA ON ATA.AccountCustomerI3D = AC.I3D
       GROUP BY ATA.AccountI3D
) RC ON RC.AccountI3D = K.I3D
LEFT OUTER JOIN 
(
       SELECT ATA.AccountI3D, AC.Number AS CustomerNumber, AC.ClassificationI3D, AC.SalesControllingI3D, COUNT(*) AS RemoteCount 
       FROM dbo.AccountCustomers AC
       INNER JOIN dbo.AccountTypeToAccounts ATA ON ATA.AccountCustomerI3D = AC.I3D
       GROUP BY ATA.AccountI3D, AC.Number, AC.ClassificationI3D, AC.SalesControllingI3D
) CUS ON CUS.AccountI3D = K.I3D
LEFT OUTER JOIN
(
       SELECT ATA.AccountI3D, AC.Number AS SupplierNumber, AC.OwnCustomerNumber
			, AC.ItScopeSupplierNumber ,AC.EgisSupplierNumber, AC.ConcertoSupplierNumber  
       FROM dbo.AccountSuppliers AC
       INNER JOIN dbo.AccountTypeToAccounts ATA ON ATA.AccountSupplierI3D = AC.I3D
       GROUP BY ATA.AccountI3D, AC.Number, AC.OwnCustomerNumber, AC.ItScopeSupplierNumber ,AC.EgisSupplierNumber, AC.ConcertoSupplierNumber  
) SUP ON SUP.AccountI3D = K.I3D
LEFT OUTER JOIN dbo.KundenKlassifizierung KClassif ON KClassif.I3D = CUS.ClassificationI3D
LEFT OUTER JOIN dbo.Vertriebssteuerung KVert ON Kvert.I3D = CUS.SalesControllingI3D
LEFT OUTER JOIN dbo.AccountCustomers AC ON AC.Number = CUS.CustomerNumber
          
            
GO
/****** Object:  View [dbo].[cvw_AssetManagementCustomerApplicationOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementCustomerApplicationOverview]
        AS
        SELECT        ISNULL(D.KundenI3D, 0) AS CustomerI3D, ISNULL(A.DisplayName, '') AS ApplicationName, ISNULL(A.Publisher, '') AS Publisher, ISNULL(A.Version, '') AS Version, COUNT(A.I3D) AS InstalledOnDevicesCount
        FROM            dbo.AssetManagementApplication AS A INNER JOIN
                                 dbo.AssetManagementDevices AS D ON D.I3D = A.DeviceI3D
        GROUP BY D.KundenI3D, A.DisplayName, A.Publisher, A.Version
      
GO
/****** Object:  Table [dbo].[AssetManagementNotification]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementNotification](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HelpdeskI3D] [int] NULL,
	[CustomerI3D] [int] NULL,
	[DeviceID] [nvarchar](256) NOT NULL,
	[DeviceName] [nvarchar](256) NULL,
	[DeviceURI] [nvarchar](512) NULL,
	[ProbeURI] [nvarchar](512) NULL,
	[AffectedService] [nvarchar](512) NULL,
	[TaskIdent] [nvarchar](256) NULL,
	[QualitativeOldState] [nvarchar](2000) NULL,
	[QualitativeNewState] [nvarchar](128) NULL,
	[TimeOfNotification] [datetime] NULL,
	[TimeOfStateChange] [datetime] NULL,
	[QuantitativeNewState] [ntext] NULL,
	[QuantitativeOldState] [ntext] NULL,
	[OneWayContactI3D] [int] NULL,
	[ManualCreation] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_DeviceHelpdeskOverviews]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_DeviceHelpdeskOverviews]
        AS
        SELECT        dbo.AssetManagementNotification.I3D, dbo.AssetManagementNotification.CustomerI3D, dbo.AssetManagementNotification.DeviceID, dbo.AssetManagementNotification.DeviceName, 
                                 dbo.AssetManagementNotification.HelpdeskI3D, dbo.hlpdsk_requests.Nummer AS TicketNumber, dbo.AssetManagementNotification.QualitativeOldState AS ShortDescription, 
                                 dbo.hlpdsk_requests.Beschreibung AS Description, dbo.hlpdsk_requests.Problem AS LongDescription, dbo.hlpdsk_requests.Status AS HelpdeskState, dbo.hlpdsk_requests.ErfasstAm AS CreatedDate, 
                                 dbo.hlpdsk_requests.FaelligAm AS DueDate, dbo.hlpdsk_requests.AbgeschlossenAm AS ClosedAt, dbo.AssetManagementNotification.ManualCreation
        FROM            dbo.AssetManagementNotification INNER JOIN
                                 dbo.hlpdsk_requests ON dbo.AssetManagementNotification.HelpdeskI3D = dbo.hlpdsk_requests.I3D
      
GO
/****** Object:  Table [dbo].[AssetManagementLogicalDevice]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLogicalDevice](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[VolumeName] [nvarchar](256) NULL,
	[MaxCapacity] [nvarchar](24) NULL,
	[FreeCapacity] [nvarchar](24) NULL,
	[IsEncrypted] [bit] NULL,
	[PersistentVolumeID] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[Status] [nvarchar](256) NULL,
	[SerialNumber] [int] NULL,
	[Name] [nvarchar](256) NULL,
	[FileSystem] [nvarchar](256) NULL,
	[DeviceID] [nvarchar](256) NULL,
	[Automount] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementMemory]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementMemory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Location] [nvarchar](256) NULL,
	[PartNumber] [nvarchar](256) NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[Type] [nvarchar](256) NULL,
	[Manufacturer] [nvarchar](256) NULL,
	[Speed] [nvarchar](256) NULL,
	[Capacity] [nvarchar](256) NULL,
	[Caption] [nvarchar](256) NULL,
	[CreationClassName] [nvarchar](256) NULL,
	[DataWidth] [int] NULL,
	[Description] [nvarchar](256) NULL,
	[DeviceLocator] [nvarchar](256) NULL,
	[FormFactor] [int] NULL,
	[HotSwappable] [bit] NULL,
	[InstallDate] [datetime] NULL,
	[InterleaveDataDepth] [int] NULL,
	[InterleavePosition] [int] NULL,
	[MemoryType] [int] NULL,
	[Model] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[OtherIdentifyingInfo] [nvarchar](256) NULL,
	[PositionInRow] [int] NULL,
	[PoweredOn] [bit] NULL,
	[Removable] [bit] NULL,
	[Replaceable] [bit] NULL,
	[SKU] [nvarchar](256) NULL,
	[Status] [nvarchar](256) NULL,
	[Tag] [nvarchar](256) NULL,
	[TotalWidth] [int] NULL,
	[TypeDetail] [int] NULL,
	[Version] [nvarchar](256) NULL,
	[MemoryArrayI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementOS]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementOS](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[ReportedOS] [nvarchar](256) NULL,
	[Version] [nvarchar](256) NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[OSArchitecture] [nvarchar](256) NULL,
	[LicenseKey] [nvarchar](256) NULL,
	[LicenseType] [nvarchar](256) NULL,
	[CsdVersion] [nvarchar](256) NULL,
	[SupportedOS] [nvarchar](256) NULL,
	[LastBootupTime] [datetime] NULL,
	[InstallDate] [datetime] NULL,
	[Publisher] [nvarchar](256) NULL,
	[SystemDrive] [nvarchar](256) NULL,
	[ServicePackMinorVersion] [int] NULL,
	[ServicePackMajorVersion] [int] NULL,
	[RegisteredUser] [nvarchar](256) NULL,
	[ProductType] [int] NULL,
	[OSType] [int] NULL,
	[OSProductSuite] [int] NULL,
	[OSLanguage] [int] NULL,
	[FreePhysicalMemory] [bigint] NULL,
	[Description] [nvarchar](256) NULL,
	[CurrentTimeZone] [nvarchar](256) NULL,
	[CountryCode] [nvarchar](256) NULL,
	[BootDevice] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementDevicesOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementDevicesOverview]
        AS
        SELECT        dev.I3D, dev.KundenI3D AS CustomerI3D, K.Name AS CustomerName, dev.ShortName, dev.LastUpdate, dev.DeviceClass, 
                                 SUM(CAST(mem.Capacity AS float) / 1024 / 1024 / 1024) AS Ram, os.ReportedOS AS OS, os.LicenseKey, os.LicenseType, ld.MemoryFreeComplete, ld.MemoryComplete, dev.IsSystemCralwerInstalled, 
                                 dev.SystemCrawlerStatus, dev.IsOnline, dev.IsSystemCrawlerRestart, dev.SystemCrawlerRestartLog
        FROM            dbo.AssetManagementDevices AS dev INNER JOIN
                                 dbo.Kunden AS K ON K.I3D = dev.KundenI3D LEFT OUTER JOIN
                                 dbo.AssetManagementMemory AS mem ON mem.DeviceI3D = dev.I3D LEFT OUTER JOIN
                                 dbo.AssetManagementOS AS os ON os.DeviceI3D = dev.I3D LEFT OUTER JOIN
                                     (SELECT        DeviceI3D, ROUND(SUM(CAST(FreeCapacity AS float)) / 1024 / 1024 / 1024, 2) AS MemoryFreeComplete, ROUND(SUM(CAST(MaxCapacity AS float)) / 1024 / 1024 / 1024, 2) 
                                                                 AS MemoryComplete
                                       FROM            dbo.AssetManagementLogicalDevice AS hard
                                       GROUP BY DeviceI3D) AS ld ON ld.DeviceI3D = dev.I3D
        GROUP BY dev.I3D, dev.KundenI3D, K.Name, dev.ShortName, dev.LastUpdate, dev.DeviceClass, os.ReportedOS, os.LicenseKey, os.LicenseType, 
                                 ld.MemoryComplete, ld.MemoryFreeComplete, dev.IsSystemCralwerInstalled, dev.SystemCrawlerStatus, dev.IsOnline, dev.IsSystemCrawlerRestart, dev.SystemCrawlerRestartLog
      
GO
/****** Object:  Table [dbo].[AssetManagementCheckSnmpResults]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCheckSnmpResults](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CheckResultID] [int] NOT NULL,
	[CheckConfigurationID] [int] NOT NULL,
	[State] [nvarchar](50) NOT NULL,
	[Resolved] [nvarchar](50) NULL,
	[Message] [nvarchar](2000) NULL,
	[Date] [datetime] NULL,
	[ActualResultValue] [nvarchar](256) NULL,
	[OriginalValue] [nvarchar](256) NULL,
	[SnmpOidI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementCheckSnmpResults] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_AssetManagementCheckSnmpResultOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_AssetManagementCheckSnmpResultOverview]
        AS
        SELECT        dbo.AssetManagementCheckSnmpResults.I3D, dbo.AssetManagementCheckSnmpResults.CheckResultID, dbo.AssetManagementCheckSnmpResults.CheckConfigurationID, 
                                 dbo.AssetManagementCheckSnmpResults.State, dbo.AssetManagementCheckSnmpResults.Resolved, dbo.AssetManagementCheckSnmpResults.Message, dbo.AssetManagementCheckSnmpResults.Date, 
                                 dbo.AssetManagementCheckSnmpResults.ActualResultValue, dbo.AssetManagementCheckSnmpResults.OriginalValue, dbo.AssetManagementCheckSnmpResults.SnmpOidI3D, 
                                 dbo.AssetManagementSnmpMibDetails.ProviderName, dbo.AssetManagementSnmpMibDetails.ProviderCode, dbo.AssetManagementSnmpMibDetails.ServiceName
        FROM            dbo.AssetManagementCheckSnmpResults INNER JOIN
                                 dbo.AssetManagementSnmpMibOidDetails ON dbo.AssetManagementCheckSnmpResults.SnmpOidI3D = dbo.AssetManagementSnmpMibOidDetails.I3D INNER JOIN
                                 dbo.AssetManagementSnmpMibDetails ON dbo.AssetManagementSnmpMibOidDetails.SnmpMibI3D = dbo.AssetManagementSnmpMibDetails.I3D
      
GO
/****** Object:  Table [dbo].[hlpdsk_timer]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_timer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RequestI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Start] [datetime] NULL,
	[Stop] [datetime] NULL,
	[Timer] [int] NULL,
	[Bemerkung] [varchar](2000) NULL,
	[Berechenbar] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[RechPosI3D] [int] NULL,
	[hlpdsk_timer_typenI3D] [int] NULL,
	[LiefPosI3D] [int] NULL,
	[InterneNotiz] [varchar](2000) NULL,
	[Status] [int] NULL,
	[Bewertung] [int] NULL,
	[PausedTime] [int] NULL,
	[AufPosI3D] [int] NULL,
	[Gedruckt] [int] NULL,
	[Geplant] [int] NULL,
	[LunchTime] [int] NULL,
	[SortOrder1] [int] NULL,
	[SortOrder2] [int] NULL,
	[DeviceI3D] [int] NULL,
	[ContractI3D] [int] NULL,
	[ReferenceOrderItemI3D] [int] NULL,
	[BillingStateI3D] [int] NULL,
	[DocumentI3D] [int] NULL,
	[SentAt] [datetime] NULL,
	[IsSigned] [bit] NULL,
	[ExportDate] [datetime] NULL,
	[ParentI3D] [int] NULL,
	[PlannedDurationInMinutes] [int] NULL,
	[ProgressInPercent] [int] NULL,
	[ArticleWorkItemI3D] [int] NULL,
	[CreatedDate] [datetime2](0) NULL,
	[CreatedVersion] [varchar](20) NULL,
	[CalendarEntryID] [varchar](500) NULL,
	[CalendarEntryState] [bit] NOT NULL,
	[AiTextRatingJson] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sichbenu]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sichbenu](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](60) NULL,
	[Personal] [int] NULL,
	[Kennwort] [varchar](60) NULL,
	[KennLaenMin] [int] NULL,
	[KennAendNachTagen] [int] NULL,
	[LetzKennAend] [datetime] NULL,
	[KontoDeakMan] [int] NULL,
	[KontoDeakVon] [datetime] NULL,
	[KontoDeakBis] [datetime] NULL,
	[Kommentar] [varchar](255) NULL,
	[MandantID] [int] NULL,
	[Status] [int] NULL,
	[LockedIn] [int] NULL,
	[LoginMachine] [varchar](50) NULL,
	[LoginUsername] [varchar](50) NULL,
	[LoginIP] [varchar](50) NULL,
	[LoginTime] [datetime] NULL,
	[Vertreter] [int] NULL,
	[LastWebLogin] [datetime] NULL,
	[Eintritt] [datetime] NULL,
	[Austritt] [datetime] NULL,
	[Probezeit] [int] NULL,
	[Vertragslaufzeit] [float] NULL,
	[Unterschrift] [image] NULL,
	[VertragsArt] [varchar](255) NULL,
	[PersonalGruppenI3D] [int] NULL,
	[MAKosten] [float] NULL,
	[BenutzerInfo] [varchar](255) NULL,
	[BenutzerInfo2] [varchar](100) NULL,
	[AnmeldungFehlgeschlagen] [int] NULL,
	[CentronNetDefaultProfile] [nvarchar](400) NULL,
	[TwoFactorAuthKey] [nvarchar](200) NULL,
	[UseTwoFactorAuthentication] [bit] NOT NULL,
	[TwoFactorValidDurationInDays] [int] NULL,
	[LastTwoFactorValidatedAt] [datetime2](7) NULL,
	[AuthentificationKind] [int] NOT NULL,
	[OicdSubjectIdentifier] [varchar](255) NULL,
	[OpenIdConnectSubjectIdentifier] [varchar](255) NULL,
 CONSTRAINT [PK_Sichbenu] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Mitarbeiterartikel]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mitarbeiterartikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MitarbeiterI3D] [int] NULL,
	[ArtikelCode] [varchar](60) NULL,
	[ArtikelI3D] [int] NULL,
	[StandardArtikel] [int] NULL,
	[SpecialArticleKind] [int] NULL,
	[InternalCompanyEK] [decimal](38, 2) NULL,
 CONSTRAINT [PK_Mitarbeiterartikel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_EmployeeHelpdeskTimerStatistic]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_EmployeeHelpdeskTimerStatistic]
AS
SELECT ROW_NUMBER() OVER (
		ORDER BY PER.I3D
		) AS RowNumber
	,PER.I3D AS EmployeeI3D
	,PER.Name AS Lastname
	,PER.Vorname AS Firstname
	,PER.EMail
	,CAST(TMR.Start AS Date) AS Date
	,DATEPART(year, TMR.Start) AS Year
	,DATEPART(month, TMR.Start) AS Month
	,DATEPART(day, TMR.Start) AS Day
	,ISNULL(TMR.Berechenbar, 0) AS IsCalculable
	,CAST(ISNULL(TMR.Geplant,0) AS BIT) AS IsPlanned
	,CASE 
		WHEN ISNULL(TMR.RechPosI3D, 0) > 0
			THEN 1
		ELSE 0
		END AS IsCalculated
	,SUM(ISNULL(TMR.Timer, 0) - ISNULL(TMR.PausedTime, 0) - ISNULL(TMR.LunchTime, 0)) AS RecordedTimeInSeconds
	,ISNULL(TMR.Status, 1) AS IsTimeActive
	,CASE 
		WHEN PER.Status = 1
			AND (
				PER.Austritt IS NULL
				OR PER.Austritt < CAST('1900-01-01' AS DATETIME)
				OR PER.Austritt > CURRENT_TIMESTAMP
				)
			THEN 1
		ELSE 0
		END AS IsEmployeeActive
	,SUM(CONVERT(DECIMAL(18, 2), ROUND((
					ISNULL(A.VK_1, 0) / ISNULL(CASE 
							WHEN AE.FaktorZuSekunde = 0
								THEN NULL
							ELSE AE.FaktorZuSekunde
							END, 3600) * 3600.0
					) * ROUND(IsNull(TMR.Timer, 0) / 3600.0, 2), 2))) AS Price
FROM dbo.hlpdsk_timer TMR
LEFT OUTER JOIN dbo.SichBenu SB ON SB.Personal = TMR.PersonalI3D
LEFT OUTER JOIN dbo.Mitarbeiterartikel MA ON MA.MitarbeiterI3D = SB.I3D AND MA.StandardArtikel = 1
LEFT OUTER JOIN dbo.ARTIK A ON A.I3D = IIF(ISNULL(TMR.ArtikelI3D,0) <= 0,MA.ArtikelI3D,TMR.ArtikelI3D)
LEFT OUTER JOIN dbo.ArtikelEinheit AE ON AE.I3D = A.Einheit
LEFT OUTER JOIN dbo.Mitarbeiterartikel MAP ON MAP.ArtikelI3D = TMR.ArtikelI3D
LEFT OUTER JOIN dbo.Sichbenu MAPS ON MAPS.I3D = MAP.MitarbeiterI3D
INNER JOIN dbo.Personal PER ON PER.I3D = ISNULL(MAPS.Personal, TMR.PersonalI3D)
GROUP BY PER.I3D
	,PER.Name
	,PER.Vorname
	,PER.EMail
	,CAST(TMR.Start AS Date)
	,DATEPART(year, TMR.Start)
	,DATEPART(month, TMR.Start)
	,DATEPART(day, TMR.Start)
	,TMR.Berechenbar
	,TMR.Geplant
	,CASE 
		WHEN ISNULL(TMR.RechPosI3D, 0) > 0
			THEN 1
		ELSE 0
		END
	,PER.Status
	,PER.Austritt
	,TMR.Status
GO
/****** Object:  Table [dbo].[NotifyHelpdeskHistory]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NotifyHelpdeskHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HelpdeskHistoryI3D] [int] NOT NULL,
	[HasRead] [bit] NULL,
	[HasReadDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NotifyContactRequest]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NotifyContactRequest](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HelpdeskI3D] [int] NOT NULL,
	[DeviceID] [nvarchar](256) NOT NULL,
	[Message] [nvarchar](4000) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[Status] [int] NULL,
	[PersonalizationNumber] [nvarchar](128) NULL,
	[DeviceGuid] [uniqueidentifier] NULL,
 CONSTRAINT [PK_NotifyContactRequest] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_history]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_history](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RequestI3D] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Aktion] [varchar](150) NULL,
	[BearbeiterI3D] [int] NULL,
	[Empfaenger] [varchar](500) NULL,
	[Loesung] [text] NULL,
	[Bezeichnung] [varchar](1000) NULL,
	[Beschreibung] [text] NULL,
	[HauptkategorieI3D] [int] NULL,
	[Unterkategorie1I3D] [int] NULL,
	[Unterkategorie2I3D] [int] NULL,
	[giltAlle] [int] NULL,
	[KopiePerEMail] [int] NULL,
	[KopiePerSMS] [int] NULL,
	[KopieAnKunde] [int] NULL,
	[Nummer] [varchar](50) NULL,
	[LoesungRichtext] [text] NULL,
	[BeschreibungRichtext] [text] NULL,
	[Richtext] [text] NULL,
	[Status] [int] NULL,
	[ActionType] [nvarchar](200) NULL,
	[Level] [nvarchar](200) NULL,
	[ObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[Sender] [nvarchar](200) NULL,
	[AddedEmployeeI3DsCsv] [nvarchar](255) NULL,
	[RemovedEmployeeI3DsCsv] [nvarchar](255) NULL,
 CONSTRAINT [PK_hlpdsk_history] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_NotifyHelpdeskHistoryOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_NotifyHelpdeskHistoryOverview]
AS
SELECT        HN.I3D AS NotifyRequestI3D, HH.Aktion AS HistoryAction, HH.Bezeichnung AS HistoryCaption, HH.Beschreibung AS HistoryDescription, HH.Datum AS HistoryDate, 
                         HNH.I3D AS NotifyHelpdeskHistoryI3D, HNH.HasRead, HNH.HasReadDate
FROM            dbo.NotifyContactRequest AS HN INNER JOIN
                         dbo.hlpdsk_history AS HH ON HN.HelpdeskI3D = HH.RequestI3D INNER JOIN
                         dbo.NotifyHelpdeskHistory AS HNH ON HH.I3D = HNH.HelpdeskHistoryI3D
GO
/****** Object:  Table [dbo].[Terminplanung]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Terminplanung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[AufKopfI3D] [int] NULL,
	[Text] [nvarchar](max) NULL,
	[Von] [datetime] NULL,
	[Bis] [datetime] NULL,
	[Status] [int] NULL,
	[TerminplanungArtI3D] [int] NULL,
	[TaetigkeitenI3D] [int] NULL,
	[ErstelltDurch] [int] NULL,
	[AuszufuehrendeArbeiten] [varchar](max) NULL,
	[Freigegeben] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
	[KontaktArt] [int] NULL,
	[GanzerTag] [int] NULL,
	[TerminplanungStatusI3D] [int] NULL,
	[TerminplanungArtWebsuiteI3D] [int] NULL,
	[ObjektI3D] [int] NULL,
	[ObjektArt] [int] NULL,
	[AppointmentSubject] [nvarchar](max) NULL,
	[Location] [nvarchar](512) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungArt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](254) NULL,
	[Ausschluss] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungPerson]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungPerson](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TerminplanungI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
	[MailEntryID] [varchar](500) NULL,
	[BelegtStatus] [int] NULL,
	[Kategorie] [varchar](250) NULL,
	[MailSystem] [int] NULL,
	[LastModifiedDateTime] [datetime2](0) NULL,
	[SeriesMasterId] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_ScheduleOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_ScheduleOverview]
AS
SELECT 
	ROW_NUMBER() OVER (ORDER BY D.ScheduleI3D) AS RowNumber
	,D.[ScheduleI3D]
    ,D.[ObjectI3D]
    ,D.[ObjectKind]
    ,D.[Text]
    ,D.[Approved]
    ,D.[AppointmentStart]
    ,D.[AppointmentEnd]
    ,D.[EmployeeI3D]
    ,D.[Status]
    ,D.[IsCompleteDay]
    ,D.[CreatedThrough]
    ,D.[ScheduleSpecialKindCaption]
    ,D.[IsHoliday]
    ,D.[IsIllness]
    ,D.[IsOvertime]
    ,D.[IsShortWorkTime]
    ,D.[IsPlanned]
    ,D.[IsOrder]
    ,D.[IsCalculated]
    ,D.[IsOffer]
    ,D.[IsCRM]
    ,D.[ObjectStatus]
FROM (
SELECT        TP.I3D AS ScheduleI3D, TP.ObjektI3D AS ObjectI3D, TP.ObjektArt AS ObjectKind, CASE WHEN AK.I3D IS NULL THEN CASE WHEN HR.I3D IS NULL 
                         THEN TP.Text ELSE 'Ticket: ' + CONVERT(VARCHAR, HR.Nummer) + ' - ' + HR.Beschreibung END ELSE 'Serviceauftrag: ' + CONVERT(VARCHAR, 
                         AK.Nummer) END AS Text, TP.Freigegeben AS Approved, /*TP.Text AS Text, */ TP.Von AS AppointmentStart, TP.Bis AS AppointmentEnd, 
                         TPPers.PersonalI3D AS EmployeeI3D, CAST(TP.[Status] AS BIT) AS Status, Cast(ISNULL(TP.GanzerTag, 0) AS BIT) AS IsCompleteDay, 
                         Cast(TP.ErstelltDurch AS INT) AS CreatedThrough, TPArt.Bezeichnung AS ScheduleSpecialKindCaption, 
                         CAST((CASE WHEN SUrlaub.Wert = TP.TerminplanungArtI3D THEN 1 ELSE 0 END) AS BIT) AS IsHoliday, 
                         CAST((CASE WHEN SKrank.Wert = TP.TerminplanungArtI3D THEN 1 ELSE 0 END) AS BIT) AS IsIllness, 
                         CAST((CASE WHEN SUeberStd.Wert = TP.TerminplanungArtI3D THEN 1 ELSE 0 END) AS BIT) AS IsOvertime, 
                         CAST((CASE WHEN SKurzArb.Wert = TP.TerminplanungArtI3D THEN 1 ELSE 0 END) AS BIT) AS IsShortWorkTime, CAST(ISNULL(HT.Geplant, 0) AS BIT) 
                         AS IsPlanned, CAST(CASE WHEN AK.I3D IS NULL THEN 0 ELSE 1 END AS BIT) AS IsOrder, CAST((CASE WHEN HT.LiefPosI3D IS NULL AND HT.RechPosI3D IS NULL 
                         THEN 0 ELSE 1 END) AS BIT) AS IsCalculated, IsOffer = CAST(0 AS BIT), IsCRM = CAST(0 AS BIT), ISNULL(HR.Status, AK.Status) AS ObjectStatus
FROM dbo.Terminplanung AS TP WITH (NOLOCK)
INNER JOIN dbo.TerminplanungPerson AS TPPers ON TP.I3D = TPPers.TerminplanungI3D
LEFT OUTER JOIN dbo.TerminplanungArt AS TPArt ON TP.TerminplanungArtI3D = TPArt.I3D 
INNER JOIN dbo.Stammdat AS SUrlaub ON SUrlaub.I3D = 810 
INNER JOIN dbo.Stammdat AS SKrank ON SKrank.I3D = 1228 
INNER JOIN dbo.Stammdat AS SUeberStd ON SUeberStd.I3D = 1263 
INNER JOIN dbo.Stammdat AS SKurzArb ON SKurzArb.I3D = 1265 
LEFT OUTER JOIN dbo.hlpdsk_timer HT ON HT.I3D = TP.ObjektI3D AND TP.ObjektArt = 4000056 
LEFT OUTER JOIN dbo.hlpdsk_requests HR ON HR.I3D = HT.RequestI3D 
LEFT OUTER JOIN dbo.AufKopf AK ON AK.I3D = TP.AufKopfI3D
UNION ALL
SELECT        ScheduleI3D = 0, I3D AS ObjectI3D, ObjectKind = 1, Text = 'Angebot ' + CONVERT(VARCHAR, Nummer), Approved = NULL, WVorlage AS AppointmentStart, 
                         DATEADD(minute, 30, WVorlage) AS AppointmentEnd, BearbeiterI3D AS EmployeeI3D, [Status] = CAST(0 AS BIT), IsCompleteDay = CAST(0 AS BIT), 
                         CreatedThrough = CAST(0 AS INT), ScheduleSpecialKindCaption = 'Wiedervorlage', IsHoliday = CAST(0 AS BIT), IsIllness = CAST(0 AS BIT), 
                         IsOvertime = CAST(0 AS BIT), IsShortWorkTime = CAST(0 AS BIT), IsPlanned = CAST(0 AS BIT), IsOrder = CAST(0 AS BIT), IsCalculated = CAST(0 AS BIT), 
                         IsOffer = CAST(1 AS BIT), IsCRM = CAST(0 AS BIT), AngKopf.Status AS ObjectStatus
FROM dbo.AngKopf WITH (NOLOCK)
WHERE WVorlage IS NOT NULL AND WVorlage > 2
UNION ALL
SELECT        ScheduleI3D = 0, ObjectI3D = Te.I3D, ObjectKind = 6000002, Text, Approved = NULL, Te.Faelligkeitsdatum AS AppointmentStart, 
                         CASE WHEN (Te.TaetigkeitsTyp = 1) THEN Te.EndDatum ELSE Te.Faelligkeitsdatum END AS AppointmentEnd, Te.EmpfaengerI3D AS EmployeeI3D, 
                         [Status] = CAST(0 AS BIT), IsCompleteDay = CAST(0 AS BIT), CreatedThrough = CAST(0 AS INT), 
                         CASE Te.TaetigkeitsTYP WHEN 0 THEN 'Telefonnotiz' WHEN 1 THEN 'Termin' WHEN 2 THEN 'Besuchsbericht' WHEN 3 THEN 'Notiz' WHEN 7 THEN 'E-Mail' WHEN
                          8 THEN 'Mailing' END AS ScheduleSpecialKindCaption, IsHoliday = CAST(0 AS BIT), IsIllness = CAST(0 AS BIT), IsOvertime = CAST(0 AS BIT), 
                         IsShortWorkTime = CAST(0 AS BIT), IsPlanned = CAST(0 AS BIT), OrderStatus = CAST(0 AS BIT), IsCalculated = CAST(0 AS BIT), IsOffer = CAST(0 AS BIT), 
                         IsCRM = CAST(1 AS BIT), Te.Status AS ObjectStatus
FROM dbo.Taetigkeiten Te WITH (NOLOCK)
WHERE Te.TaetigkeitsTYP IN (0, 1, 2)) AS D
GO
/****** Object:  Table [dbo].[PersonalGruppen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Kommentar] [varchar](255) NULL,
	[Status] [int] NULL,
	[RepGroup] [varchar](3) NULL,
	[PersonalI3D] [int] NULL,
	[MaAbteilungI3D] [int] NULL,
	[ID3] [int] NULL,
	[Abteilung] [varchar](255) NULL,
	[Kemmentar] [varchar](255) NULL,
	[AbteilungI3D] [int] NULL,
	[IsTeamLeader] [bit] NULL,
 CONSTRAINT [PK_PersonalGruppen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TelemarketingParticipants]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TelemarketingParticipants](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TelemarketingI3D] [int] NOT NULL,
	[ParticipantI3D] [int] NULL,
	[ParticipantKind] [nvarchar](32) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_TelemarketingParticipantEmployees]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_TelemarketingParticipantEmployees]
AS
SELECT        S.I3D AS TelemarketingI3D, P.I3D AS EmployeeI3D, P.Vorname AS Firstname, P.Name AS Lastname, P.KurzZeich AS ShortSign
FROM            Sonderaktionen S INNER JOIN
                         TelemarketingParticipants TP ON TP.TelemarketingI3D = S.I3D AND TP.ParticipantKind = 'Employee' INNER JOIN
                         Personal P ON P.I3D = TP.ParticipantI3D
UNION
SELECT        S.I3D AS TelemarketingI3D, P.I3D AS EmployeeI3D, P.Vorname AS Firstname, P.Name AS Lastname, P.KurzZeich AS ShortSign
FROM            Sonderaktionen S INNER JOIN
                         TelemarketingParticipants TP ON TP.TelemarketingI3D = S.I3D AND TP.ParticipantKind = 'Department' INNER JOIN
                         PersonalGruppen PG ON PG.MaAbteilungI3D = TP.ParticipantI3D INNER JOIN
                         Personal P ON P.I3D = PG.PersonalI3D
UNION
SELECT        S.I3D AS TelemarketingI3D, P.I3D AS EmployeeI3D, P.Vorname AS Firstname, P.Name AS Lastname, P.KurzZeich AS ShortSign
FROM            Sonderaktionen S INNER JOIN
                         TelemarketingParticipants TP ON TP.TelemarketingI3D = S.I3D AND TP.ParticipantKind = 'Adviser1' INNER JOIN
                         SonderaktionenReferenzen SR ON SR.SonderaktionenI3D = S.I3D AND SR.ReferenzArt = 1 INNER JOIN
                         Kunden K ON K.I3D = SR.ReferenzI3D INNER JOIN
                         Personal P ON P.I3D = K.InnendienstID
UNION
SELECT        S.I3D AS TelemarketingI3D, P.I3D AS EmployeeI3D, P.Vorname AS Firstname, P.Name AS Lastname, P.KurzZeich AS ShortSign
FROM            Sonderaktionen S INNER JOIN
                         TelemarketingParticipants TP ON TP.TelemarketingI3D = S.I3D AND TP.ParticipantKind = 'Adviser2' INNER JOIN
                         SonderaktionenReferenzen SR ON SR.SonderaktionenI3D = S.I3D AND SR.ReferenzArt = 1 INNER JOIN
                         Kunden K ON K.I3D = SR.ReferenzI3D INNER JOIN
                         Personal P ON P.I3D = K.AussendienstID
UNION
SELECT        S.I3D AS TelemarketingI3D, P.I3D AS EmployeeI3D, P.Vorname AS Firstname, P.Name AS Lastname, P.KurzZeich AS ShortSign
FROM            Sonderaktionen S INNER JOIN
                         TelemarketingParticipants TP ON TP.TelemarketingI3D = S.I3D AND TP.ParticipantKind = 'Adviser3' INNER JOIN
                         SonderaktionenReferenzen SR ON SR.SonderaktionenI3D = S.I3D AND SR.ReferenzArt = 1 INNER JOIN
                         Kunden K ON K.I3D = SR.ReferenzI3D INNER JOIN
                         Personal P ON P.I3D = K.TechnikerID
UNION
SELECT        S.I3D AS TelemarketingI3D, P.I3D AS EmployeeI3D, P.Vorname AS Firstname, P.Name AS Lastname, P.KurzZeich AS ShortSign
FROM            Sonderaktionen S INNER JOIN
                         TelemarketingParticipants TP ON TP.TelemarketingI3D = S.I3D AND TP.ParticipantKind = 'Adviser4' INNER JOIN
                         SonderaktionenReferenzen SR ON SR.SonderaktionenI3D = S.I3D AND SR.ReferenzArt = 1 INNER JOIN
                         Kunden K ON K.I3D = SR.ReferenzI3D INNER JOIN
                         Personal P ON P.I3D = K.Techniker2ID
UNION
SELECT        S.I3D AS TelemarketingI3D, P.I3D AS EmployeeI3D, P.Vorname AS Firstname, P.Name AS Lastname, P.KurzZeich AS ShortSign
FROM            Sonderaktionen S INNER JOIN
                         TelemarketingParticipants TP ON TP.TelemarketingI3D = S.I3D AND TP.ParticipantKind = 'Adviser5' INNER JOIN
                         SonderaktionenReferenzen SR ON SR.SonderaktionenI3D = S.I3D AND SR.ReferenzArt = 1 INNER JOIN
                         Kunden K ON K.I3D = SR.ReferenzI3D INNER JOIN
                         Personal P ON P.I3D = K.Betreuer5I3D
UNION
SELECT        S.I3D AS TelemarketingI3D, P.I3D AS EmployeeI3D, P.Vorname AS Firstname, P.Name AS Lastname, P.KurzZeich AS ShortSign
FROM            Sonderaktionen S INNER JOIN
                         TelemarketingParticipants TP ON TP.TelemarketingI3D = S.I3D AND TP.ParticipantKind = 'Adviser6' INNER JOIN
                         SonderaktionenReferenzen SR ON SR.SonderaktionenI3D = S.I3D AND SR.ReferenzArt = 1 INNER JOIN
                         Kunden K ON K.I3D = SR.ReferenzI3D INNER JOIN
                         Personal P ON P.I3D = K.Betreuer6I3D
      
GO
/****** Object:  Table [dbo].[hlpdsk_request_bearbeiter]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_request_bearbeiter](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RequestI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[PersonalTyp] [int] NULL,
	[ToDoI3D] [int] NULL,
	[Status] [int] NULL,
	[TDi3D] [int] NULL,
	[IsAccepted] [bit] NULL,
 CONSTRAINT [PK_hlpdsk_request_bearbeiter] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [RequestProPerson] UNIQUE NONCLUSTERED 
(
	[RequestI3D] ASC,
	[PersonalI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_ViewHelpdeskToEditors]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_ViewHelpdeskToEditors]

AS

select
re.I3D, re.Nummer as Number, re.Beschreibung as ShortDescription, re.Problem as Description,
re.Freitext1 as FreeText1,
re.KundeName as CustomerName,
case when Unterkategorie2I3D = -1
then NULL else Unterkategorie2I3D
END As SubCategory2,

case when Unterkategorie1I3D = -1
then NULL else Unterkategorie1I3D
END as SubCategory1,

case when Prioritaet = -1
then NULL else Prioritaet
END as Priority,

case when HauptkategorieI3D = -1
then NULL else HauptkategorieI3D
END as MainCategory,

re.Status as HelpdeskStatusI3D, AnsprechName as ContactName, KundeI3D as CustomerI3D, re.AnsprechpartnerI3D as ContactI3D, re.VerantwortlicherI3D as ResponsiblePersonI3D, re.ErstellerI3D as CreatorI3D, editor.PersonalI3D as EditorI3D, re.ErfasstAm as CreatedDate, re.FaelligAm as DueDate,
re.AnschriftI3D as AddressI3D
from hlpdsk_requests  re
inner join hlpdsk_request_bearbeiter editor on re.I3D = editor.RequestI3D
GO
/****** Object:  View [dbo].[cvw_DeployablePackageOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[cvw_DeployablePackageOverview]
        AS
        SELECT        dbo.MonitoringServiceSettings.I3D, dbo.MonitoringServiceSettings.CustomerI3D, dbo.Kunden.Name AS CustomerName, dbo.MonitoringServiceSettings.Username, dbo.MonitoringServiceSettings.Password, 
                                 dbo.MonitoringServiceSettings.CentronServiceWCFUrl, dbo.MonitoringServiceSettings.ServiceConnectorWCFUrl, dbo.MonitoringServiceSettings.SystemCrawlerServiceInterval, 
                                 dbo.MonitoringServiceSettings.IsActive, dbo.MonitoringServiceSettings.CreatedDate, dbo.MonitoringServiceSettings.ModifiedDate, dbo.MonitoringServiceSettings.ServiceConnectorServiceInventoryInterval, 
                                 dbo.MonitoringServiceSettings.ServiceConnectorSystemCrawlerInstallerInterval, dbo.MonitoringServiceSettings.ServiceConnectorSystemCrawlerStatusInterval, 
                                 dbo.MonitoringServiceSettings.MonitoringWebsiteUrl, dbo.MonitoringServiceSettings.SystemCrawlerUpdateStatusInterval, dbo.MonitoringServiceSettings.ServiceConnectorUpdaterVersionCheckInterval, 
                                 dbo.MonitoringServiceSettings.ServiceConnectorUpdaterInstallerInterval, dbo.MonitoringServiceSettings.ServiceConnectorDeviceName, dbo.MonitoringServiceSettings.ServiceConnectorVersion, 
                                 dbo.MonitoringServiceSettings.ServiceConnectorSystemCrawlerUninstallInterval, dbo.MonitoringServiceSettings.IsServiceConnectorRunning, dbo.MonitoringServiceSettings.ServiceConnectorRunningLastActive, 
                                 dbo.MonitoringServiceSettings.ServiceType, dbo.MonitoringServiceSettings.AdminType, dbo.MonitoringServiceSettings.AdminUsername, dbo.MonitoringServiceSettings.AdminPassword, 
                                 dbo.MonitoringServiceSettings.IsDownloadLogs
        FROM            dbo.MonitoringServiceSettings INNER JOIN
                                 dbo.Kunden ON dbo.MonitoringServiceSettings.CustomerI3D = dbo.Kunden.I3D
      
GO
/****** Object:  Table [dbo].[ZahlungseingangLog]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ZahlungseingangLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ZahlungseingangLogNr] [int] NULL,
	[RechKopfI3D] [int] NULL,
	[BetragRechnung] [float] NULL,
	[BetragGutschrift] [float] NULL,
	[BetragOffen] [float] NULL,
	[Bank] [varchar](60) NULL,
	[BLZ] [varchar](20) NULL,
	[KtoNr] [varchar](20) NULL,
	[Status] [int] NULL,
	[DTinErstellt] [int] NULL,
	[DTinDatum] [datetime] NULL,
	[DTinBearbeiter] [int] NULL,
	[RechAbgeschlossenDurchDTA] [int] NULL,
	[DTinZurueckDatum] [datetime] NULL,
	[DTinZurueckBearbeiter] [int] NULL,
	[PayerIban] [nvarchar](64) NULL,
	[PayerAuthorizationNumber] [nvarchar](64) NULL,
	[RemitteeIdentificationNumber] [nvarchar](64) NULL,
	[RemitteeIban] [nvarchar](64) NULL,
	[PaymentRecipientIdentificationNumber] [nvarchar](64) NULL,
	[PaymentRecipientIban] [nvarchar](64) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_IncomingPaymentLogOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_IncomingPaymentLogOverview]
AS
SELECT        ZL.I3D, ZL.ZahlungseingangLogNr AS LogNumber, ZL.RechKopfI3D AS InvoiceI3D, RK.Nummer AS InvoiceNumber, K.I3D AS CustomerNumber, K.Name AS CustomerName, CONVERT(decimal(15, 2), 
                         ROUND(ZL.BetragRechnung, 2)) AS InvoiceAmount, CONVERT(decimal(15, 2), ROUND(ZL.BetragGutschrift, 2)) AS CreditVoucherAmount, CONVERT(decimal(15, 2), ROUND(ZL.BetragOffen, 2)) AS AmountToPay, 
                         ISNULL(ZL.DTinErstellt, 0) AS DirectDebitCreated, ZL.DTinBearbeiter AS DirectDebitCreatedFromEmployeeI3D, P1.Name + ', ' + P1.Vorname AS DirectDebitCreatedFromEmployeeName, 
                         ZL.DTinDatum AS DirectDebitCreatedDate, ISNULL(ZL.RechAbgeschlossenDurchDTA, 0) AS InvoiceClosedAfterDirectDebit, ZL.DTinZurueckDatum AS PaymentTransactionReturnedDate, 
                         ZL.DTinZurueckBearbeiter AS PaymentTransactionReturnedEmployeeI3D, P2.Name + ', ' + P2.Vorname AS DirectDebitReturnEmployeeName, ZL.Bank AS PayerBank, ZL.PayerIban, ZL.PayerAuthorizationNumber, 
                         ZL.KtoNr AS PayerBankAccountNumber, ZL.BLZ AS PayerBankIdentificationNumber, ZL.PaymentRecipientIdentificationNumber, ZL.PaymentRecipientIban
FROM            dbo.ZahlungseingangLog AS ZL INNER JOIN
                         dbo.RechKopf AS RK ON RK.I3D = ZL.RechKopfI3D INNER JOIN
                         dbo.Kunden AS K ON K.I3D = RK.KundenID LEFT OUTER JOIN
                         dbo.Personal AS P1 ON P1.I3D = ZL.DTinBearbeiter LEFT OUTER JOIN
                         dbo.Personal AS P2 ON P2.I3D = ZL.DTinZurueckBearbeiter
      
GO
/****** Object:  Table [dbo].[SocialMediaSubscription]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SocialMediaSubscription](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[SocialMediaStreamI3D] [int] NOT NULL,
	[SubscriptionDate] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_SocialMediaEmployeeFeed]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_SocialMediaEmployeeFeed]
AS
SELECT        SF.StreamI3D, SF.SocialMediaI3D, SF.SocialMediaKind, SF.Name, SF.Text, SF.CreatedDate, SF.LastCommentDate, SF.SortDate, SF.EmployeeI3D, SF.CommentCount, SF.LikeCount, SF.ObjectI3D, SF.ObjectKind, 
                         SS.EmployeeI3D AS SubscribedFromEmployeeI3D
FROM            dbo.cvw_SocialMediaFeed AS SF INNER JOIN
                         dbo.SocialMediaSubscription AS SS ON SS.SocialMediaStreamI3D = SF.StreamI3D
      
GO
/****** Object:  View [dbo].[cvw_SocialMediaSubscriptions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_SocialMediaSubscriptions]
AS
SELECT        S.I3D, S.EmployeeI3D, P.Vorname + ' ' + P.Name + ' (' + P.KurzZeich + ')' AS EmployeeFullName, S.SocialMediaStreamI3D, SM.DisplayText AS StreamDisplayText, S.SubscriptionDate
FROM            dbo.SocialMediaSubscription AS S INNER JOIN
                         dbo.Personal AS P ON P.I3D = S.EmployeeI3D INNER JOIN
                         dbo.SocialMediaStream AS SM ON SM.I3D = S.SocialMediaStreamI3D
      
GO
/****** Object:  View [dbo].[SupplierOrderVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[SupplierOrderVersions] AS
SELECT
	I3D = K.I3D,
	(SELECT TOP 1 I3D FROM dbo.SupplierOrders WHERE Number = K.Nummer) AS OriginalI3D,
	Number = K.Nummer,
	Date = K.Datum,
	Version = K.Version,
	State = K.Status,
	EditorI3D = IIF(K.PersonalI3D <= 0, NULL, K.PersonalI3D),
	DirectoryI3D = IIF(K.DocDirI3D <= 0, NULL, K.DocDirI3D),

	BranchI3D = IIF(K.BranchI3D <= 0, NULL, K.BranchI3D),
	BranchOrigin = ISNULL(K.BranchOrigin, 0),

	CurrencyI3D = IIF(ISNULL(K.CurrencyI3D, 0) <= 0, NULL, K.CurrencyI3D),
	CurrencyFactor = ISNULL(K.CurrencyFactor, 1),
	CurrencyString = ISNULL(K.CurrencyString, '€'),
	ExclusiveOfVat = ISNULL(K.MwStAusweisen, 0),

	Receiver = ISNULL(K.Empfanger, ''),
	Phone = ISNULL(K.Tel, ''),
	Fax = ISNULL(K.Fax, ''),
	Email = ISNULL(K.Mail, ''),

	SupplierI3D = IIF(ISNULL(K.KreditorI3D, 0) <= 0, 0, K.KreditorI3D),
	AddressI3D = IIF(K.AnschriftI3D <= 0, NULL, K.AnschriftI3D),
	ContactPersonI3D = IIF(K.PersonI3D <= 0, NULL, K.PersonI3D),
	Street = ISNULL(K.Street, ''),
	HasPostOfficeBox = ISNULL(K.HasPostOfficeBox, 0),
	PostOfficeBox = ISNULL(K.PostOfficeBox, ''),
	Zip = ISNULL(K.Zip, ''),
	City = ISNULL(K.City, ''),
	ContactName = ISNULL(K.ContactName, ''),
	CountryI3D = IIF(ISNULL(K.LandI3D, 0) <= 0, NULL, K.LandI3D),

	CreatedByI3D = IIF(K.ErstelltVonI3D <= 0, NULL, K.ErstelltVonI3D),
	CreatedAt = IIF(YEAR(ISNULL(K.ErstelltDatum,0)) < 1905, NULL, K.ErstelltDatum),
	CreatedThroughApplicationVersion = ISNULL(K.ErstelltVersion, ''),
	ChangedByI3D = IIF(K.GeaendertVonI3D <= 0, NULL, K.GeaendertVonI3D),
	ChangedAt = IIF(YEAR(ISNULL(K.GeaendertDatum,0)) < 1905, NULL, K.GeaendertDatum),
	ChangedThroughApplicationVersion = ISNULL(K.GeaendertVersion, ''),
	ChangedThroughApplication = ISNULL(K.ChangedThroughApplication, 0),

	ConcurrencyControlGuid = K.ConcurrencyControlGuid,

	SupplierPaymentConditionI3D = IIF(K.ZahlKondI3D <= 0, NULL, K.ZahlKondI3D),
	SupplierPaymentConditionText = K.ZahlKondText,

	IsLocked = CAST(ISNULL(K.Gesperrt,0) AS BIT),
	IsOrderConfirmed = CAST(ISNULL(K.AuftragBestaetigt,0) AS BIT),
	OrderConfirmationNumber = K.ABestaetigNr,

	IsDirectDelivery = CAST(ISNULL(K.Direktlieferung,0) AS BIT),
	VariableField1 = K.VarFeld1,

	IsPurchased = CAST(ISNULL(K.Bestellt, 0) AS BIT),

	IsOrderedThroughEdi = CAST(ISNULL(K.EOrderFlag, 0) AS BIT),
	EdiOrderDate = IIF(YEAR(ISNULL(K.EOrderDatum,0)) < 1905, NULL, K.EOrderDatum),
	EdiOrderSupplierNumber = K.EOrderKreditorNummer,
	EdiOrderTrackingID = K.EOrderTrackingID,
	EdiOrderXmlDocument = K.EOrderXMLDokument,
	EdiOrderDeliveryAddress = K.EOrderLieferanschrift,
	EdiOrderOrderConfirmationState = CAST(ISNULL(K.EOrderABPruefstatus,0) AS BIT),
	EdiOrderIsHidden = CAST(ISNULL(K.EOrderAusgeblendet,0) AS BIT),
	EdiOrderHiddenInfo = K.EOrderAusgeblendetHinweis,
	EdiOrderDataSynced = CAST(ISNULL(K.EOrderABDatenUebernommen,0) AS BIT),
	EdiOrderInterface = K.EOrderInterface,

	CreatedThroughBVL = CAST(ISNULL(K.BVLGenerated,0) AS BIT),
	ReceiptReasonI3D = IIF(ISNULL(K.BestellungGrundI3D,0) <= 0, NULL, K.BestellungGrundI3D),
	ReceiptReasonText = K.BestellungGrundText,
	FreightAmount = K.Fracht,
	FreightFreeAfterAmount = K.FrachtFreiAb,
	CustomerNumberAtSupplier = K.KdNrBeiLieferant,
	DeliveryDate = K.Lieferdatum,
	DeliveryConditionI3D = IIF(ISNULL(K.LieferbedingungI3D,0) <= 0, NULL, K.LieferbedingungI3D),
	DeliveryConditionText = K.LieferbedingungText,
	Information = K.Notiz,
	IsLicense = CAST(ISNULL(K.isLizenz,0) AS BIT),
	LicenseInfo = K.LizenzBemerkung,
	IsRentPortal = CAST(ISNULL(K.isMietPortal,0) AS BIT),

	DeliveryAddress = K.LieferEmpfanger,
	DeliveryAddressSupplierI3D = IIF(ISNULL(K.LieferKundenI3D,0) <= 0, NULL, K.LieferKundenI3D),
	DeliveryAddressAddressI3D = IIF(ISNULL(K.LieferAnschriftI3D,0) <= 0, NULL, K.LieferAnschriftI3D),
	DeliveryAddressContactPersonI3D = IIF(ISNULL(K.LieferPersonI3D,0) <= 0, NULL, K.LieferPersonI3D),
	DeliveryAddressInformation = K.LieferEmpfaengerInfo,

	ReminderDate = CASE WHEN YEAR(ISNULL(K.WiedervorlageDatum,0)) < 1905 THEN NULL ELSE K.WiedervorlageDatum END,

	LicenseeAddress = K.LizenznehmerKundEmpfaenger,
	LicenseeAddressCustomerI3D = IIF(ISNULL(K.LizenznehmerKundI3D,0) <= 0, NULL, K.LizenznehmerKundI3D),
	LicenseeAddressAddressI3D = IIF(ISNULL(K.LizenznehmerKundAnschriftI3D,0) <= 0, NULL, K.LizenznehmerKundAnschriftI3D),
	LicenseeAddressContactPersonI3D = IIF(ISNULL(K.LizenznehmerKundPersonI3D,0) <= 0, NULL, K.LizenznehmerKundPersonI3D),
	LicenseeAddressInformation = K.LizenznehmerKundInfo,
	ReceiptReceiverI3D = K.ReceiptReceiverI3D,
	ReceiptReceiverInvoiceI3D = K.ReceiptReceiverInvoiceI3D,
	ReceiptReceiverDeliveryI3D = K.ReceiptReceiverDeliveryI3D,
	ReceiptReceiverLicenseI3D = K.ReceiptReceiverLicenseI3D
FROM dbo.BestKopf2 K
WHERE K.AktuelleVersion = 0
GO
/****** Object:  Table [dbo].[GeraetePos]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraetePos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GeraeteKopfI3D] [int] NOT NULL,
	[RechPosI3D] [int] NULL,
	[Positionsnummer] [int] NULL,
	[Artikelpos] [int] NULL,
	[Text] [varchar](5000) NULL,
	[Art] [int] NULL,
	[Code] [varchar](50) NULL,
	[Menge] [float] NULL,
	[Ursprungsart] [int] NULL,
	[Requestnummer] [int] NULL,
	[Bearbeitungsdatum] [datetime] NULL,
	[BearbeiterPersonalI3D] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[GrpID] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[Farbe] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[ArtikelI3D] [int] NULL,
	[Freitext] [varchar](5000) NULL,
	[Richtext] [text] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[KaufDatum] [datetime] NULL,
	[Status] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[Abbuchung] [int] NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[HerstCode] [varchar](100) NULL,
	[MwStI3D] [int] NULL,
	[MwStSatz] [float] NULL,
	[NebenlagerI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[SondervereinbarungI3D] [int] NULL,
	[Rabatt] [float] NULL,
	[UrsprungEK] [float] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungNr] [int] NULL,
	[Ursprung] [int] NULL,
	[numBarcodes] [int] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[ErloesKTO] [int] NULL,
	[EVP] [float] NULL,
	[HelpdeskI3D] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[SummeDruck] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKKalk] [float] NULL,
	[VertragArt] [int] NULL,
	[VertragI3D] [int] NULL,
	[VKBasisWert] [float] NULL,
	[VKDruck] [float] NULL,
	[EKBasis] [int] NULL,
	[Listenpreis] [float] NULL,
	[Produktlinie] [varchar](50) NULL,
	[VKBasis] [int] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Pos] [int] NULL,
	[IsContractRelevant] [bit] NULL,
	[ContractPrice] [decimal](24, 7) NULL,
	[ContractText] [nvarchar](500) NULL,
	[ContractPurchasePrice] [decimal](9, 2) NULL,
 CONSTRAINT [PK_GeraetePos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[MasterDataListItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[MasterDataListItems] AS
SELECT 
	I3D = GP.I3D
	, HeadI3D = GP.GeraeteKopfI3D
	, InternalPosition = ISNULL(GP.Pos, 0)
	, Indent = ISNULL(GP.Indent, 0)
	, GroupID = ISNULL(GP.GrpID, 0)
	, Expanded = ABS(GP.Expanded)
	, Visible = ISNULL(GP.Visible, 0)
	, InvoiceItemI3D = GP.RechPosI3D
	, Text = ISNULL(GP.Text, '')
	, ItemKind = GP.Art
	, ArticleI3D = IIF(GP.ArtikelI3D <= 0, NULL, GP.ArtikelI3D)
	, Quantity = ISNULL(GP.Menge, 0)
	, EANCode = GP.EANCode
	, ManufacturerCode = ISNULL(GP.HerstCode, '')
	, NumberBarcodes = IIF(ISNULL(GP.NumBarcodes, 0) <= 0, 0, GP.NumBarcodes)
	, IsContractRelevant = ISNULL(GP.IsContractRelevant, 0)
	, [FreeText] = ISNULL(GP.Freitext, '')
	, RichText = ISNULL(GP.Richtext, '')
	, FontName = GP.FontName
	, FontSize = GP.FontSize
	, FontColor = GP.FontColor
	, FontStyle = GP.FontStyle
	, IsMainItem = IIF(GP.I3D = GK.HauptGeraetI3D, 1, 0)
	, ArticleCode = ISNULL(GP.Code, '')
	, PurchasePrice = ISNULL(GP.EK, 0)
	, SellPrice = ISNULL(GP.VKKalk, 0)
	, ContractPrice = GP.ContractPrice
	, ContractText = GP.ContractText
	, ContractPurchasePrice = GP.ContractPurchasePrice
FROM GeraetePos GP
INNER JOIN GeraeteKopf GK ON Gk.I3D = GP.GeraeteKopfI3D    
GO
/****** Object:  View [dbo].[SupplierOrderItemVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 
CREATE VIEW [dbo].[SupplierOrderItemVersions] AS
SELECT
	I3D = P.I3D,
	P.I3D AS OriginalI3D,
	P.BestKopfI3D AS ReceiptVersionI3D,
	Kind = P.Art,
	ReceiptI3D = P.BestKopfI3D,
		
	Text = ISNULL(CASE WHEN P.Art IN (1,3,4,5) THEN P.Text ELSE P.Freitext END, ''),

	FontStyle = P.FontStyle,
	FontSize = P.FontSize,
	FontName = P.FontName,
	FontColor = P.FontColor,
	
	InternalPosition = P.Pos,

	ArticleI3D = P.ArtikelI3D,
	ArticleCode = P.Artikelcode,
	EANCode = P.EANCode,
	ManufacturerCode = P.Herstellercode,
	Manufacturer = P.Hersteller,
	SupplierManufacturerCode = P.Kreditorcode,
	ChangeStock = TRY_CAST(IIF(ISNULL(P.Abbuchung, 'N')='J' OR ISNULL(P.Abbuchung, 'N')='1',1,0) AS bit),
	ISNULL(P.Indent, 0) AS Indent,
	CASE WHEN P.Expanded IS NULL OR P.Expanded IN (0, 1) THEN P.Expanded ELSE 1 END AS Expanded,
	
	CONVERT(DECIMAL(19,7), ROUND(P.Stk,7)) AS QuantityComplete,
	CONVERT(DECIMAL(19,7), ROUND(P.StkGeliefert,7)) AS QuantityProcessed,
	CONVERT(DECIMAL(19,7), ROUND(P.StkBenoetigt,7)) AS QuantityNeeded,
	
	BasePrice = P.Preis,
	VATI3D = P.MwStI3D,
	VATRate = P.MwStSatz,
	
	SpecialAgreementI3D = P.SondervereinbarungI3D,
	CostCenterI3D = P.Kostenstelle,
	CostObjectI3D = P.Kostentraeger,
	WarehouseI3D = P.NebenlagerI3D,
	WEEE = P.WEEE,

    --Anderes
	ExpenseAccount = P.AufwandKTO,

	ReceiptOrderItemI3D = p.EKAusAufPosI3D,
	ReceiptOrderI3D = p.AuftragI3D,
	DeliveryDatePlanned = P.LieferDatumSoll,
	DeliveryDate = P.LieferDatumIst,
	PurchaseInformations = P.Bestellinformation,
	PurchaseOrderNumber = P.BestellnrKunde,
	RMAItemI3D = P.RMAPosI3D
FROM dbo.BestPos2 P
INNER JOIN dbo.BestKopf2 h ON h.I3D = p.BestKopfI3D
WHERE ISNULL(h.AktuelleVersion,1) = 0
GO
/****** Object:  Table [dbo].[VertragGeraete]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragGeraete](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragKopfI3D] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Status] [int] NULL,
	[DatumIN] [datetime] NULL,
	[DatumOUT] [datetime] NULL,
	[DateINBy] [int] NULL,
	[DateOUTBy] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[MasterDataList]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[MasterDataList] AS
SELECT
	I3D = GK.I3D
	, SerialNumberI3D = B.I3D
	, SerialNumber = ISNULL(B.Barcode, '')
	, Caption = GK.Text
	, InvoiceItemI3D = IIF((ISNULL(Gk.RechPosI3D, 0)) <= 0, NULL, GK.RechPosI3D)
	, InvoiceI3D = RK.I3D
	, InvoiceNumber = IIF((ISNULL(Gk.Rechnummer, 0)) <= 0, NULL, GK.Rechnummer)
	, InvoiceDate = IIF(YEAR(ISNULL(GK.Rechdatum, 0)) < 1905, NULL, GK.Rechdatum)
	, CreatedByI3D = IIF(GK.ErstellerPersonalI3D <= 0, NULL, GK.ErstellerPersonalI3D)
	, CreatedAt = IIF(YEAR(ISNULL(GK.Erstelldatum, 0)) < 1905, NULL, GK.Erstelldatum)
	, CreatedThroughApplicationVersion = ISNULL(GK.CentronVersion, '')
	, ChangedByI3D = IIF(GK.GeaendertVonI3D <= 0, NULL, GK.GeaendertVonI3D)
	, ChangedAt = IIF(YEAR(ISNULL(GK.AenderungsDatum, 0)) < 1905, NULL, GK.AenderungsDatum)
	, ChangedThroughApplicationVersion = ISNULL(GK.GeaendertVersion, '')
	, CounterDevice = ISNULL(GK.ClickGeraet, 0) -- Nicht gebraucht?
	, CustomerI3D = GK.KundenI3D
	, AddressI3D = IIF(GK.AnschriftID <= 0, NULL, GK.AnschriftID)
	, ContactPersonI3D = IIF(GK.PersonID <= 0, NULL, GK.PersonID)
	, IsActive = IIF(GK.Status = 1, 1, 0)
	, Number = GK.Nummer
	, CurrencyI3D = IIF(GK.CurrencyI3D <= 0, NULL, GK.CurrencyI3D) -- Nicht gebraucht?
	, CurrencyFactor = IIF(GK.CurrencyFactor <= 0, 1, GK.CurrencyFactor) -- nicht gebraucht?
	, CurrencyString = ISNULL(GK.CurrencyString, '€') -- nicht gebraucht?
	, InfoShort = ISNULL(GK.Standort, '')
	, Info = ISNULL(GK.StandortLang, '')
	, DirectoryI3D = GK.DocDiri3D
	, Date = IIF(YEAR(ISNULL(GK.Datum, 0)) < 1905, NULL, GK.Datum)
	, FreeInventoryNumber = ISNULL(GK.FreeInventoryNumber, '')
	, CustomerName = ISNULL(K.Name, '')
	, ArticleCode = ISNULL(A.Artikelcode, '')
	, ContactPerson = ISNULL(COALESCE(p.Ansprech + ',' + p.AnsprechVorname, p.Ansprech, p.AnsprechVorname), '') --Streichen?
	, MainItemI3D = GK.HauptgeraetI3D
	, ContractI3D = vg.VertragKopfI3D
	, ArticleDescription = ISNULL(a.Artikelbeschreibung,'')
	, IsMsp = GK.IsMsp
	, SerialNumberState = B.Status
	, AssetNumber = CASE WHEN b.Status = 3 THEN b.Lieferscheinnummer
	 WHEN b.Status = 4 THEN b.Rechnungsnummer
ELSE Null END
FROM GeraeteKopf GK
LEFT OUTER JOIN GeraetePos GP ON GP.I3D = GK.HauptgeraetI3D
LEFT OUTER JOIN ARTIK A ON A.I3D = GP.ArtikelI3D
LEFT OUTER JOIN Kunden k ON k.I3D = GK.KundenI3D
LEFT OUTER JOIN Personen P ON P.I3D = GK.Ansprech
LEFT OUTER JOIN Barcode B ON B.GeraetePosI3D = GP.I3D AND B.ArtikelI3D = GP.ArtikelI3D
LEFT OUTER JOIN RechKopf RK ON RK.Nummer = GK.Rechnummer AND RK.Nummer <> 0
LEFT OUTER JOIN (
	SELECT GeraeteKopfI3D, VertragKopfI3D, ROW_NUMBER() OVER (PARTITION BY GeraeteKopfI3D ORDER BY I3D DESC) AS RowNr
	FROM VertragGeraete
	WHERE Status = 1
) vg ON vg.GeraeteKopfI3D = gk.I3D AND vg.RowNr = 1
GO
/****** Object:  View [dbo].[cvw_MasterDataListItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_MasterDataListItems] AS
SELECT 
	mdi.I3D,
	mdi.HeadI3D, 
	mdi.ArticleI3D, 
	DBText = mdi.[FreeText], 
	DBRichText = mdi.RichText, 
	DBFreeText = mdi.[FreeText], 
	mdi.ItemKind, 
	mdi.InternalPosition, 
	mdi.Quantity, 
	mdi.InvoiceItemI3D, 
	a.Artikelcode ArticleCode,
	mdi.FontStyle, 
	mdi.FontName, 
	mdi.FontSize, 
	mdi.FontColor,
	mdi.IsContractRelevant,
	mdi.IsMainItem,
	mdi.PurchasePrice,
	mdi.SellPrice
FROM dbo.MasterDataListItems mdi
LEFT OUTER JOIN ARTIK a ON a.I3D = mdi.ArticleI3D
      
GO
/****** Object:  View [dbo].[cvw_MasterDataList]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_MasterDataList]
AS
SELECT
    mdl.I3D,
    mdl.Caption,
    mdl.InfoShort AS Place,
    mdl.CustomerI3D,
    mdl.ContactPersonI3D,
    mdl.AddressI3D,
    mdl.Date,
    mdl.IsActive,
    mdl.DirectoryI3D AS DocDiri3D,
    mdl.CustomerName Customer,
    mdl.ArticleCode,
    mdl.ContactPerson ContactPerson,
    mdl.SerialNumberI3D SerialNumberI3D,
    mdl.SerialNumber SerialNumber,
    mdl.FreeInventoryNumber,
    mdl.ContractI3D,
	mdl.IsMsp
FROM
    MasterDataList mdl
GO
/****** Object:  View [dbo].[SupplierDeliveryListItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[SupplierDeliveryListItems] AS
SELECT
	I3D = P.I3D,
	
	Kind = P.Art,
	ReceiptI3D = P.WareKopfI3D,
	Text = ISNULL(CASE WHEN P.Art IN (1,3,4,5,11,12) THEN P.Text ELSE P.Freitext END, ''),
	FontStyle = P.FontStyle,
	FontSize = P.FontSize,
	FontName = P.FontName,
	FontColor = P.FontColor,
	InternalPosition = P.Pos,
	ArticleI3D = P.ArtikelI3D,
	ArticleCode = P.Artikelcode,
	EANCode = P.EANCode,
	ManufacturerCode = P.Herstellercode,
	SupplierManufacturerCode = P.Kreditorcode,
	ChangeStock = CASE WHEN P.Art = 1 THEN TRY_CAST(IIF(ISNULL(A.Abbuchung, 'N')='J' OR ISNULL(A.Abbuchung, 'N')='1',1,0) AS bit) 
		ELSE TRY_CAST(IIF(ISNULL(P.Abbuchung, 'N')='J' OR ISNULL(P.Abbuchung, 'N')='1',1,0) AS bit) END,
	
	CONVERT(DECIMAL(19,7), ROUND(P.Stk,7)) AS QuantityComplete,
	CONVERT(DECIMAL(19,7), ROUND(P.StkKalkuliert,7)) AS QuantityProcessed,
	BasePrice = P.Preis,
	VATI3D = P.MwStI3D,
	VATRate = P.MwStSatz,
	SpecialAgreementI3D = P.SondervereinbarungI3D,
	CostCenterI3D = P.Kostenstelle,
	CostObjectI3D = P.Kostentraeger,
	WarehouseI3D = P.NebenlagerI3D,
	WEEE = P.WEEE,
    --Anderes
	ExpenseAccount = P.AufwandKTO,
	OriginReceiptItemI3D = P.UebernommenAusI3D,
    OriginReceiptI3D = BP.BestKopfI3D,
	OriginKind = P.UebernommenAusArt,
	ReceiptOrderItemI3D = P.EKAusAufPosI3D,
	ReceiptOrderI3D = P.AuftragI3D,
	PurchaseOrderQuantity = CONVERT(DECIMAL(19,7), ROUND(P.StkBestellt,7)),
	IsBooked = CAST(IIF(P.Gebucht = 1, 1, 0) AS BIT),
	DeliveryDatePlanned = P.LieferDatumSoll,
	DeliveryDate = P.LieferDatumIst,
	DeliveryNumber = P.LieferscheinNr,
	RMAItemI3D = P.RMAPosI3D
FROM dbo.WarePos P
LEFT OUTER JOIN dbo.ARTIK A ON A.I3D = P.ArtikelI3D
LEFT OUTER JOIN dbo.BestPos2 BP ON BP.I3D = P.UebernommenAusI3D AND P.UebernommenAusArt = 7 --SupplierOrder
GO
/****** Object:  View [dbo].[cvw_BarcodeDetails]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_BarcodeDetails] AS	
SELECT B.I3D,
       B.Barcode AS BarcodeName,
       B.Status AS State,
       B.SystemIdentNr AS SystemIdentifierNumber,
       B.ErstellDatum AS CreatedAt,
       B.Beschreibung AS Description,
	
       B.ArtikelI3D AS ArticleI3D,
       A.Artikelcode AS ArticleCode,
       A.Artikelbeschreibung AS ArticleDescription,
       A.Garantie1Art AS GarantieType,
       A.Garantie1Wert AS GarantieValue,
	
       W.I3D AS StorageI3D,
       W.Caption AS StorageName,
	
       KalkKopfDataForBarcode.Kreditorcode AS Kreditorcode,
	
       SDLH.Number AS SupplierDeliveryListNumber,
       SDLH.I3D AS SupplierDeliveryListI3D,
       B.BestPosI3D AS SupplierDeliveryListItemI3D,
       SDLH.AddressName AS SupplierDeliveryListName,
       SDLH.NetPriceComplete AS SupplierNetPriceComplete,
       SDLH.TaxPriceComplete AS SupplierTaxPriceComplete,
       SDLH.Date AS SupplierDeliveryListDate,
	
       SDLH.SupplierReceiptNumber AS SupplierDeliveryListReceiptNumber,
       SDLH.SupplierReceiptDate AS SupplierDeliveryListReceiptDate,
	
       KalkKopfDataForBarcode.RechnungsNr AS SupplierInvoiceReceiptNumber,
       KalkKopfDataForBarcode.RechnungsDatum AS SupplierInvoiceReceiptDate,
	
       B.Auftragsnummer AS  OrderNumber,
       O.I3D AS OrderI3D,
       B.AufPosI3D AS OrderItemI3D,
       O.CustomerI3D AS OrderCustomerI3D,
       O.CustomerName AS OrderCustomerName,
       O.NetPriceComplete AS OrderNetPriceComplete,
       O.TaxPriceComplete AS OrderTaxPriceComplete,
       O.Date AS OrderDate, 
	
       B.Lieferscheinnummer AS DeliveryListNumber,
       D.I3D AS DeliveryListI3D,
       B.LiefPosI3D AS DeliveryListItemI3D,
       D.CustomerI3D AS DeliveryListCustomerI3D,
       D.CustomerName AS DeliveryListCustomerName,
       D.NetPriceComplete AS DeliveryListNetPriceComplete,
       D.TaxPriceComplete AS DeliveryListTaxPriceComplete,
       D.Date AS DeliveryListDate,
	
       B.Rechnungsnummer AS InvoiceNumber,
       I.I3D AS InvoiceI3D,
       B.RechPosI3D AS InvoiceItemI3D,
       I.CustomerI3D AS InvoiceCustomerI3D,
       I.CustomerName AS InvoiceCustomerName,
       I.NetPriceComplete AS InvoiceNetPriceComplete,
       I.TaxPriceComplete AS InvoiceTaxPriceComplete,
       I.Date AS InvoiceDate,
	
       B.GeraeteKopfNummer AS MasterDataListNumber,
       MDL.I3D AS MasterDataListI3D,
       B.GeraetePosI3D as MasterDataListItemI3D,
       MDL.CustomerI3D AS MasterDataListCustomerI3D,
       MDL.Customer AS MasterDataListCustomerName,
       MDL.Date AS MasterDataListDate,

	   B.IsInRma AS IsInRma

FROM dbo.Barcode AS B
LEFT OUTER JOIN dbo.ARTIK AS A ON B.ArtikelI3D = A.I3D 
LEFT OUTER JOIN dbo.Warehouses AS W ON ISNULL(B.LagerI3D, -1) = W.I3D
LEFT OUTER JOIN cvw_DeliveryListHead AS D ON B.Lieferscheinnummer = D.Number
LEFT OUTER JOIN cvw_InvoiceHead AS I ON B.Rechnungsnummer = I.Number
LEFT OUTER JOIN cvw_OrderHead AS O ON B.Auftragsnummer = O.Number
LEFT OUTER JOIN SupplierDeliveryListItems SDLI ON SDLI.I3D = B.BestPosI3D
LEFT OUTER JOIN cvw_SupplierDeliveryListHead SDLH ON SDLH.I3D = SDLI.ReceiptI3D
OUTER APPLY (SELECT K.Kreditorcode, KK.RechnungsNr, KK.RechnungsDatum, KK.Nummer, ROW_NUMBER() OVER (PARTITION BY B.I3D ORDER BY KK.Nummer DESC) AS SupplierInvoiceRowNumber
    FROM KalkPos K
    INNER JOIN KalkKopf KK ON KK.I3D = K.KalkKopfI3D
	WHERE K.UebernommenAusI3D = SDLI.I3D) AS KalkKopfDataForBarcode
LEFT OUTER JOIN cvw_MasterDataList AS MDL ON B.GeraeteKopfNummer = MDL.I3D
WHERE COALESCE(KalkKopfDataForBarcode.SupplierInvoiceRowNumber,1) = 1
GO
/****** Object:  View [dbo].[SupplierDeliveryLists]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[SupplierDeliveryLists] AS
SELECT
	I3D = K.I3D,

	Number = K.Nummer,
	Date = K.Datum,
	Version = K.Version,
	State = K.Status,
	EditorI3D = IIF(K.PersonalI3D <= 0, NULL, K.PersonalI3D),
	DirectoryI3D = IIF(K.DocDirI3D <= 0, NULL, K.DocDirI3D),

	BranchI3D = IIF(K.BranchI3D <= 0, NULL, K.BranchI3D),
	BranchOrigin = ISNULL(K.BranchOrigin, 0),

	CurrencyI3D = IIF(ISNULL(K.CurrencyI3D, 0) <= 0, NULL, K.CurrencyI3D),
	CurrencyFactor = ISNULL(K.CurrencyFactor, 1),
	CurrencyString = ISNULL(K.CurrencyString, '€'),
	ExclusiveOfVat = ISNULL(K.MwStAusweisen, 0),

	Receiver = ISNULL(K.Empfanger, ''),
	Phone = ISNULL(K.Tel, ''),
	Fax = ISNULL(K.Fax, ''),
	Email = ISNULL(K.Mail, ''),

	SupplierI3D = IIF(ISNULL(K.KreditorI3D, 0) <= 0, 0, K.KreditorI3D),
	AddressI3D = IIF(K.AnschriftI3D <= 0, NULL, K.AnschriftI3D),
	ContactPersonI3D = IIF(K.PersonI3D <= 0, NULL, K.PersonI3D),
	Street = ISNULL(K.Street, ''),
	HasPostOfficeBox = ISNULL(K.HasPostOfficeBox, 0),
	PostOfficeBox = ISNULL(K.PostOfficeBox, ''),
	Zip = ISNULL(K.Zip, ''),
	City = ISNULL(K.City, ''),
	ContactName = ISNULL(K.ContactName, ''),
	CountryI3D = IIF(ISNULL(K.LandI3D, 0) <= 0, NULL, K.LandI3D),

	CreatedByI3D = IIF(K.ErstelltVonI3D <= 0, NULL, K.ErstelltVonI3D),
	CreatedAt = IIF(YEAR(ISNULL(K.ErstelltDatum,0)) < 1905, NULL, K.ErstelltDatum),
	CreatedThroughApplicationVersion = ISNULL(K.ErstelltVersion, ''),
	ChangedByI3D = IIF(K.GeaendertVonI3D <= 0, NULL, K.GeaendertVonI3D),
	ChangedAt = IIF(YEAR(ISNULL(K.GeaendertDatum,0)) < 1905, NULL, K.GeaendertDatum),
	ChangedThroughApplicationVersion = ISNULL(K.GeaendertVersion, ''),
	ChangedThroughApplication = ISNULL(K.ChangedThroughApplication, 0),

	ConcurrencyControlGuid = K.ConcurrencyControlGuid,
	ExternalDeliveryListDate = IIF(YEAR(K.LieferscheinDatum) < 1905, NULL, K.LieferscheinDatum),
	ExternalDeliveryListNumber = K.LieferscheinNr,
	LateBooking = CAST(ISNULL(K.SpaeteBuchung,0) AS BIT),
	SupplierPaymentConditionI3D = IIF(K.ZahlKondI3D <= 0, NULL, K.ZahlKondI3D),
	SupplierPaymentConditionText = K.ZahlKondText,
	FreightAmount = K.Fracht,
	FreightDistribution = K.FrachtVerteilung,
	InsuranceAmount = K.Versicherung,
	InsuranceDistribution = K.VersicherungsVerteilung,
	FreightFreeAfterAmount = K.FrachtFreiAb,
	Information = K.Notiz,
	DeliveryDate = IIF(YEAR(K.Lieferdatum) < 1905, NULL, K.Lieferdatum),
	K.WareneingangGrundI3D AS ReceiptReasonI3D,
	K.WareneingangGrundText AS ReceiptReasonText,
	K.VarFeld1 AS VariableField1,
	ReceiptReceiverI3D = K.ReceiptReceiverI3D,
	ReceiptReceiverInvoiceI3D = K.ReceiptReceiverInvoiceI3D,
	ReceiptReceiverDeliveryI3D = K.ReceiptReceiverDeliveryI3D,
	ReceiptReceiverLicenseI3D = K.ReceiptReceiverLicenseI3D

FROM dbo.WareKopf K
GO
/****** Object:  View [dbo].[cvw_InvoiceDunnings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_InvoiceDunnings]
AS

SELECT 
	RK.I3D,
	Number = RK.Nummer,
	CustomerI3D = RK.KundenID,
	CustomerName = IH.CustomerName,
	AddressI3D = case 
		when I.UsedAlternativeInvoiceAddress = 0 OR I.InvoiceAddressAddressI3D is null OR I.InvoiceAddressAddressI3D = 0 then RK.AnschriftID
		else I.InvoiceAddressAddressI3D
		end,
	ContactPersonI3D = case 
		when I.UsedAlternativeInvoiceAddress = 0 OR I.InvoiceAddressContactPersonI3D is null OR I.InvoiceAddressContactPersonI3D = 0 then RK.PersonID
		else I.InvoiceAddressContactPersonI3D
		end,
          
	State = RK.Status,
	BranchI3D = ISNULL(RK.FilialI3D, 0),
	PaymentConditionI3D = RK.ZahlKondId,
    ReceiptUserState = RUS.Caption,
					
	Date = RK.Datum,
	DueDate = RK.FaelligAm,
					
	DunningLevel1Date = RK.Mahnung1Datum,
	DunningLevel1EmployeeI3D = ps.I3D,
	DunningLevel2Date = RK.Mahnung2Datum,
	DunningLevel2EmployeeI3D = ps2.I3D,
	DunningLevel3Date = RK.Mahnung3Datum,
	DunningLevel3EmployeeI3D = ps3.I3D,
	DunningLevel = 
		(CASE 
			WHEN RK.FaelligAm > GETDATE() THEN NULL
			ELSE ISNULL(RK.Mahnstufe, 0)
		END),
						
	DunningStop = RK.MahnStop,
	DunningInfo = RK.MahnInfo,
	DunningStopBegin = RK.DunningStopBegin,
	DunningStopEnd = RK.DunningStopEnd,
					
	EditorI3D = RK.BearbeiterI3D,
	Adviser1I3D = RK.InnendienstID,
	Adviser2I3D = RK.AussendienstID,
	Adviser3I3D = RK.TechnikerID,
	Adviser4I3D = RK.Techniker2ID,
					
	nextDueDateCalculation.NextDueDate,
	NextDueDateInDays = DATEDIFF(day, GETDATE(), nextDueDateCalculation.NextDueDate),
					
	GrossPriceComplete = IH.NetPriceComplete + IH.TaxPriceComplete,
	CreditVoucherGrossAmount = CONVERT(DECIMAL(19,2),ISNULL(cv.grossamount, 0)),
	PayedGrossAmount = CONVERT(DECIMAL(19,2), (ISNULL(IH.Payed, 0) / ISNULL(IH.CurrencyFactor, 1)) - ISNULL(cv.grossamount, 0)),
				
	GrossPriceFCComplete = IH.NetPriceFCComplete + IH.TaxPriceFCComplete,
	CreditVoucherFCGrossAmount = CONVERT(DECIMAL(19,2),ISNULL(cv.grossamountfc, 0)),
	PayedFCGrossAmount = CONVERT(DECIMAL(19,2),ISNULL(IH.Payed, 0) - ISNULL(cv.grossamountfc, 0)),
				
	IH.CurrencyString,
	IH.CurrencyFactor,
	IH.AdditionalText,
	
	REPLACE((SELECT DISTINCT '' + CAST(t.ReceiptI3D AS varchar) + ';' FROM dbo.CreditVoucherItems t WHERE t.OriginReceiptI3D = IH.I3D AND t.OriginKind = 4 for xml path ('')) + ';',';;','') AS CreditVoucherI3Ds,
	REPLACE((SELECT DISTINCT '' + CAST(b.Number AS varchar) + ';' FROM dbo.CreditVoucherItems t INNER JOIN dbo.CreditVouchers b ON b.I3D = t.ReceiptI3D WHERE t.OriginReceiptI3D = IH.I3D AND t.OriginKind = 4 for xml path ('')) + ';',';;','') AS CreditVoucherNumbers
				
FROM RechKopf RK 
INNER JOIN cvw_InvoiceHead IH ON IH.I3D = RK.I3D
INNER JOIN Invoices I ON I.I3D = RK.I3D
INNER JOIN Kunden KU ON KU.I3D = RK.KundenID
        
LEFT JOIN Sichbenu sb ON sb.I3D = RK.Mahnung1BearbeiterI3D
LEFT JOIN Personal ps ON ps.I3D = sb.Personal   
				                
LEFT JOIN Sichbenu sb2 ON sb2.I3D = RK.Mahnung2BearbeiterI3D
LEFT JOIN Personal ps2 ON ps2.I3D = sb2.Personal 
				   				              
LEFT JOIN Sichbenu sb3 ON sb3.I3D = RK.Mahnung3BearbeiterI3D
LEFT JOIN Personal ps3 ON ps3.I3D = sb3.Personal   

LEFT JOIN dbo.ReceiptUserState RUS ON RUS.I3D = I.ReceiptUserStateI3D

LEFT JOIN (SELECT ABS(SUM(pos.NetPriceTotal + pos.TaxPriceTotal)) as grossamount, 
		ABS(SUM(pos.NetPriceTotalFC + pos.TaxPriceTotalFC)) as grossamountfc, 
		cvi.OriginReceiptI3D 
FROM CreditVoucherItems cvi
INNER JOIN cvw_CreditVoucherPosLC pos ON cvi.I3D = pos.I3D
WHERE cvi.OriginKind = 4 AND cvi.Expanded IS NULL
GROUP BY cvi.OriginReceiptI3D) cv on cv.OriginReceiptI3D = IH.I3D 

CROSS APPLY 
(
	SELECT
	CASE ISNULL(RK.Mahnstufe, 0)
		WHEN 0 THEN
		(
			CASE 
				WHEN (IsNull(KU.MahnungNachTagen2, 0) <= 0) THEN RK.FaelligAm + (SELECT Wert FROM Stammdat WHERE I3D = 243)
				ELSE RK.FaelligAm + KU.MahnungNachTagen
			END
		)
		WHEN 1 THEN
		(
			CASE 
				WHEN (IsNull(KU.MahnungNachTagen2, 0) <= 0) THEN RK.Mahnung1Datum + (SELECT Wert FROM Stammdat WHERE I3D = 244)
				ELSE RK.Mahnung1Datum + KU.MahnungNachTagen2
			END
		)
		WHEN 2 THEN
		(
			CASE 
				WHEN (IsNull(KU.MahnungNachTagen3, 0) <= 0) THEN RK.Mahnung2Datum + (SELECT Wert FROM Stammdat WHERE I3D = 245)
				ELSE RK.Mahnung2Datum + KU.MahnungNachTagen3
			END
		)
		ELSE
		(
			CASE 
				WHEN (IsNull(KU.MahnungNachTagen3, 0) <= 0) THEN RK.Mahnung3Datum + (SELECT Wert FROM Stammdat WHERE I3D = 245)
				ELSE RK.Mahnung3Datum + KU.MahnungNachTagen3
			END
		)
	END AS NextDueDate	
) 
as nextDueDateCalculation
WHERE IH.Number <> 0
GO
/****** Object:  View [dbo].[cvw_CreditVoucherDunnings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
		
				CREATE VIEW [dbo].[cvw_CreditVoucherDunnings]
				AS
						SELECT
							CH.I3D,
							CH.Number,
							CH.CustomerI3D,
							CH.CustomerName,
								AddressI3D = case 
								when CV.UsedAlternativeInvoiceAddress = 0 OR CV.InvoiceAddressAddressI3D is null OR CV.InvoiceAddressAddressI3D = 0 then CV.AddressI3D
								else CV.InvoiceAddressAddressI3D
								end,
							ContactPersonI3D = case 
								when CV.UsedAlternativeInvoiceAddress = 0 OR CV.InvoiceAddressContactPersonI3D is null OR CV.InvoiceAddressContactPersonI3D = 0 then CV.ContactPersonI3D
								else CV.InvoiceAddressContactPersonI3D
								end,
							CH.State,
							BranchI3D = ISNULL(CH.BranchI3D, 0),
							CH.PaymentConditionI3D,
							
							CH.Date,
						
							GrossPriceComplete = CH.NetPriceComplete + CH.TaxPriceComplete,	
							GrossPriceFCComplete = CH.NetPriceFCComplete + CH.TaxPriceFCComplete,
						
							CH.CurrencyString,
							CH.CurrencyFactor,
							CH.AdditionalText,

							CH.EditorI3D,
							CH.Adviser1I3D,
							CH.Adviser2I3D,
							CH.Adviser3I3D,
							CH.Adviser4I3D,
							
							REPLACE((SELECT DISTINCT '' + CAST(t.OriginReceiptI3D AS varchar) + ';' FROM dbo.CreditVoucherItems t WHERE t.ReceiptI3D = CH.I3D AND t.OriginKind = 4 AND t.OriginReceiptI3D > 0 for xml path ('')) + ';',';;','') AS InvoiceI3Ds,
							REPLACE((SELECT DISTINCT '' + CAST(IH.Number AS varchar) + ';' FROM dbo.CreditVoucherItems t INNER JOIN cvw_InvoiceHead IH ON IH.I3D = t.OriginReceiptI3D WHERE t.ReceiptI3D = CH.I3D AND t.OriginKind = 4 AND t.OriginReceiptI3D > 0 for xml path ('')) + ';',';;','') AS InvoiceNumbers
						
						FROM cvw_CreditVoucherHead CH
						INNER JOIN cvw_CreditVoucherPos CP ON CP.CreditVoucherHeadI3D = CH.I3D 
						INNER JOIN CreditVouchers CV ON CV.I3D = CH.I3D
						WHERE CH.Number <> 0
						
						GROUP BY 
							CH.I3D,
							CH.Number,
							CH.CustomerI3D,
							CH.CustomerName,
							CV.AddressI3D,
							CV.ContactPersonI3D,
							CV.UsedAlternativeInvoiceAddress,
							CV.InvoiceAddressAddressI3D,
							CV.InvoiceAddressContactPersonI3D,
							CH.State,
							CH.BranchI3D,
							CH.PaymentConditionI3D,
							CH.Date,
							CH.NetPriceComplete,
							CH.TaxPriceComplete,
							CH.NetPriceFCComplete,
							CH.TaxPriceFCComplete,
							CH.CurrencyString,
							CH.CurrencyFactor,
							CH.AdditionalText,
							CH.EditorI3D,
							CH.Adviser1I3D,
							CH.Adviser2I3D,
							CH.Adviser3I3D,
							CH.Adviser4I3D
GO
/****** Object:  Table [dbo].[Mahnlauf]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mahnlauf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[RechKopfI3D] [int] NULL,
	[Mahnart] [int] NULL,
	[MahnstatusAlt] [int] NULL,
	[MahnstatusNeu] [int] NULL,
	[MahnDatum] [datetime] NULL,
	[MahnBearbeiterI3D] [int] NULL,
	[Status] [int] NULL,
	[MahnLaufNr] [int] NULL,
	[GeloeschtDatum] [datetime] NULL,
	[GeloeschtBearbeiterI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_DunningRunItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

					CREATE VIEW [dbo].[cvw_DunningRunItems]
						AS
						SELECT 
							ml.I3D,
							CustomerI3D = rk.KundenID,
							DunningRunNumber = ml.MahnLaufNr,
							InvoiceI3D = ml.RechKopfI3D,
							Date = ml.Datum,
							EditorI3D = ps.I3D,
							DunningSendType = ml.Mahnart,
							OldDunningLevel = ml.MahnstatusAlt,
							NewDunningLevel = ml.MahnstatusNeu,
							State = ml.Status,
							DeletedDate = ml.GeloeschtDatum,
							DeletedByEmployeeI3D = ps2.I3D
						FROM Mahnlauf ml
						INNER JOIN Sichbenu sb ON sb.I3D = ml.BearbeiterI3D
						INNER JOIN Personal ps ON ps.I3D = sb.Personal                   
						LEFT JOIN Sichbenu sb2 ON sb2.I3D = ml.GeloeschtBearbeiterI3D
						LEFT JOIN Personal ps2 ON ps2.I3D = sb2.Personal        
						INNER JOIN RechKopf rk ON rk.I3D = ml.RechKopfI3D
				
GO
/****** Object:  View [dbo].[cvw_DunningCustomers]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
        
			CREATE VIEW [dbo].[cvw_DunningCustomers]
			AS
			
			SELECT 
				k.I3D,
				CustomerNumber = 
					CASE 
						WHEN k.KundenNummer > 0 THEN k.KundenNummer
						ELSE k.I3D
					END,
				CustomerName = k.Name,
				CustomerMail = k.KdEMail,
				CustomerPhone = k.Fon,
				CustomerWebSite = k.KdWWW,
			
				DunningContactI3D = k.MahnPersonI3D,
            
				SendType = k.MahnArt,
			
				UseDivergentInvoiceAddressAsDunningAddress = k.MahnungAnAbwRechAnschrift,
				
				DunningLevel1AfterDays = k.MahnungNachTagen,
				DunningLevel2AfterDays = k.MahnungNachTagen2,
				DunningLevel3AfterDays = k.MahnungNachTagen3,

				DefaultAddressI3D = AN.I3D,

				InvoiceCount = (SELECT COUNT(I3D) FROM cvw_InvoiceDunnings WHERE CustomerI3D = k.I3D AND State = 1),
				CreditVoucherCount = (SELECT COUNT(I3D) FROM cvw_CreditVoucherDunnings WHERE CustomerI3D = k.I3D AND State = 1),

				ac.DunningStop,
				ac.DunningStopBegin,
				ac.DunningStopEnd,
				ac.DunningInfo			
				
			FROM Kunden k
			LEFT JOIN Anschrif an ON an.Kunde = k.I3D AND an.KundeDefault = 1
			LEFT JOIN AccountCustomers ac ON ac.Number = k.KundenNummer
GO
/****** Object:  Table [dbo].[CRMProjekt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CRMProjekt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](200) NULL,
	[Nummer] [int] NULL,
	[KundenI3D] [int] NULL,
	[Projektstatus] [varchar](60) NULL,
	[ExterneProjektnummer] [varchar](60) NULL,
	[Projektart] [int] NULL,
	[ADM] [int] NULL,
	[IDM] [int] NULL,
	[Techniker1] [int] NULL,
	[Techniker2] [int] NULL,
	[Wahrscheinlichkeit] [varchar](60) NULL,
	[Projektbeginn] [datetime] NULL,
	[Projektabschluss] [datetime] NULL,
	[Umsatz] [float] NULL,
	[Deckungsbeitrag] [float] NULL,
	[Status] [int] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[RootDirI3D] [int] NULL,
	[WahrscheinlichkeitI3D] [int] NULL,
	[WahrscheinlichkeitProzent] [float] NULL,
	[ProjektstatusI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[ProjektEntscheidungstermin] [datetime] NULL,
	[Ansprechpartner1] [int] NULL,
	[Ansprechpartner2] [int] NULL,
	[Ansprechpartner3] [int] NULL,
	[Ansprechpartner4] [int] NULL,
	[SalesMonthly] [decimal](18, 0) NULL,
	[MarginMonthly] [decimal](18, 0) NULL,
	[ResponsiblePersonI3D] [int] NULL,
	[CloseProjectReasonI3D] [int] NULL,
	[CloseProjectReasonComment] [nvarchar](500) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CRMProjektObjekt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CRMProjektObjekt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CRMProjektI3D] [int] NULL,
	[ObjektI3D] [int] NULL,
	[ObjektArt] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_CrmProjectRevenueOverview]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_CrmProjectRevenueOverview]
AS
SELECT proj.I3D AS CRMProjectI3D, proj.Umsatz AS PlannedAmount, proj.Deckungsbeitrag AS PlannedRevenue,
       SUM(ISNULL(offerCalcs.NetPrice,0)) AS OfferAmount, SUM(ISNULL(offerCalcs.NetPrice,0) - ISNULL(offerCalcs.NetPurchasePrice,0)) AS OfferRevenue,
       SUM(ISNULL(orderCalcs.NetPrice,0)) AS OrderAmount, SUM(ISNULL(orderCalcs.NetPrice,0) - ISNULL(orderCalcs.NetPurchasePrice,0)) AS OrderRevenue,

       ROUND(IIF(proj.Umsatz > 0,100/proj.Umsatz*SUM(ISNULL(offerCalcs.NetPrice,0)),0),1) AS OfferPlannedAmountReachedInPercent,
       ROUND(IIF(proj.Umsatz > 0,100/proj.Umsatz*SUM(ISNULL(orderCalcs.NetPrice,0)),0),1) AS OrderPlannedAmountReachedInPercent,
       ROUND(IIF(proj.Deckungsbeitrag > 0,100/proj.Deckungsbeitrag*SUM(ISNULL(offerCalcs.NetPrice,0) - ISNULL(offerCalcs.NetPurchasePrice,0)),0),1) AS OfferPlannedRevenueReachedInPercent,
       ROUND(IIF(proj.Deckungsbeitrag > 0,100/proj.Deckungsbeitrag*SUM(ISNULL(orderCalcs.NetPrice,0) - ISNULL(orderCalcs.NetPurchasePrice,0)),0),1) AS OrderPlannedRevenueReachedInPercent
FROM dbo.CRMProjekt proj
LEFT OUTER JOIN dbo.CRMProjektObjekt projObject ON projObject.CRMProjektI3D = proj.I3D
LEFT OUTER JOIN dbo.AngKopf offer ON offer.I3D = projObject.ObjektI3D AND projObject.ObjektArt = 1
LEFT OUTER JOIN dbo.cvw_OfferHeadLC offerCalcs ON offerCalcs.I3D = offer.I3D
LEFT OUTER JOIN dbo.AufKopf [order] ON [order].I3D = projObject.ObjektI3D AND projObject.ObjektArt = 2
LEFT OUTER JOIN dbo.cvw_OrderHeadLC orderCalcs ON orderCalcs.I3D = [order].I3D
GROUP BY proj.I3D, proj.Umsatz, proj.Deckungsbeitrag

      
GO
/****** Object:  View [dbo].[cvw_CommissionOrders]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_CommissionOrders]
AS
SELECT o.I3D, o.Number, o.Date, o.PreparationDate, o.DeliveryDate, pCreator.I3D AS CreatedByI3D, pCreator.KurzZeich AS CreatedByShortSign, o.CustomerI3D, o.Receiver, 
	IIF(RTRIM(ISNULL(o.DeliveryAddress,'')) = '', o.Receiver, o.DeliveryAddress) AS DeliveryAddress, o.DeliveryConditionI3D, delivCond.Kurztext AS DeliveryConditionText,
	o.IsDirectDeliveryPossible, o.IsPartialDeliveryPossible, ISNULL(branch.I3D,0) AS BranchI3D, ISNULL(branch.FilialName,'Hauptsitz') AS BranchName,
	CAST(ISNULL(ak.Kommisioniert,0) AS BIT) AS IsOrderCommissioned,
	IIF(ISNULL(oDetails.OpenQuantity,0) = 0, 1, 0) AS IsOrderConsignmentComplete,
	IIF(ISNULL(oDetails.OpenQuantity,0) > 0 AND ISNULL(oDetails.ConsignmentQuantity,0) > 0, 1, 0) AS IsOrderConsignmentPartialComplete,
 	ISNULL(oDetails.IsReadyForConsignment,0) AS IsReadyForConsignment,
	ISNULL(o.PurchaseOrderNumber,'') AS PurchaseOrderNumber, ISNULL(o.ProjectNumber,'') AS ProjectNumber, o.ConcurrencyControlGuid, o.Information, userState.Caption AS ReceiptUserStateCaption,
	ak.LockUser
FROM dbo.Orders o
INNER JOIN dbo.AufKopf ak ON ak.I3D = o.I3D
LEFT OUTER JOIN dbo.Personal pCreator ON pCreator.I3D = o.CreatedByI3D
LEFT OUTER JOIN dbo.Zahkond delivCond ON delivCond.I3D = o.DeliveryConditionI3D
LEFT OUTER JOIN dbo.Filiale branch ON branch.I3D = o.BranchI3D
LEFT OUTER JOIN dbo.ReceiptUserState userState ON userState.I3D = o.ReceiptUserStateI3D
INNER JOIN 
(
	SELECT o.I3D, 
		SUM(oi.Quantity) AS Quantity,
		SUM(oi.ConsignmentQuantity) AS ConsignmentQuantity,
		SUM(IIF(oi.OpenQuantity < 0,0,oi.OpenQuantity)) AS OpenQuantity,
		MIN
		(
			IIF(IIF(oi.OpenQuantity < 0,0,oi.OpenQuantity) - ISNULL(ac.cnt,0) + ISNULL(kms.cnt,0) <= 0, 1, 0)
		) AS IsReadyForConsignment
	FROM dbo.Orders o
	INNER JOIN 
	(
		SELECT oi.ReceiptI3D, oi.ArticleI3D, oi.WarehouseI3D,
			CAST(SUM(oi.QuantityComplete - ISNULL(oi.QuantityProcessed,0)) AS DECIMAL(19,7)) AS Quantity,
			CAST(SUM(ISNULL(con.ConsignmentQuantity,0)) AS DECIMAL(19,7)) AS ConsignmentQuantity,
			CAST(SUM(oi.QuantityComplete - ISNULL(oi.QuantityProcessed,0) - CAST(ISNULL(con.ConsignmentQuantity,0) AS DECIMAL(19,7))) AS DECIMAL(19,7)) AS OpenQuantity
		FROM dbo.OrderItems oi
		INNER JOIN dbo.ARTIK a ON a.I3D = oi.ArticleI3D
		INNER JOIN dbo.Orders o ON o.I3D = oi.ReceiptI3D
		LEFT OUTER JOIN dbo.cvw_ConsignmentArticleQuantity con ON con.OrderPosI3D = oi.I3D
		WHERE o.State = 1
		AND oi.Kind = 1
		AND ISNULL(a.Kommisionieren,0) <> 0
		GROUP BY oi.ReceiptI3D, oi.ArticleI3D, oi.WarehouseI3D
	) oi ON oi.ReceiptI3D = o.I3D
	LEFT OUTER JOIN 
	(
		SELECT CAST(SUM(ConsignmentQuantity) AS DECIMAL(19,7)) cnt, cq.ArticleI3D, ap.WarehouseI3D
		FROM cvw_ConsignmentArticleQuantity cq
		INNER JOIN OrderItems ap ON ap.i3d = cq.OrderPosI3D
		group by cq.ArticleI3D,ap.WarehouseI3D
	) kms ON kms.ArticleI3D = oi.ArticleI3D AND kms.WarehouseI3D = oi.WarehouseI3D
	LEFT OUTER JOIN dbo.cvw_ArticleCount ac ON ac.ArtikelI3D = oi.ArticleI3D AND ac.LagerI3D = oi.WarehouseI3D
	WHERE o.State = 1
	AND oi.Quantity > 0
	GROUP BY o.I3D
) oDetails ON oDetails.I3D = o.I3D
WHERE o.State = 1
GO
/****** Object:  View [dbo].[AssetToContract]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

      CREATE VIEW [dbo].[AssetToContract]
AS
SELECT vz.I3D,
	   vz.VertragI3D ContractI3D,
	   vz.RechKopfI3D  AssetI3D,
	   vz.BerechnungszeitraumVon CalculatedFrom,
	   vz.BerechnungszeitraumBis CalculatedTo,
	   IsNull(vz.AnlageArt,4) AssetKind,
	   IsNull(vz.NachBerechnung,0) Recalculation,
	   vz.Status State	 
FROM VertragRechKopfZuordnung vz
WHERE IsNull(vz.Zwischenrechnung,0) != 3
AND RechKopfI3D > 0  
AND vz.Status = 1

      
GO
/****** Object:  View [dbo].[cvw_OrderPicking]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_OrderPicking] AS 
SELECT 
 CASE WHEN a.BarcodeScanen = 1 AND s.Wert = 1 THEN ISNULL(bc.cnt,0) ELSE ISNULL(ap.Kommisioniert,0) END cnt 
 ,ap.I3D AufPosI3D, ap.ArtikelI3D 
FROM AufPos ap 
INNER JOIN AufKopf ak ON ak.I3D = ap.AufKopfI3D AND ak.Status = 1 
INNER JOIN ARTIK a ON a.i3d = ap.ArtikelI3D 
INNER JOIN Stammdat s ON s.I3D = 1490 
LEFT OUTER JOIN  
		(select count(*) cnt, b.AufPosI3D   from barcode b 
		where b.Status = 2 group by  b.AufPosI3D) bc 
   ON bc.AufPosI3D = ap.I3D
GO
/****** Object:  Table [dbo].[Lagerort]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Lagerort](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kurzbezeichnung] [varchar](255) NULL,
	[Bezeichnung] [varchar](300) NULL,
	[NebenlagerI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Lagerort] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Lagerplatz]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Lagerplatz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LagerortI3D] [int] NULL,
	[Kurzbezeichnung] [varchar](255) NULL,
	[Bezeichnung] [varchar](300) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Lagerplatz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_CommissionOrderItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_CommissionOrderItems]
AS
SELECT oi.I3D, oi.ReceiptI3D, oi.InternalPosition, oi.Text, oi.ArticleI3D, oi.ArticleCode, oi.ManufacturerCode, 
	CAST(oi.QuantityComplete - ISNULL(oi.QuantityProcessed,0) AS DECIMAL(19,7)) AS Quantity, oi.QuantityComplete,
	CAST(ISNULL(con.ConsignmentQuantity,0) AS DECIMAL(19,7)) AS ConsignmentQuantity, 
	CAST(ISNULL(ac.cnt,0) - ISNULL(kms.cnt,0) AS DECIMAL(19,7)) AS AvailableStock,
	ISNULL(a.BarcodeScanen,0) AS ScanBarcodes,
	oi.DeliveryDate,
	ISNULL(alo.Kurzbezeichnung, nlo.Kurzbezeichnung) AS StorageLocation,
    ISNULL(alp.Kurzbezeichnung, nlp.Kurzbezeichnung) AS StoragePlace,
	oi.Expanded, oi.Indent, a.SNStueckliste AS IsBarcodePartList,
	oi.WarehouseI3D, w.Caption AS WarehouseCaption,
	CAST(IIF(oi.Kind = 1 AND ISNULL(a.Kommisionieren,0) <> 0, 1, 0) AS BIT) AS IsCommissionArticle,
	oi.InternalNote
FROM dbo.OrderItems oi
INNER JOIN dbo.Orders o ON o.I3D = oi.ReceiptI3D
LEFT OUTER JOIN dbo.ARTIK a ON a.I3D = oi.ArticleI3D
LEFT OUTER JOIN dbo.cvw_ConsignmentArticleQuantity con ON con.OrderPosI3D = oi.I3D
LEFT OUTER JOIN dbo.cvw_ArticleCount ac ON ac.ArtikelI3D = oi.ArticleI3D AND ac.LagerI3D = oi.WarehouseI3D
LEFT OUTER JOIN 
(
	SELECT SUM(ConsignmentQuantity) cnt, cq.ArticleI3D, ap.WarehouseI3D
	FROM cvw_ConsignmentArticleQuantity cq
	INNER JOIN OrderItems ap ON ap.i3d = cq.OrderPosI3D
	group by cq.ArticleI3D,ap.WarehouseI3D
) kms ON kms.ArticleI3D = oi.ArticleI3D AND kms.WarehouseI3D = oi.WarehouseI3D
LEFT OUTER JOIN dbo.NebenlagerArtikel na ON na.ArtikelI3D = oi.ArticleI3D AND na.NebenlagerI3D = oi.WarehouseI3D
LEFT OUTER JOIN dbo.LagerOrt nlo ON NLO.I3D = na.LagerOrtI3D
LEFT OUTER JOIN dbo.LagerPlatz nlp ON NLP.I3D = na.LagerPlatzI3D
LEFT OUTER JOIN dbo.LagerOrt alo ON ALO.I3D = a.LagerOrtI3D
LEFT OUTER JOIN dbo.LagerPlatz alp ON ALP.I3D = a.LagerPlatzI3D
LEFT OUTER JOIN dbo.Warehouses w ON w.I3D = oi.WarehouseI3D
WHERE o.State = 1
GO
/****** Object:  Table [dbo].[Intake]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Intake](
	[BookingID] [int] NOT NULL,
	[Booked] [numeric](14, 4) NULL,
	[BookedCalc] [numeric](14, 4) NULL,
	[InDelivery] [numeric](14, 4) NULL,
	[InStock] [numeric](14, 4) NULL,
	[Intake]  AS ([BookedCalc]-isnull([InStock],(0))),
 CONSTRAINT [PK_Intake] PRIMARY KEY CLUSTERED 
(
	[BookingID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[Intake2]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE VIEW [dbo].[Intake2] as
          SELECT i.BookingID, i.Booked, i.BookedCalc, i.InDelivery, i.Instock,2 Kind, bp.EKAusAufPosI3D SourceI3D, i.Intake
          FROM Intake i
          INNER JOIN BestPos2 bp ON i.BookingID = bp.i3d
          WHERE IsNull(bp.EKAusAufPosI3D,0) > 0

          UNION ALL 

        SELECT i.BookingID, i.Booked, i.BookedCalc,i.InDelivery, i.Instock,154, bp.NebenlagerI3D, i.Intake
        FROM Intake i
        INNER JOIN BestPos2 bp ON i.BookingID = bp.i3d
        WHERE IsNull(bp.EKAusAufPosI3D,0) = 0
      
GO
/****** Object:  View [dbo].[cvw_ConsignmentOrder]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ConsignmentOrder]
AS
SELECT        K.I3D, K.Status, K.Version, K.Nummer AS Number, K.KurzZeich AS EditorShortSign, K.Datum AS DATE, K.Bereitstellung AS ProvisionDate, K.KundenID AS CustomerI3D, Ku.Name AS CustomerName, 
                         K.Empfanger AS Receiver, K.LiefKundEmpfaenger AS DeliveryReceiver, K.LockUser AS LockedByEmployeeShortSign, CASE WHEN ISNULL(K.Teillieferung, 0) 
                         = 1 THEN K.Teillieferung ELSE 0 END AS IsPartDelivery, CASE WHEN ISNULL(K.Direktlieferung, 0) = 1 THEN K.Direktlieferung ELSE 0 END AS IsDirectDelivery, CASE WHEN SUM(ISNULL(P.Kommisioniert, 0)) 
                         < SUM(ISNULL(P.Stk, 0)) THEN 0 ELSE 1 END AS ConsignmentCompleted
FROM            dbo.AufKopf AS K INNER JOIN
                         dbo.AufPos AS P ON P.AufKopfI3D = K.I3D INNER JOIN
                         dbo.Kunden AS Ku ON Ku.I3D = K.KundenID INNER JOIN
                         dbo.ARTIK AS A ON A.I3D = P.ArtikelI3D
WHERE        (A.Kommisionieren = 1) AND (A.Warengruppe <>
                             (SELECT        Wert
                               FROM            dbo.Stammdat
                               WHERE        (I3D = 421)))
GROUP BY K.I3D, K.Status, K.Version, K.Nummer, K.KurzZeich, K.Datum, K.Bereitstellung, K.KundenID, Ku.Name, K.Empfanger, K.LiefKundEmpfaenger, K.LockUser, K.Teillieferung, K.Direktlieferung
      
GO
/****** Object:  View [dbo].[cvw_ConsignmentOrderPosition]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ConsignmentOrderPosition]
AS
SELECT        ISNULL(ALO.Kurzbezeichnung, NLO.Kurzbezeichnung) AS StorageLocation, ISNULL(ALP.Kurzbezeichnung, NLP.Kurzbezeichnung) AS StoragePlace, P.I3D, P.Pos AS Position, P.Code AS Articlecode, P.Text, 
                         ISNULL(P.Stk, 0) - ISNULL(P.Liefermenge, 0) AS Quantity, ISNULL(P.Kommisioniert, 0) AS QuantityPrepared, ISNULL(CASE WHEN A.BarcodeScanen = 1 THEN dbo.cfn_BarcodeCount(A.I3D, - 1) ELSE A.Menge END, 
                         0) AS MainStorageStockQuantity, ISNULL(A.BarcodeScanen, 0) AS IsBarcodeMandatory, P.ArtikelI3D AS ArticleI3D, P.NebenlagerI3D AS SecondaryStockI3D, ISNULL(P.Stk, 0) - ISNULL(P.Kommisioniert, 0) 
                         AS QuantityToPrepare, ISNULL(P.Stk, 0) AS OriginalQuantity, ISNULL(P.SNStueckliste, 0) AS IsSerialNumberPartList, P.SNStuecklistePos AS SerialNumberPartListPosition, 
                         ISNULL(CASE WHEN A.BarcodeScanen = 1 THEN dbo.cfn_BarcodeCount(A.I3D, NLA.NebenlagerI3D) ELSE NLA.Bestand END, 0) AS SecondaryStorageStockQuantity, P.Expanded, ISNULL(P.Indent, 0) 
                         AS PositionIndent, P.Visible, P.AufKopfI3D AS OrderHeadI3D, P.Lieferdatum AS DeliveryDate
FROM            dbo.AufPos AS P INNER JOIN
                         dbo.ARTIK AS A ON P.ArtikelI3D = A.I3D LEFT OUTER JOIN
                         dbo.NebenlagerArtikel AS NLA ON NLA.NebenlagerI3D = P.NebenlagerI3D AND NLA.ArtikelI3D = P.ArtikelI3D LEFT OUTER JOIN
                         dbo.NebenlagerArtikel AS NL ON NL.NebenlagerI3D = P.NebenlagerI3D AND NL.ArtikelI3D = P.ArtikelI3D AND P.NebenlagerI3D > 0 LEFT OUTER JOIN
                         dbo.ARTIK AS AL ON P.ArtikelI3D = AL.I3D AND AL.Kommisionieren <> 0 AND ISNULL(P.NebenlagerI3D, - 1) <= 0 LEFT OUTER JOIN
                         dbo.Lagerort AS NLO ON NLO.I3D = NL.LagerortI3D LEFT OUTER JOIN
                         dbo.Lagerplatz AS NLP ON NLP.I3D = NL.LagerplatzI3D LEFT OUTER JOIN
                         dbo.Lagerort AS ALO ON ALO.I3D = AL.LagerortI3D LEFT OUTER JOIN
                         dbo.Lagerplatz AS ALP ON ALP.I3D = AL.LagerplatzI3D
WHERE        (P.Art = 1) AND (A.Kommisionieren <> 0)
      
GO
/****** Object:  View [dbo].[cvw_TicketEditors]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_TicketEditors]
AS
SELECT hb.I3D
	,hb.RequestI3D AS TicketI3D
	,hr.Nummer AS TicketNumber
	,hb.PersonalI3D AS EmployeeI3D
	,p.Vorname AS EmployeeFirstName
	,p.Name AS EmployeeLastName
	,p.KurzZeich AS EmployeeShortSign
	,ISNULL(p.Vorname, '') + ' ' + p.NAME + ' (' + p.KurzZeich + ')' AS EmployeeFullName
	,p.EMail AS EmployeeEMail
	,hb.PersonalTyp AS EmployeeType
	,hb.ToDoI3D AS TodoI3D
	,hb.IsAccepted
FROM dbo.hlpdsk_request_bearbeiter AS hb
INNER JOIN dbo.hlpdsk_requests AS hr ON hr.I3D = hb.RequestI3D
INNER JOIN dbo.Personal AS p ON p.I3D = hb.PersonalI3D
GO
/****** Object:  Table [dbo].[ArticleProductionStep]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleProductionStep](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[ArticleI3D] [int] NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[DurationInMinutes] [int] NOT NULL,
	[SortOrder] [decimal](9, 6) NOT NULL,
	[MachineKindI3D] [int] NOT NULL,
	[RequiredAmount] [int] NOT NULL,
	[ProductionMachineKindStepI3D] [int] NULL,
 CONSTRAINT [PK_ArticleProductionStep] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleProductionOrders]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleProductionOrders](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[ProducedArticleI3D] [int] NOT NULL,
	[RelatedOrderItemI3D] [int] NULL,
	[ParentArticleProductionOrderI3D] [int] NULL,
	[PlannedStartDate] [datetime2](0) NOT NULL,
	[PlannedFinishDate] [datetime2](0) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedVersion] [nvarchar](20) NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedVersion] [nvarchar](20) NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
	[Comment] [nvarchar](4000) NULL,
 CONSTRAINT [PK_ArticleProductionOrders] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleProductionOrderStepItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleProductionOrderStepItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleProductionOrderI3D] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[State] [int] NOT NULL,
	[ArticleProductionStepI3D] [int] NOT NULL,
	[SortOrder] [decimal](9, 6) NOT NULL,
	[MachineI3D] [int] NULL,
	[RequiredAmount] [int] NOT NULL,
	[ProducedAmount] [int] NOT NULL,
	[Comment] [nvarchar](4000) NULL,
 CONSTRAINT [PK_ArticleProductionOrderStepItems] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_ArticleProductionOrderStepItems]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [CI_ArticleProductionOrderStepItems] ON [dbo].[ArticleProductionOrderStepItems]
(
	[ArticleProductionOrderI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_ArticleProductionOrderStepInfo]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_ArticleProductionOrderStepInfo] AS
	SELECT ITEM.I3D
	, ITEM.IsActive
	, ITEM.State	
	, ITEM.ArticleProductionOrderI3D	
	, ORD.ProducedArticleI3D
	, ORD.RelatedOrderItemI3D
	, ORD.PlannedStartDate
	, ORD.PlannedFinishDate
	, ITEM.ArticleProductionStepI3D
	, STEP.Description
	, STEP.DurationInMinutes
	, STEP.MachineKindI3D
	, STEP.ProductionMachineKindStepI3D
	, ITEM.MachineI3D
	, ITEM.RequiredAmount
	, ITEM.ProducedAmount
	, ITEM.Comment
	
FROM [dbo].[ArticleProductionOrderStepItems] AS ITEM
LEFT JOIN [dbo].[ArticleProductionOrders] ORD ON ITEM.ArticleProductionOrderI3D = ORD.I3D
LEFT JOIN [dbo].[ArticleProductionStep] STEP ON ITEM.ArticleProductionStepI3D = STEP.I3D
GO
/****** Object:  View [dbo].[cvw_InvoiceArticleStatistic]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_InvoiceArticleStatistic]
AS
SELECT IH.CustomerI3D
	,IP.ArticleI3D
	,A.Artikelcode AS ArticleCode
	,A.Artikelbeschreibung AS ArticleText
	,W.I3D AS MaterialGroupI3D
	,W.Bezeichnung AS MaterialGroupCaption
	,UW.I3D AS SubMaterialGroupI3D
	,UW.Text AS SubMaterialGroupCaption
	,SUM(ISNULL(IP.QuantityComplete, 0)) AS InvoiceQuantity
	,SUM(ISNULL(GP.Stk, 0)) AS CreditVoucherQuantity
	,SUM(IP.NetPriceTotalComplete) AS InvoiceNetAmount
	,SUM(CVP.NetPriceTotal) AS CreditVoucherNetAmount
	,MAX(IH.Date) AS LastInvoiceDate
FROM dbo.cvw_InvoiceHead AS IH
INNER JOIN dbo.cvw_InvoicePos AS IP ON IP.InvoiceHeadI3D = IH.I3D
LEFT OUTER JOIN dbo.GutPos AS GP ON GP.Ursprung = IP.I3D
	AND GP.UrsprungArt = 4
LEFT OUTER JOIN dbo.cvw_CreditVoucherPos CVP ON CVP.I3D = GP.I3D
INNER JOIN dbo.ARTIK AS A ON A.I3D = IP.ArticleI3D
INNER JOIN dbo.WAREN AS W ON W.Warengruppe = A.Warengruppe
LEFT OUTER JOIN dbo.UNTERWAREN AS UW ON UW.I3D = A.WEBKategorie
WHERE (IP.Kind IN (1,3))
	AND (ISNULL(IP.ArticlePositionKind, 0) IN (0,50))
	AND (IP.Expanded IS NULL)
GROUP BY IH.CustomerI3D
	,IP.ArticleI3D
	,A.Artikelcode
	,A.Artikelbeschreibung
	,W.I3D
	,W.Bezeichnung
	,UW.I3D
	,UW.Text
      
GO
/****** Object:  Table [dbo].[VertragKopfVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKopfVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Abrede] [text] NULL,
	[Anrede] [text] NULL,
	[Beginn] [datetime] NULL,
	[Berechnungsart] [int] NULL,
	[Ende] [datetime] NULL,
	[FremdvertragText] [varchar](1000) NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[AutoVerlaengerung] [int] NULL,
	[Fremdvertrag] [int] NULL,
	[Stammblattbezogen] [int] NULL,
	[Kuendigungsart] [int] NULL,
	[KuendigungsDatum] [datetime] NULL,
	[KuendigungsGrund] [text] NULL,
	[Laufzeit] [int] NULL,
	[LetzteRechnungDatum] [datetime] NULL,
	[Empfaenger] [varchar](500) NULL,
	[Datum] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[GeaendertVon] [nvarchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[LieferantenI3D] [int] NULL,
	[VertragsArtI3D] [int] NULL,
	[ZahlKondI3D] [int] NULL,
	[KuendigungsFristDauer1] [int] NULL,
	[KuendigungsFristArt1] [int] NULL,
	[KuendigungsFristDauer2] [int] NULL,
	[KuendigungsFristArt2] [int] NULL,
	[AbrechnungIntervallDauer] [int] NULL,
	[AbrechnungIntervallArt] [int] NULL,
	[AutoAbrechnung] [int] NULL,
	[LaufzeitArt] [int] NULL,
	[LaufzeitDauer] [int] NULL,
	[WartungIntervallArt] [int] NULL,
	[WartungIntervallDauer] [int] NULL,
	[Status] [int] NULL,
	[LieferbedingungI3D] [int] NULL,
	[Strasse] [varchar](300) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](300) NULL,
	[Zusatztext] [varchar](70) NULL,
	[BestNr] [varchar](50) NULL,
	[ProjNr] [varchar](50) NULL,
	[WartungIntervallArt2] [int] NULL,
	[WartungIntervallDauer2] [int] NULL,
	[Sammelrechnung] [int] NULL,
	[SNPflicht] [int] NULL,
	[RechKopfI3D] [int] NULL,
	[ReferenzNr] [varchar](255) NULL,
	[Wartung1ToDoI3D] [int] NULL,
	[Wartung2ToDoI3D] [int] NULL,
	[OriginalI3D] [int] NULL,
	[RechnungNormieren] [int] NULL,
	[LieferantName] [varchar](240) NULL,
	[LieferantAnsprech] [varchar](60) NULL,
	[LieferantTelefon] [varchar](30) NULL,
	[LieferantFax] [varchar](30) NULL,
	[LieferantEMail] [varchar](255) NULL,
	[LieferantVertragsNr] [varchar](100) NULL,
	[Wartung1Personal] [int] NULL,
	[Wartung2Personal] [int] NULL,
	[AbrechnungBeginn] [datetime] NULL,
	[Rahmenvertrag] [int] NULL,
	[RechEmpfaenger] [varchar](500) NULL,
	[ReaktionszeitArt1] [int] NULL,
	[ReaktionszeitDauer1] [int] NULL,
	[ReaktionszeitArt2] [int] NULL,
	[ReaktionszeitDauer2] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUser] [varchar](50) NULL,
	[Version] [int] NULL,
	[AussendienstID] [int] NULL,
	[ErstelltDurch] [int] NULL,
	[Verlaengerung] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[VollerBetragBeiNormierung] [int] NULL,
	[VertragsEndeToDoI3D] [int] NULL,
	[VertragsEndeToDoVorlauf] [int] NULL,
	[VertragsRechToDoI3D] [int] NULL,
	[VertragsRechToDoVorlauf] [int] NULL,
	[DocDirI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[ErstelltDatum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[Info] [varchar](8000) NULL,
	[InnendienstID] [int] NULL,
	[Kurzzeich] [nvarchar](50) NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[Ersteller] [varchar](50) NULL,
	[Bereitstellung] [datetime] NULL,
	[FertigungskonfI3D] [int] NULL,
	[Direktlieferung] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[Lieferdatum] [datetime] NULL,
	[LiefKundFremd] [int] NULL,
	[LSuREvVersand] [int] NULL,
	[RechKundFremd] [int] NULL,
	[Teillieferung] [int] NULL,
	[WVorlage] [datetime] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3d] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundInfo] [varchar](500) NULL,
	[InfoAnzeigen] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[AbwAbrechnungIntervallArt] [int] NULL,
	[AbwAbrechnungIntervallDauer] [int] NULL,
	[Ansprech] [varchar](128) NULL,
	[Brutto] [float] NULL,
	[Freikopien] [int] NULL,
	[Netto] [float] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[AnfangsKosten] [float] NULL,
	[KontingentVertrag] [int] NULL,
	[KontingentArt] [int] NULL,
	[KontingentWert] [float] NULL,
	[KontingentMindMenge] [float] NULL,
	[KontingentAusgleichArtikelI3D] [int] NULL,
	[AbwKontingentIntervallDauer] [int] NULL,
	[AbwKontingentIntervallArt] [int] NULL,
	[KontingentAusgleichsArtikelVerwenden] [int] NULL,
	[KontingentVerbrauchtStunden] [float] NULL,
	[KontingentVerbrauchtBetrag] [float] NULL,
	[KontingentUeberbuchung] [int] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[FilialgeberI3D] [int] NULL,
	[RestMitnehmen] [int] NULL,
	[Rabatt] [float] NULL,
	[KontingentAusglVerbrauchtStunden] [float] NULL,
	[KontingentAusglVerbrauchtBetrag] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[LetztesNachberechnungsDatum] [datetime] NULL,
	[KontingentRestWertStartDatum] [datetime] NULL,
	[KostenstellenI3D] [int] NULL,
	[AbschlussDatum] [datetime] NULL,
	[KontingentRestWertStart] [float] NULL,
	[ClickBerechnungsArt] [int] NULL,
	[VersandArt] [int] NULL,
	[Versandmail] [varchar](200) NULL,
	[AbwAnsprechI3D] [int] NULL,
	[KontingentUnterwarenGr] [varchar](200) NULL,
	[SLAPriorityI3D] [int] NULL,
	[IsPositionProvision] [bit] NULL,
	[SepaMandateI3D] [int] NULL,
	[isContingentLimitBilling] [bit] NULL,
	[ContingentLimitValue] [numeric](10, 4) NULL,
	[ContingentLimitKind] [int] NULL,
	[Name] [nvarchar](256) NULL,
	[WithStaffelPrice] [bit] NULL,
	[IsMonitoring] [bit] NULL,
	[MonitoringValue] [int] NULL,
	[CalcNeedKind] [int] NULL,
	[HourlySurchargeRateI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[ContingentBillingContractI3D] [int] NULL,
	[IsDisplayedOnWeb] [bit] NULL,
	[WebReportI3D] [int] NULL,
	[DeliveryConditionText] [nvarchar](1000) NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[IsHiddenInHelpdesk] [bit] NOT NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[ContractVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ContractVersions] AS
 SELECT A.I3D
	,A.Nummer AS Number
  ,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.Zusatztext AS AdditionalText
	,A.Version
	,ISNULL(A.Empfaenger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.ProjNr AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
	,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
	,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondI3D <= 0 THEN NULL ELSE A.ZahlKondI3D END AS PaymentConditionI3D
	,A.ZahlKond AS PaymentConditionText
	,CASE WHEN A.LieferbedingungI3D <= 0 THEN NULL ELSE A.LieferbedingungI3D END AS DeliveryConditionI3D
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,LTRIM(A.LiefKundInfo) AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,ISNULL(A.Teillieferung, 0) AS IsPartialDeliveryPossible
	,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
	,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
	,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
	,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
	,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
	,A.LizenznehmerKundInfo AS LicenseeAddressInformation
	,A.SepaMandateI3D AS MandatI3D
 	,A.GUI3D AS ConcurrencyControlGuid
	,A.VertragsArtI3D AS ContractKindI3D
	,A.AbrechnungIntervallDauer AS BillingIntervalDuration
	,A.AbrechnungIntervallArt AS BillingIntervalKind
	,A.AbwAbrechnungIntervallArt AS CounterIntervalKind
	,A.AbwAbrechnungIntervallDauer AS CounterIntervalDuration
	,ISNULL(A.ClickBerechnungsart,0) AS CounterBillingKind
	,A.Sammelrechnung AS CollectInvoice
	,A.AbrechnungBeginn AS FirstPaidDate
	,CASE WHEN A.Ende > 10 THEN A.Ende ELSE NULL END AS ContractEnd
	,CASE WHEN A.KuendigungsDatum > 10 THEN A.KuendigungsDatum ELSE NULL END AS ContractTermination
	,A.AutoAbrechnung AS AutomatedBilling
	,A.AutoAbrechnung AS CalculationKind
	,A.AutoVerlaengerung AS AutomatedProlongation
	,A.CalcNeedKind AS CalcNeedKind
	,ABS(A.Berechnungsart) AS BillingKind
	,ISNULL(A.Versandart, 0) AS SendKind
	,A.RechnungNormieren AS IsNormalize
	,ISNULL(A.VollerBetragBeiNormierung, 0) AS IsFullNormalizeAmount
	,A.Fremdvertrag AS ForeignContract
	,A.FremdvertragText AS ForeignContractText
	,A.ReferenzNr AS ReferenceNumber
	,CASE WHEN ISNULL(A.AbwAnsprechI3D, 0) <= 0 THEN NULL ELSE A.AbwAnsprechI3D END AS AlternativeMailRecipientI3D
	,A.Versandmail AS AlternativeMailCCRecipients
	,A.Beginn AS ContractBegin
	,A.RestMitnehmen AS TakeRest
	,A.KontingentUeberbuchung AS Overbooking
	,ISNULL(A.KontingentArt, 0) AS ContingentKind
	,CASE
     WHEN  A.Stammblattbezogen = 1 AND  A.KontingentVertrag = 1 THEN 3
     WHEN  A.Stammblattbezogen = 1 AND  A.KontingentVertrag = 0  THEN 1
     WHEN  A.Stammblattbezogen = 0 AND  A.KontingentVertrag = 1  THEN 2
	 ELSE 0 END AS ExtraKind
	,A.Name AS Name
	,A.VertragsRechToDoVorlauf AS ContractBillingToDoOffset 
	,A.Verlaengerung As Prolongation
	,A.KuendigungsFristArt1 AS TerminationDeadlineKind1  
	,A.KuendigungsFristArt2 AS TerminationDeadlineKind2  
	,A.KuendigungsFristDauer1 AS TerminationDeadlineDuration1 
	,A.KuendigungsFristDauer2 AS TerminationDeadlineDuration2 
	,A.Abrede AS Agreement
	,A.Anrede AS Salutation
	,A.Kuendigungsart AS TerminationKind
	,ISNULL(A.KuendigungsGrund, '') AS TerminationReason
	,A.Laufzeit AS Duration
	,A.LetzteRechnungDatum AS LastInvoiceDate
	,A.LieferantenI3D AS SupplierI3D
	,A.LaufzeitArt AS DurationKind
	,ISNULL(A.LaufzeitDauer, 0) AS DurationTIme
	,A.WartungIntervallArt AS MaintenanceIntervalKind
	,A.WartungIntervallArt2 AS MaintenanceIntervalKind2
	,ISNULL(A.WartungIntervallDauer, 0) AS MaintenanceDuration
	,ISNULL(A.WartungIntervallDauer2, 0) AS MaintenanceDuration2
	,ISNULL(A.SNPflicht, 0) AS IsSerialNumberRequiered
	,CASE WHEN A.RechKopfI3D <= 0 THEN NULL ELSE A.RechKopfI3D END AS InvoiceHeadI3D
	,CASE WHEN A.Wartung1ToDoI3D <= 0 THEN NULL ELSE A.Wartung1ToDoI3D END AS Maintenance1ToDoI3D
	,CASE WHEN A.Wartung2ToDoI3D <= 0 THEN NULL ELSE A.Wartung2ToDoI3D END AS Maintenance2ToDoI3D
	,ISNULL(A.LieferantName, '') AS SupplierName
	,ISNULL(A.LieferantAnsprech, '') AS SupplierContactPerson
	,ISNULL(A.LieferantTelefon, '') AS SupplierPhone
	,ISNULL(A.LieferantFax, '') AS SupplierFax
	,ISNULL(A.LieferantEMail, '') AS SupplierMail
	,ISNULL(A.LieferantVertragsNr, '') AS SupplierContractNumber
	,CASE WHEN A.Wartung1Personal <= 0 THEN NULL ELSE A.Wartung1Personal END AS Maintenance1Personal
	,CASE WHEN A.Wartung2Personal <= 0 THEN NULL ELSE A.Wartung2Personal END AS Maintenance2Personal
	,ISNULL(A.Rahmenvertrag, 0) AS IsBasicContract
	,ISNULL(A.RechEmpfaenger, '') AS InvoiceRecipient
	,A.ReaktionszeitArt1 AS ReactionTimeKind1
	,A.ReaktionszeitArt2 AS ReactionTimeKind2
	,ISNULL(A.ReaktionszeitDauer1, 0) AS ReactionTimeDuration1
	,ISNULL(A.ReaktionszeitDauer2, 0) AS ReactionTimeDuration2
	,CASE WHEN A.VertragsEndeToDoI3D <= 0 THEN NULL ELSE A.VertragsEndeToDoI3D END AS ContractEndToDoI3D
	,ISNULL(A.VertragsEndeToDoVorlauf, 0) AS ContractEndToDoOffset
	,CASE WHEN A.VertragsRechToDoI3D <= 0 THEN NULL ELSE A.VertragsRechToDoI3D END AS ContractBillingInvoiceToDoI3D
	,ISNULL(A.Direktlieferung, 0) AS IsDirectDeliveryPossible
	,ISNULL(A.Freikopien, 0) AS FreeCopies
	,CONVERT(DECIMAL(19,7), ISNULL(A.AnfangsKosten, 0)) AS StartingCosts
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentWert, 0)) AS ContingentValue
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentMindMenge, 0)) AS ContingentMinimalOrderAmount
	,CASE WHEN A.KontingentAusgleichArtikelI3D <= 0 THEN NULL ELSE A.KontingentAusgleichArtikelI3D END AS ContingentBalanceArticleI3D
	,CASE WHEN ISNULL(A.AbwKontingentIntervallDauer, 0) <= 0 THEN 0 ELSE A.AbwKontingentIntervallDauer END AS DeviationgContingentIntervalDuration
	,ISNULL(A.AbwKontingentIntervallArt, 0) AS DeviationContingentIntervallKind
	,ISNULL(A.KontingentAusgleichsArtikelVerwenden, 0) AS UseContingentBalanceArticle
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentVerbrauchtStunden, 0)) AS ContingentUsedHours
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentVerbrauchtBetrag, 0)) AS ContingentUsedAmount
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentAusglVerbrauchtStunden, 0)) AS ContingentBalanceUsedHours
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentAusglVerbrauchtBetrag , 0))AS ContingentBalanceUsedAmount
	,CONVERT(DECIMAL(19,7), ISNULL(A.SummeEKOriginal, 0)) AS OriginalNetPurchasePriceTotalComplete
	,CASE WHEN YEAR(ISNULL(A.LetztesNachberechnungsDatum, 0)) < 1905 THEN NULL ELSE A.LetztesNachberechnungsDatum END AS LastSubsequentBillingDate
	,CASE WHEN YEAR(ISNULL(A.KontingentRestWertStartDatum, 0)) < 1905 THEN NULL ELSE A.KontingentRestWertStartDatum END AS ContingentResidualValueStartDate
	,CASE WHEN YEAR(ISNULL(A.AbschlussDatum, 0)) < 1905 THEN NULL ELSE A.AbschlussDatum END AS FinishDate
	,CONVERT(DECIMAL(19,7), ISNULL(A.KontingentRestWertStart, 0)) AS ContingentResidualValueStart
	,ISNULL(A.KontingentUnterwarenGr, '') AS ContingentSubmaterialGroups
	,CASE WHEN ISNULL(A.SLAPriorityI3D, 0) <= 0 THEN NULL ELSE A.SLAPriorityI3D END AS SLAPriority
	,ISNULL(A.isContingentLimitBilling, 0) AS IsContingentLimitBilling
	,ISNULL(A.ContingentLimitValue, 0) AS ContingentLimitValue
	,A.ContingentLimitKind AS ContingentLimitKind
	,ISNULL(A.WithStaffelPrice, 0) AS WithStaffelPrice
	,ISNULL(A.IsMonitoring, 0) AS IsMonitoring
	,ISNULL(A.MonitoringValue, 0) AS MonitoringValue
	,A.OriginalI3D AS OriginalI3D
	,A.HourlySurchargeRateI3D
	,A.ReceiptUserStateI3D
	,A.ContingentBillingContractI3D
	,A.IsDisplayedOnWeb
	,A.WebReportI3D
	,A.DeliveryConditionText AS DeliveryConditionText
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
	,A.IsHiddenInHelpdesk
FROM dbo.VertragKopfVersions AS A
GO
/****** Object:  Table [dbo].[VertragPosVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragPosVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](8000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNr] [int] NULL,
	[GutAbholArt] [int] NULL,
	[GutAbholNr] [int] NULL,
	[numGutAbhol] [float] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[OriginalI3D] [int] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[StkStorno] [float] NULL,
	[SummeKalkStorno] [float] NULL,
	[VertragI3DAutoRechnung] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[StkStaffelpreis] [float] NULL,
	[VKKalkStaffelpreis] [float] NULL,
	[KopfVersionsI3D] [int] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Status] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[IsBillingPartList] [int] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[BillingDateFrom] [datetime2](0) NULL,
	[BillingDateTo] [datetime2](0) NULL,
	[MspEvaluationDecision] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[ContractItemVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ContractItemVersions] AS
SELECT
	VP.I3D
	,VP.KopfVersionsI3D AS ReceiptVersionI3D
	,VP.OriginalI3D
	,ISNULL(CASE WHEN VP.Art IN (2, 6) THEN VP.Freitext ELSE VP.Text END, '') AS Text
	,VP.Richtext AS RichText
	,VP.ArtikelI3D AS ArticleI3D
	,ISNULL(VP.Pos, 0) AS InternalPosition
	,ISNULL(VP.Indent, 0) AS Indent
	,ISNULL(VP.GrpID,0) AS GroupID
	,ABS(VP.Expanded) AS Expanded
	,CASE 
		WHEN A.HasWorkItems = 1 THEN 1 -- Article with workitems are always kind article, even when GeraeteKopfI3D is > 0
		WHEN ISNULL(VP.GeraeteKopfI3D, 0) > 0 THEN 7 
		ELSE ISNULL(VP.Art, 0) END AS Kind	
	,ISNULL(VP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN VP.MwstI3d <= 0 THEN NULL ELSE VP.MwstI3d END AS VATI3D
	,ISNULL(VP.VertragKopfI3D, 0) AS ReceiptI3D
	,CONVERT(DECIMAL(19,7), ISNULL(VP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(VP.numGutAbhol, 0)) AS QuantityProcessed
	,VP.ErloesKTO AS RevenueAccount
	,VP.Abbuchung AS ChangeStock
	,VP.VKBasisWert AS BasePrice
	,VP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), VP.Rabatt) AS Discount
	,CASE WHEN VP.SondervereinbarungI3D <= 0 THEN NULL ELSE VP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(VP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN VP.Kostenstelle <= 0 THEN NULL ELSE VP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN VP.Kostentraeger <= 0 THEN NULL ELSE VP.Kostentraeger END AS CostObjectI3D
	,ISNULL(VP.Visible, 1) AS Visible
	,VP.FontStyle
	,VP.FontSize
	,VP.FontName
	,VP.FontColor
	,VP.EANCode AS EANCode
	,0 AS ShowImage
	,CONVERT(DECIMAL(19,7), ISNULL(VP.UrsprungEK, 0)) AS OriginalPurchasePrice
	,CASE WHEN ISNULL(VP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE VP.NebenlagerI3D END AS WarehouseI3D
	,VP.WEEE AS WEEE 
	,'' AS PurchaseInformations
	,VP.Kundenkostenstelle AS CustomerCostCenter
	,VertragI3D AS ContractI3D
	,VP.BestellNr AS PurchaseOrderNumber
	,ISNULL(VP.IsBillingPartList, 0) AS IsBillingPartList
	,VP.Ursprung AS OriginReceiptItemI3D
	,VP.UrsprungI3D AS OriginReceiptI3D
	,VP.UrsprungArt AS OriginKind
	,CASE WHEN ISNULL(VP.Lieferdatum, 0) < 1905 THEN NULL ELSE VP.Lieferdatum END AS DeliveryDate
	,CASE WHEN ISNULL(VP.Benachrichtigungsdatum, 0) < 1905 THEN NULL ELSE VP.Benachrichtigungsdatum END AS NotificationDate
	,ISNULL(VP.Status, 0) AS State
	,VP.UniqAusgleichsArtikelID AS BalanceID
	,VP.GeraeteKopfI3D MasterDataListI3D
	,VP.Code AS ArticleCode
	,VP.HerstCode AS ManufacturerCode
	,VP.EKGrund AS ReasonForCustomPurchasePrice
	,VP.BillingDateFrom
	,VP.BillingDateTo
	,VP.MspEvaluationDecision
FROM dbo.VertragPosVersions AS VP
LEFT OUTER JOIN ARTIK A ON A.I3D = VP.ArtikelI3D
GO
/****** Object:  View [dbo].[cvw_BookKeepingReceiptItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_BookKeepingReceiptItems]
AS
SELECT	IP.I3D, 1 AS Type, IP.InternalPosition AS Position, IP.HeadI3D, 
    CASE WHEN YEAR(RP.Lieferdatum) < 1905 THEN NULL ELSE RP.Lieferdatum END AS DeliveryDate,
        RP.Code AS Articlecode, ISNULL(RP.EANCode,'') AS EANCode, ISNULL(RP.HerstCode,'') AS ManufacturerCode, IP.Text, RP.ErloesKTO AS ProfitAndLossAccount, 
    CASE WHEN L.I3D <> RK.LandI3D THEN 
      CASE WHEN LR.EUMitglied = 1 THEN
        ISNULL(CASE WHEN ISNULL(AB.EUAufwandKTO,0) = 0 THEN NULL ELSE AB.EUAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(UWB.EUAufwandKTO,0) = 0 THEN NULL ELSE UWB.EUAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(WB.EUAufwandKTO,0) = 0 THEN NULL ELSE WB.EUAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(A.EUAufwandKTO,0) = 0 THEN NULL ELSE A.EUAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(UW.EUAufwandKTO,0) = 0 THEN NULL ELSE UW.EUAufwandKTO END, 
        W.EUAufwandKTO))))) 
      ELSE
        ISNULL(CASE WHEN ISNULL(AB.AuslandAufwandKTO,0) = 0 THEN NULL ELSE AB.AuslandAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(UWB.AuslandAufwandKTO,0) = 0 THEN NULL ELSE UWB.AuslandAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(WB.AuslandAufwandKTO,0) = 0 THEN NULL ELSE WB.AuslandAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(A.AuslandAufwandKTO,0) = 0 THEN NULL ELSE A.AuslandAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(UW.AuslandAufwandKTO,0) = 0 THEN NULL ELSE UW.AuslandAufwandKTO END, 
        W.AuslandAufwandKTO)))))
      END
    ELSE 
      ISNULL(CASE WHEN ISNULL(AB.AufwandKTO,0) = 0 THEN NULL ELSE AB.AufwandKTO END, 
      ISNULL(CASE WHEN ISNULL(UWB.AufwandKTO,0) = 0 THEN NULL ELSE UWB.AufwandKTO END, 
      ISNULL(CASE WHEN ISNULL(WB.AufwandKTO,0) = 0 THEN NULL ELSE WB.AufwandKTO END, 
      ISNULL(CASE WHEN ISNULL(A.AufwandKTO,0) = 0 THEN NULL ELSE A.AufwandKTO END, 
      ISNULL(CASE WHEN ISNULL(UW.AufwandKTO,0) = 0 THEN NULL ELSE UW.AufwandKTO END, 
      W.AufwandKTO)))))
    END AS LossAccount,
    WH.BookKeepingAccount AS StorageValueAccount, KST.Nummer AS CostCentreNumber, KST.Beschreibung AS CostCentreName,
    KTR.Nummer AS CostUnitNumber, KTR.Beschreibung AS CostUnitName,
	MS1.Steuerkennziffer AS VATCode,
	RP.MwstSatz AS TaxRate,
	MS1.ErloesKTO AS TaxAccount,
    CASE WHEN YEAR(MS1.GueltigAb) < 1905 THEN NULL ELSE MS1.GueltigAb END AS TaxValidFrom,
    IP.Discount, ISNULL(IH.ExclusiveOfVAT,0) AS ExclusiveOfVAT, IP.QuantityComplete,
    ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 4, RP.I3D, RP.Art, RP.Expanded, 9), IP.NetPrice) AS NetPrice, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 4, RP.I3D, RP.Art, RP.Expanded, 11), IP.NetPriceFC) AS NetPriceFC, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 4, RP.I3D, RP.Art, RP.Expanded, 5), IP.NetPriceTotalComplete) AS NetPriceTotalComplete, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 4, RP.I3D, RP.Art, RP.Expanded, 7), IP.NetPriceTotalFCComplete) AS NetPriceTotalFCComplete,
    ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 4, RP.I3D, RP.Art, RP.Expanded, 10), IP.TaxPrice) AS TaxPrice, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 4, RP.I3D, RP.Art, RP.Expanded, 12), IP.TaxPriceFC) AS TaxPriceFC, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 4, RP.I3D, RP.Art, RP.Expanded, 6), IP.TaxPriceTotalComplete) AS TaxPriceTotalComplete, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 4, RP.I3D, RP.Art, RP.Expanded, 8), IP.TaxPriceTotalFCComplete) AS TaxPriceTotalFCComplete,
    IP.NetPurchasePrice, IP.NetPurchasePriceFC, IP.NetPurchasePriceTotalComplete, IP.NetPurchasePriceTotalFCComplete,
    CONVERT(bit, CASE WHEN ISNULL(A.Abbuchung, 'N') = 'J' THEN 1 ELSE 0 END) AS IsStorageArticle,
	IP.Expanded, IP.Indent, RP.UrsprungNr AS OriginReceiptNumber, ISNULL(RP.UrsprungArt,0) AS OriginReceiptKind, ISNULL(UW.Text, W.Bezeichnung) AS MaterialGroupCaption, ISNULL(RP.Visible, 1) AS Visible,
	CAST(ISNULL(CASE WHEN UW.I3D IS NULL THEN W.NeedsCustomClearance ELSE UW.NeedsCustomClearance END,0) AS BIT) AS NeedsCustomClearance
FROM dbo.RechPos RP
INNER JOIN dbo.cvw_InvoicePos IP ON IP.I3D = RP.I3D
INNER JOIN dbo.cvw_InvoiceHead IH ON IH.I3D = IP.HeadI3D
INNER JOIN dbo.RechKopf RK ON RK.I3D = IP.HeadI3D
LEFT OUTER JOIN dbo.Artik A ON A.I3D = RP.ArtikelI3D
LEFT OUTER JOIN dbo.ArtikelBranchErloeskonto AB ON AB.ArtikelI3D = A.I3D AND AB.BranchI3D = IH.BranchI3D
INNER JOIN dbo.WAREN W ON W.Warengruppe = A.Warengruppe
LEFT OUTER JOIN dbo.WarenFilialeErloeskonto WB ON WB.WarengruppeI3D = W.I3D AND WB.BranchI3D = IH.BranchI3D
LEFT OUTER JOIN dbo.UNTERWAREN UW ON UW.I3D = A.WEBKategorie
LEFT OUTER JOIN dbo.UnterwarenFilialeErloeskonto UWB ON UWB.UnterwarengruppeI3D = UW.I3D AND UWB.BranchI3D = IH.BranchI3D
LEFT OUTER JOIN dbo.Kostenstellen KST ON KST.I3D = RP.Kostenstelle
LEFT OUTER JOIN dbo.Kostentraeger KTR ON KTR.I3D = RP.Kostentraeger
LEFT OUTER JOIN dbo.MwstSatz MS1 ON MS1.I3D = RP.MwstI3D
LEFT OUTER JOIN dbo.Warehouses WH ON WH.I3D = CASE WHEN ISNULL(RP.NebenlagerI3D,0) <= 0 THEN -1 ELSE RP.NebenlagerI3D END
LEFT OUTER JOIN dbo.Laenkenn L ON L.Standard = 1
LEFT OUTER JOIN dbo.Laenkenn LR ON LR.I3D = RK.LandI3D
WHERE ISNULL(IP.Kind, 0) IN (1, 3)

UNION ALL

SELECT	IP.I3D, 2 AS Type, IP.InternalPosition AS Position, IP.HeadI3D, 
    CASE WHEN YEAR(RP.Lieferdatum) < 1905 THEN NULL ELSE RP.Lieferdatum END AS DeliveryDate,
        RP.Code AS Articlecode, ISNULL(RP.EANCode,'') AS EANCode, ISNULL(RP.HerstCode,'') AS ManufacturerCode, IP.Text, RP.ErloesKTO AS ProfitAndLossAccount,
    CASE WHEN L.I3D <> RK.LandI3D THEN 
      CASE WHEN LR.EUMitglied = 1 THEN
        ISNULL(CASE WHEN ISNULL(AB.EUAufwandKTO,0) = 0 THEN NULL ELSE AB.EUAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(UWB.EUAufwandKTO,0) = 0 THEN NULL ELSE UWB.EUAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(WB.EUAufwandKTO,0) = 0 THEN NULL ELSE WB.EUAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(A.EUAufwandKTO,0) = 0 THEN NULL ELSE A.EUAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(UW.EUAufwandKTO,0) = 0 THEN NULL ELSE UW.EUAufwandKTO END, 
        W.EUAufwandKTO))))) 
      ELSE
        ISNULL(CASE WHEN ISNULL(AB.AuslandAufwandKTO,0) = 0 THEN NULL ELSE AB.AuslandAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(UWB.AuslandAufwandKTO,0) = 0 THEN NULL ELSE UWB.AuslandAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(WB.AuslandAufwandKTO,0) = 0 THEN NULL ELSE WB.AuslandAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(A.AuslandAufwandKTO,0) = 0 THEN NULL ELSE A.AuslandAufwandKTO END, 
        ISNULL(CASE WHEN ISNULL(UW.AuslandAufwandKTO,0) = 0 THEN NULL ELSE UW.AuslandAufwandKTO END, 
        W.AuslandAufwandKTO)))))
      END
    ELSE 
      ISNULL(CASE WHEN ISNULL(AB.AufwandKTO,0) = 0 THEN NULL ELSE AB.AufwandKTO END, 
      ISNULL(CASE WHEN ISNULL(UWB.AufwandKTO,0) = 0 THEN NULL ELSE UWB.AufwandKTO END, 
      ISNULL(CASE WHEN ISNULL(WB.AufwandKTO,0) = 0 THEN NULL ELSE WB.AufwandKTO END, 
      ISNULL(CASE WHEN ISNULL(A.AufwandKTO,0) = 0 THEN NULL ELSE A.AufwandKTO END, 
      ISNULL(CASE WHEN ISNULL(UW.AufwandKTO,0) = 0 THEN NULL ELSE UW.AufwandKTO END, 
      W.AufwandKTO)))))
    END AS LossAccount,
    WH.BookKeepingAccount AS StorageValueAccount, KST.Nummer AS CostCentreNumber, KST.Beschreibung AS CostCentreName,
    KTR.Nummer AS CostUnitNumber, KTR.Beschreibung AS CostUnitName,
    MS1.Steuerkennziffer AS VATCode,
    RP.MwstSatz AS TaxRate,
	MS1.ErloesKTO AS TaxAccount,
	CASE WHEN YEAR(MS1.GueltigAb) < 1905 THEN NULL ELSE MS1.GueltigAb END AS TaxValidFrom,
    IP.Discount, ISNULL(IH.ExclusiveOfVAT,0) AS ExclusiveOfVAT, IP.QuantityComplete,
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 6, RP.I3D, RP.Art, RP.Expanded, 9), IP.NetPrice) AS NetPrice, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 6, RP.I3D, RP.Art, RP.Expanded, 11), IP.NetPriceFC) AS NetPriceFC, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 6, RP.I3D, RP.Art, RP.Expanded, 5), IP.NetPriceTotalComplete) AS NetPriceTotalComplete, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 6, RP.I3D, RP.Art, RP.Expanded, 7), IP.NetPriceTotalFCComplete) AS NetPriceTotalFCComplete,
    ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 6, RP.I3D, RP.Art, RP.Expanded, 10), IP.TaxPrice) AS TaxPrice, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 6, RP.I3D, RP.Art, RP.Expanded, 12), IP.TaxPriceFC) AS TaxPriceFC, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 6, RP.I3D, RP.Art, RP.Expanded, 6), IP.TaxPriceTotalComplete) AS TaxPriceTotalComplete, 
	ISNULL(dbo.cfn_CalculateReceiptSpecialPosition(RK.I3D, 6, RP.I3D, RP.Art, RP.Expanded, 8), IP.TaxPriceTotalFCComplete) AS TaxPriceTotalFCComplete,
    IP.NetPurchasePrice, IP.NetPurchasePriceFC, IP.NetPurchasePriceTotal, IP.NetPurchasePriceTotalFC,
    CONVERT(bit, CASE WHEN ISNULL(A.Abbuchung, 'N') = 'J' THEN 1 ELSE 0 END) AS IsStorageArticle,
	IP.Expanded, IP.Indent, RP.UrsprungNr AS OriginReceiptNumber, ISNULL(RP.UrsprungArt,0) AS OriginReceiptKind, ISNULL(UW.Text, W.Bezeichnung) AS MaterialGroupCaption, ISNULL(RP.Visible, 1) AS Visible,
	CAST(ISNULL(CASE WHEN UW.I3D IS NULL THEN W.NeedsCustomClearance ELSE UW.NeedsCustomClearance END,0) AS BIT) AS NeedsCustomClearance
FROM dbo.GutPos RP
INNER JOIN dbo.cvw_CreditVoucherPos IP ON IP.I3D = RP.I3D
INNER JOIN dbo.cvw_CreditVoucherHead IH ON IH.I3D = IP.HeadI3D
INNER JOIN dbo.GutKopf RK ON RK.I3D = IP.HeadI3D
LEFT OUTER JOIN dbo.Artik A ON A.I3D = RP.ArtikelI3D
LEFT OUTER JOIN dbo.ArtikelBranchErloeskonto AB ON AB.ArtikelI3D = A.I3D AND AB.BranchI3D = IH.BranchI3D
INNER JOIN dbo.WAREN W ON W.Warengruppe = A.Warengruppe
LEFT OUTER JOIN dbo.WarenFilialeErloeskonto WB ON WB.WarengruppeI3D = W.I3D AND WB.BranchI3D = IH.BranchI3D
LEFT OUTER JOIN dbo.UNTERWAREN UW ON UW.I3D = A.WEBKategorie
LEFT OUTER JOIN dbo.UnterwarenFilialeErloeskonto UWB ON UWB.UnterwarengruppeI3D = UW.I3D AND UWB.BranchI3D = IH.BranchI3D
LEFT OUTER JOIN dbo.Kostenstellen KST ON KST.I3D = RP.Kostenstelle
LEFT OUTER JOIN dbo.Kostentraeger KTR ON KTR.I3D = RP.Kostentraeger
LEFT OUTER JOIN dbo.MwstSatz MS1 ON MS1.I3D = RP.MwstI3D
LEFT OUTER JOIN dbo.Warehouses WH ON WH.I3D = CASE WHEN ISNULL(RP.NebenlagerI3D,0) <= 0 THEN -1 ELSE RP.NebenlagerI3D END
LEFT OUTER JOIN dbo.Laenkenn L ON L.Standard = 1
LEFT OUTER JOIN dbo.Laenkenn LR ON LR.I3D = RK.LandI3D
WHERE ISNULL(IP.Kind, 0) IN (1, 3)
  
UNION ALL

SELECT	IP.I3D, 3 AS Type, IP.InternalPosition AS Position, IP.HeadI3D, 
    CASE WHEN YEAR(ISNULL(deliveryHead.ExternalDeliveryListDate,0)) < 1905 THEN deliveryHead.Date ELSE deliveryHead.ExternalDeliveryListDate END AS DeliveryDate,
        RP.Artikelcode AS Articlecode, ISNULL(RP.EANCode,'') AS EANCode, ISNULL(RP.Herstellercode,'') AS ManufacturerCode, IP.Text, RP.AufwandKTO AS ProfitAndLossAccount, 
    RP.AufwandKTO AS LossAccount,
    WH.BookKeepingAccount AS StorageValueAccount, KST.Nummer AS CostCentreNumber, KST.Beschreibung AS CostCentreName,
    KTR.Nummer AS CostUnitNumber, KTR.Beschreibung AS CostUnitName,
	CASE WHEN RTRIM(ISNULL(MS1.SteuerKZEinkauf,'')) <> '' THEN MS1.SteuerKZEinkauf ELSE MS1.Steuerkennziffer END AS VATCode,
	RP.MwstSatz AS TaxRate,
	MS1.AufwandKTO AS TaxAccount,
	CASE WHEN YEAR(MS1.GueltigAb) < 1905 THEN NULL ELSE MS1.GueltigAb END AS TaxValidFrom,
    IP.Discount, ISNULL(IH.ExclusiveOfVAT,0) AS ExclusiveOfVAT, IP.QuantityComplete,
    ROUND(IP.NetPrice + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightNetPrice END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceNetPrice END, ISNULL(A.Nachkommastellen,2)) AS NetPrice, 
    ROUND(IP.NetPriceFC + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightNetPriceFC END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceNetPriceFC END, ISNULL(A.Nachkommastellen,2)) AS NetPriceFC,
    IP.NetPriceTotalComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightNetPriceTotalComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceNetPriceTotalComplete END AS NetPriceTotalComplete, 
    IP.NetPriceTotalFCComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightNetPriceTotalFCComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceNetPriceTotalFCComplete END AS NetPriceTotalFCComplete, 
    IP.TaxPrice + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightTaxPrice END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceTaxPrice END AS TaxPrice, 
    IP.TaxPriceFC +  CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightTaxPriceFC END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceTaxPriceFC END AS TaxPriceFC, 
    IP.TaxPriceTotalComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightTaxPriceTotalComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceTaxPriceTotalComplete END AS TaxPriceTotalComplete, 
    IP.TaxPriceTotalFCComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightTaxPriceTotalFCComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceTaxPriceTotalFCComplete END AS TaxPriceTotalFCComplete, 
    ROUND(IP.NetPrice + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightNetPrice END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceNetPrice END, ISNULL(A.Nachkommastellen,2)) AS NetPurchasePrice,
    ROUND(IP.NetPriceFC + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightNetPriceFC END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceNetPriceFC END, ISNULL(A.Nachkommastellen,2)) AS NetPurchasePriceFC,
    IP.NetPriceTotalComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightNetPriceTotalComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceNetPriceTotalComplete END AS NetPurchasePriceTotalComplete, 
    IP.NetPriceTotalFCComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IP.FreightNetPriceTotalFCComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IP.InsuranceNetPriceTotalFCComplete END AS NetPurchasePriceTotalFCComplete,
    CONVERT(bit, CASE WHEN ISNULL(A.Abbuchung, 'N') = 'J' THEN 1 ELSE 0 END) AS IsStorageArticle,
	IP.Expanded, IP.Indent, NULL AS OriginReceiptNumber, 0 AS OriginReceiptKind, ISNULL(UW.Text, W.Bezeichnung) AS MaterialGroupCaption, ISNULL(RP.Visible, 1) AS Visible,
	CAST(ISNULL(CASE WHEN UW.I3D IS NULL THEN W.NeedsCustomClearance ELSE UW.NeedsCustomClearance END,0) AS BIT) AS NeedsCustomClearance
FROM dbo.KalkPos RP
INNER JOIN dbo.cvw_SupplierInvoicePos IP ON IP.I3D = RP.I3D
INNER JOIN dbo.cvw_SupplierInvoiceHead IH ON IH.I3D = IP.HeadI3D
INNER JOIN dbo.KalkKopf RK ON RK.I3D = IP.HeadI3D
LEFT OUTER JOIN dbo.SupplierDeliveryListItems deliveryItems ON deliveryItems.I3D = RP.UebernommenAusI3D
LEFT OUTER JOIN dbo.SupplierDeliveryLists deliveryHead ON deliveryHead.I3D = deliveryItems.ReceiptI3D
LEFT OUTER JOIN dbo.Artik A ON A.I3D = RP.ArtikelI3D
INNER JOIN dbo.WAREN W ON W.Warengruppe = A.Warengruppe
LEFT OUTER JOIN dbo.UNTERWAREN UW ON UW.I3D = A.WEBKategorie
LEFT OUTER JOIN dbo.Kostenstellen KST ON KST.I3D = RP.Kostenstelle
LEFT OUTER JOIN dbo.Kostentraeger KTR ON KTR.I3D = RP.Kostentraeger
LEFT OUTER JOIN dbo.MwstSatz MS1 ON MS1.I3D = RP.MwstI3D
LEFT OUTER JOIN dbo.Warehouses WH ON WH.I3D = CASE WHEN ISNULL(RP.NebenlagerI3D,0) <= 0 THEN -1 ELSE RP.NebenlagerI3D END
WHERE ISNULL(IP.Kind, 0) IN (1, 3, 11, 12)

UNION ALL

SELECT	IP.I3D, 4 AS Type, IP.InternalPosition AS Position, IP.HeadI3D, 
    CASE WHEN YEAR(ISNULL(deliveryHead.ExternalDeliveryListDate,0)) < 1905 THEN deliveryHead.Date ELSE deliveryHead.ExternalDeliveryListDate END AS DeliveryDate,
        RP.Artikelcode AS Articlecode, ISNULL(RP.EANCode,'') AS EANCode, ISNULL(RP.Herstellercode,'') AS ManufacturerCode, IP.Text, RP.AufwandKTO AS ProfitAndLossAccount, 
    RP.AufwandKTO AS LossAccount,
    WH.BookKeepingAccount AS StorageValueAccount, KST.Nummer AS CostCentreNumber, KST.Beschreibung AS CostCentreName,
    KTR.Nummer AS CostUnitNumber, KTR.Beschreibung AS CostUnitName,
	CASE WHEN RTRIM(ISNULL(MS1.SteuerKZEinkauf,'')) <> '' THEN MS1.SteuerKZEinkauf ELSE MS1.Steuerkennziffer END AS VATCode,
	RP.MwstSatz AS TaxRate,
	MS1.AufwandKTO AS TaxAccount,
	CASE WHEN YEAR(MS1.GueltigAb) < 1905 THEN NULL ELSE MS1.GueltigAb END AS TaxValidFrom,
    IP.Discount, ISNULL(IH.ExclusiveOfVAT,0) AS ExclusiveOfVAT, IP.QuantityComplete,
    IP.NetPrice, IP.NetPriceFC, IP.NetPriceTotal AS NetPriceTotalComplete, 
    IP.NetPriceTotalFC AS NetPriceTotalFCComplete, 
    IP.TaxPrice, IP.TaxPriceFC, IP.TaxPriceTotal AS TaxPriceTotalComplete, IP.TaxPriceTotalFC AS TaxPriceTotalFCComplete,
    IP.NetPrice AS NetPurchasePrice, IP.NetPriceFC AS NetPurchasePriceFC,
    IP.NetPriceTotal AS NetPurchasePriceTotalComplete, IP.NetPriceTotalFC AS NetPurchasePriceTotalFCComplete,
    CONVERT(bit, CASE WHEN ISNULL(A.Abbuchung, 'N') = 'J' THEN 1 ELSE 0 END) AS IsStorageArticle,
	IP.Expanded, IP.Indent, NULL AS OriginReceiptNumber, 0 AS OriginReceiptKind, ISNULL(UW.Text, W.Bezeichnung) AS MaterialGroupCaption, ISNULL(RP.Visible, 1) AS Visible,
	CAST(ISNULL(CASE WHEN UW.I3D IS NULL THEN W.NeedsCustomClearance ELSE UW.NeedsCustomClearance END,0) AS BIT) AS NeedsCustomClearance
FROM dbo.LiGutPos RP
INNER JOIN dbo.cvw_SupplierCreditVoucherPos IP ON IP.I3D = RP.I3D
INNER JOIN dbo.cvw_SupplierCreditVoucherHead IH ON IH.I3D = IP.HeadI3D
INNER JOIN dbo.LiGutKopf RK ON RK.I3D = IP.HeadI3D
LEFT OUTER JOIN dbo.SupplierInvoiceItems invoiceItems ON invoiceItems.I3D = RP.UebernommenAusI3D
LEFT OUTER JOIN dbo.SupplierDeliveryListItems deliveryItems ON deliveryItems.I3D = invoiceItems.OriginReceiptItemI3D
LEFT OUTER JOIN dbo.SupplierDeliveryLists deliveryHead ON deliveryHead.I3D = deliveryItems.ReceiptI3D
LEFT OUTER JOIN dbo.Artik A ON A.I3D = RP.ArtikelI3D
INNER JOIN dbo.WAREN W ON W.Warengruppe = A.Warengruppe
LEFT OUTER JOIN dbo.UNTERWAREN UW ON UW.I3D = A.WEBKategorie
LEFT OUTER JOIN dbo.Kostenstellen KST ON KST.I3D = RP.Kostenstelle
LEFT OUTER JOIN dbo.Kostentraeger KTR ON KTR.I3D = RP.Kostentraeger
LEFT OUTER JOIN dbo.MwstSatz MS1 ON MS1.I3D = RP.MwstI3D
LEFT OUTER JOIN dbo.Warehouses WH ON WH.I3D = CASE WHEN ISNULL(RP.NebenlagerI3D,0) <= 0 THEN -1 ELSE RP.NebenlagerI3D END
WHERE ISNULL(IP.Kind, 0) IN (1, 3, 11, 12)
GO
/****** Object:  Table [dbo].[AngPosVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngPosVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AngKopfI3D] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[AufLiefRechNr] [int] NULL,
	[AufLiefRechArt] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[MWStI3D] [int] NULL,
	[LaenderI3D] [int] NULL,
	[MWStAktiv] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellPos] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[Import] [int] NULL,
	[MitBild] [int] NULL,
	[BSLaengeT] [float] NULL,
	[BSBreiteT] [float] NULL,
	[BSHoeheT] [float] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[VertragI3D] [int] NULL,
	[VertragArt] [int] NULL,
	[OriginalI3D] [int] NULL,
	[KopfVersionsI3D] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[OriginalStk] [float] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[BSLaengeE] [float] NULL,
	[BSBreiteE] [float] NULL,
	[BSHoeheE] [float] NULL,
	[OldAngKopfI3D] [varchar](10) NULL,
	[numBarcodes] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[RMAPosI3D] [int] NULL,
	[Status] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[HerstellerI3D] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[RundungsDiff] [float] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[IsBillingPartList] [int] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[isLeasing] [int] NULL,
	[isService] [int] NULL,
	[PurchasePriceSupplierI3D] [int] NULL,
	[InternalNote] [nvarchar](max) NULL,
	[PlannedDurationInHours] [decimal](19, 7) NOT NULL,
	[IsReverseCharge] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[OfferItemVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[OfferItemVersions] AS
SELECT AP.I3D
	,AP.OriginalI3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.AngKopfI3D, 0) AS ReceiptI3D
	,AP.KopfVersionsI3D AS ReceiptVersionI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,CASE WHEN AP.MitBild IN (1, 11) THEN 1 ELSE 0 END AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
	,AP.Bestellinformation AS PurchaseInformations
	,AP.WEEE AS WEEE
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,AP.PurchasePriceSupplierI3D AS PurchasePriceSupplierI3D
	,AP.InternalNote AS InternalNote
	,AP.PlannedDurationInHours AS PlannedDurationInHours
	,AP.IsReverseCharge
	,CAST(ISNULL(AP.isLeasing,0) AS BIT) AS IsLeasing
	,CAST(ISNULL(AP.isService,0) AS BIT) AS IsService
FROM dbo.AngPosVersions AS AP
GO
/****** Object:  Table [dbo].[LieferantenToFiliale]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LieferantenToFiliale](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LieferantI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[KdNrBeiLieferant] [varchar](20) NULL,
	[BuchhaltNr] [varchar](50) NULL,
	[RWUebergabe] [int] NULL,
	[RWPersonalI3D] [int] NULL,
	[RWDatum] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PORTRECH]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PORTRECH](
	[Rechnungsnummer] [int] NOT NULL,
	[Rechnungsdatum] [datetime] NULL,
	[Datum] [datetime] NULL,
	[Kundennummer] [float] NULL,
	[MandantenKredNr] [float] NULL,
	[PersonalI3D] [int] NULL,
	[PCName] [varchar](50) NULL,
	[PCIP] [varchar](50) NULL,
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnlageVersion] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[Art] [int] NULL,
	[AnlageI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PORTWARE]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PORTWARE](
	[Verwaltungs_Nr] [float] NULL,
	[LieferscheinDatum] [datetime] NULL,
	[Kreditor_Nr] [float] NULL,
	[Datum] [datetime] NULL,
	[MandantenKredNr] [float] NULL,
	[Verwaltungs_NrNew] [float] NULL,
	[Verwaltungs_NrKonv] [float] NULL,
	[PersonalI3D] [int] NULL,
	[PCName] [varchar](50) NULL,
	[PCIP] [varchar](50) NULL,
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnlageVersion] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[Art] [int] NULL,
	[AnlageI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerToBranches]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerToBranches](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerNumber] [int] NOT NULL,
	[BranchI3D] [int] NOT NULL,
	[BookKeepingNumber] [nvarchar](64) NOT NULL,
	[Exported] [bit] NOT NULL,
	[ExportedByI3D] [int] NULL,
	[ExportedDate] [datetime2](0) NULL,
 CONSTRAINT [PK_CustomerToBranches] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_BookKeepingReceipts]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_BookKeepingReceipts]
AS
SELECT  1 AS Type,
		IH.I3D,
		IH.Number,
		ISNULL(RK.Zusatztext,'') AS Caption,
		'' AS VariableTextField1,
		RK.ExternalInvoiceNumber AS ExternalReceiptNumber,
		RK.ExternalInvoiceDate AS ExternalReceiptDate,
		RK.FaelligAm AS DueDate,
		IH.Date,
		IH.Version,
		IIF(ISNULL(RK.FilialI3D,0) <= 0 OR ISNULL(Setting1.ValueBool,0) = 0 OR ISNULL(KB.BookKeepingNumber,'') = '',
		K.BuchhaltNr,
		KB.BookKeepingNumber) AS AddressBookKeepingNumber,
		IIF(ISNULL(RK.FilialI3D,0) <= 0 OR ISNULL(Setting1.ValueBool,0) = 0 OR ISNULL(KBAbwReAnschr.BookKeepingNumber,'') = '',
		KAbwReAnschr.BuchhaltNr,
		KBAbwReAnschr.BookKeepingNumber) AS BookKeepingNumberDifferentInvoiceAddress,
		K.SteuerNr AS TaxNumber,
		ZK.Zahlungstyp AS PaymentTypeNumber,
		ZK.Untdid4461,
		ZK.I3D AS PaymentConditionsI3D,
		ZK.Kurztext AS PaymentConditionsText,
		rk.ZahlKond AS PaymentConditionFull,
		K.I3D AS AddressNumber,
		ZK.FaelligPlusTage AS DuePlusDays,
		AC.OwnSupplierNumber,
		LK2.Land AS Country,
		ZK.LaenPer1 AS Skonto1OffDay,
		ZK.Skonto1 AS Skonto1Percent,
		P.KurzZeich AS LastChangedBy,
		ZK.LaenPer2 AS Skonto2OffDay,
		ZK.Skonto2 AS Skonto2Percent,
		ZK.LaenPer3 AS Skonto3OffDay,
		K.Name AS AddressName,
		A.Strasse AS AddressStreet,
		A.Postfach AS AddressPostOfficeBox,
		A.PLZ AS AddressZip,
		A.Ort AS AddressCity,
		RK.Tel AS ContactPhone,
		RK.Fax AS ContactTelefax,
		RK.Mail AS ContactEMail,
		K.KdWWW AS CustomerWebSite,
		ISNULL(IIF(RK.FIBUSammelkonto = '',NULL,RK.FIBUSammelkonto),
		K.FIBUSammelkonto) AS CollectiveAccount,
		IH.State,
		CONVERT(bit,CASE WHEN EXISTS(SELECT I3D FROM PORTRECH WHERE Art = 4 AND AnlageI3D = RK.I3D) THEN 1 ELSE 0 END) AS IsTransferred,
		IH.NetPriceComplete,
		IH.NetPriceFCComplete,
		IH.TaxPriceComplete,
		IH.TaxPriceFCComplete,
		IH.ExclusiveOfVAT,
		LK.RWZeichen AS CurrencyISOCode,
		IH.IsCashAsset,
		IH.CurrencyString,
		IH.CurrencyFactor,
		RK.ESRReferenznummer AS ESRCode,
		ZKL.I3D AS DeliveryConditionI3D,
		ZKL.Kurztext AS DeliveryConditionText,
		ISNULL(RK.EDIExport,0) AS IsExportedToEdi,
		LK2.Kurzzeichen AS CountryShortCode,
		RK.Trackingnummer AS TrackingNumber,
		RK.BestNr AS ExternalPurchaseOrderNumber,
		F.I3D AS BranchI3D,
		B.AuthorizationNumber AS SepaAuthorizationNumber,
		B.DirectDebitType AS SepaDirectDebitType,
		CAST(ISNULL(ZK.DTALastschrift,0) as bit) AS IsSepaActive,
		ISNULL(ZK.DTAAuswahl,0) AS SepaKind,
		CASE WHEN ISNULL(RK.Lieferdatum,0) < 2 THEN NULL ELSE RK.Lieferdatum END AS DeliveryDate,
        K.UmsaIdentNr AS SalesTaxIdentificationNumber,
		B.I3D AS BankAccountI3D,
        B.Kontonummer AS BankAccountNumber,
        B.BankverbNummer AS BankNumber,
		RK.Ansprech AS ContactName,
		RK.DocDirI3D AS DirectoryI3D,
		RK.LiefKundAnschriftI3D As DeliveryAdressI3D,
		RK.LiefKundPersonI3D AS DeliveryContactI3D,
		KA.Name AS DeliveryCustomerName,
		DA.Strasse AS DeliveryStreet,
		DA.Postfach AS DeliveryPostOfficeBox,
		DA.Plz AS DeliveryZip,
		DA.Ort AS DeliveryCity,
		DP.Tel1 AS DeliveryContactPhone,
		DP.Fax1 AS DeliveryContactTelefax,
		DP.Email1 AS DeliveryContactEMail,
		DP.AnsprechVorname AS DeliveryContactFirstName,
		DP.Ansprech AS DeliveryContactLastName,
		DPA.Anrede AS DeliveryContactSalutation,
		NULL AS CustomerNumberAtSupplier,
		COALESCE(b.IBAN,defaultBank.IBAN,'') AS IBAN,
		COALESCE(b.BIC,defaultBank.BIC,'') AS BIC,
		NULL as ReceiptLink,
		ACC.UseSettingsFromCompanyGroupForReceipts AS UseSettingsFromCompanyGroupForReceipts,
		IIF(ACC.UseSettingsFromCompanyGroupForReceipts = 1, KAbwReAnschr.Name, '') AS CompanyGroupName,
		CAST(IIF(IsNull(ZK.DatevExport,0) = 1, 1, 0) AS BIT) AS IsBookKeepingExportActive
FROM dbo.RechKopf RK
INNER JOIN dbo.cvw_InvoiceHead IH ON IH.I3D = RK.I3D
LEFT OUTER JOIN dbo.ApplicationSettings Setting1 ON Setting1.I3D = 10076
LEFT OUTER JOIN dbo.Kunden K ON K.I3D = RK.KundenID -- ON ((ISNULL(RK.RechKundFremd,0) = 0 OR ISNULL(RK.RechKundI3D,0) <= 0) AND K.I3D = RK.KundenID) OR (ISNULL(RK.RechKundFremd,0) = 1 AND K.I3D = RK.RechKundI3D)
LEFT OUTER JOIN dbo.CustomerToBranches KB ON KB.CustomerNumber = K.I3D AND KB.BranchI3D = RK.FilialI3D
LEFT OUTER JOIN dbo.Kunden KAbwReAnschr ON KAbwReAnschr.I3D = RK.RechKundI3D
LEFT OUTER JOIN dbo.CustomerToBranches KBAbwReAnschr ON KBAbwReAnschr.CustomerNumber = KAbwReAnschr.I3D AND KBAbwReAnschr.BranchI3D = ISNULL(RK.FilialI3D,0)
LEFT OUTER JOIN dbo.Anschrif A ON ((ISNULL(RK.RechKundFremd,0) = 0 OR ISNULL(RK.RechKundI3D,0) <= 0) AND A.I3D = RK.AnschriftID) OR (ISNULL(RK.RechKundFremd,0) = 1 AND A.I3D = RK.RechKundAnschriftI3D)
LEFT OUTER JOIN dbo.Anschrif DA ON DA.I3D = RK.LiefKundAnschriftI3D
LEFT OUTER JOIN dbo.Personen DP ON DP.I3D = RK.LiefKundPersonI3D
LEFT OUTER JOIN dbo.Anrede DPA ON DPA.I3D = DP.AnredeI3D
LEFT OUTER JOiN dbo.Kunden KA ON KA.I3D = RK.LiefKundI3D
INNER JOIN dbo.ZahKond ZK ON ZK.I3D = RK.ZahlKondID
LEFT OUTER JOIN dbo.ZahKond ZKL ON ZKL.I3D = RK.LieferBedID
INNER JOIN dbo.Laenkenn LK ON LK.I3D = RK.CurrencyI3D
LEFT OUTER JOIN dbo.Personal P ON P.I3D = RK.GeaendertVonI3D
INNER JOIN dbo.Laenkenn LK2 ON LK2.I3D = RK.LandI3D
LEFT OUTER JOIN dbo.Filiale F ON F.I3D = RK.FilialI3D
LEFT OUTER JOIN dbo.Bankverbindungen B ON B.I3D = RK.SepaMandateI3D
LEFT OUTER JOIN AccountCustomers AC ON AC.Number = RK.KundenID
LEFT OUTER JOIN dbo.Bankverbindungen defaultBank ON defaultBank.IsDefault = 1 AND defaultBank.Status = 1 AND defaultBank.ObjectArt = 0 AND defaultBank.ObjectI3D = k.KundenNummer AND RK.SepaMandateI3D IS NULL --objectArt = 0 -> customer & use customer number as I3D
LEFT OUTER JOIN AccountTypeToAccounts ATTA ON ATTA.AccountCustomerI3D = AC.I3D
LEFT OUTER JOIN Accounts ACC ON ATTA.AccountI3D = ACC.I3D
WHERE IH.Number > 0
		AND IH.State <> 3
UNION ALL
SELECT  2 AS Type,
		IH.I3D,
		IH.Number,
		ISNULL(RK.Zusatztext,'') AS Caption,
		'' AS VariableTextField1,
		NULL AS ExternalReceiptNumber,
		NULL AS ExternalReceiptDate,
		NULL AS DueDate,
		IH.Date,
		IH.Version,
        IIF(ISNULL(RK.FilialI3D,0) <= 0 OR ISNULL(Setting1.ValueBool,0) = 0 OR ISNULL(KB.BookKeepingNumber,'') = '',K.BuchhaltNr,KB.BookKeepingNumber) AS AddressBookKeepingNumber,
        IIF(ISNULL(RK.FilialI3D,0) <= 0 OR ISNULL(Setting1.ValueBool,0) = 0 OR ISNULL(KBAbwReAnschr.BookKeepingNumber,'') = '',KAbwReAnschr.BuchhaltNr,KBAbwReAnschr.BookKeepingNumber) AS BookKeepingNumberDifferentInvoiceAddress,
        K.SteuerNr AS TaxNumber,
		ZK.Zahlungstyp AS PaymentTypeNumber,
		ZK.Untdid4461,
		ZK.I3D AS PaymentConditionsI3D,
        ZK.Kurztext AS PaymentConditionsText,
		rk.ZahlKond AS PaymentConditionFull,
		K.I3D AS AddressNumber,
		ZK.FaelligPlusTage AS DuePlusDays,
		AC.OwnSupplierNumber,
        LK2.Land AS Country,
		ZK.LaenPer1 AS Skonto1OffDay,
		ZK.Skonto1 AS Skonto1Percent,
        P.KurzZeich AS LastChangedBy,
        ZK.LaenPer2 AS Skonto2OffDay,
		ZK.Skonto2 AS Skonto2Percent,
		ZK.LaenPer3 AS Skonto3OffDay,
        K.Name AS AddressName,
		A.Strasse AS AddressStreet,
		A.Postfach AS AddressPostOfficeBox,
		A.PLZ AS AddressZip,
        A.Ort AS AddressCity,
        RK.Tel AS ContactPhone,
		RK.Fax AS ContactTelefax,
		RK.Mail AS ContactEMail,
		K.KdWWW AS CustomerWebSite,
        ISNULL(IIF(RK.FIBUSammelkonto = '',NULL,RK.FIBUSammelkonto),
		K.FIBUSammelkonto) AS CollectiveAccount,
		IH.State,
        CONVERT(bit,CASE WHEN EXISTS(SELECT I3D FROM PORTRECH WHERE Art = 6 AND AnlageI3D = RK.I3D) THEN 1 ELSE 0 END) AS IsTransferred,
        IH.NetPrice,
		IH.NetPriceFC,
		IH.TaxPrice,
		IH.TaxPriceFC,
		IH.ExclusiveOfVAT,
		LK.RWZeichen AS CurrencyISOCode,
        IH.IsCashAsset,
		IH.CurrencyString,
		IH.CurrencyFactor,
		NULL AS ESRCode,
		NULL AS DeliveryConditionI3D,
		NULL AS DeliveryConditionText,
        NULL AS IsExportedToEdi,
		LK2.Kurzzeichen AS CountryShortCode,
		NULL AS TrackingNumber,
		RK.BestNr AS ExternalPurchaseOrderNumber,
        F.I3D AS BranchI3D,
		NULL,
		NULL,
		CAST(0 as bit) AS IsSepaActive,
		0 AS SepaKind,
        CASE WHEN ISNULL(RK.Lieferdatum,0) < 2 THEN NULL ELSE RK.Lieferdatum END AS DeliveryDate,
        K.UmsaIdentNr AS SalesTaxIdentificationNumber,
		NULL AS BankAccountI3D,
        '' AS BankAccountNumber,
        '' AS BankNumber,
		RK.Ansprech AS ContactName,
		RK.DocDirI3D AS DirectoryI3D,
		RK.LiefKundAnschriftI3D As DeliveryAdressI3D,
		RK.LiefKundPersonI3D AS DeliveryContactI3D,
		KA.Name AS DeliveryCustomerName,
		DA.Strasse AS DeliveryStreet,
		DA.Postfach AS DeliveryPostOfficeBox,
		DA.Plz AS DeliveryZip,
		DA.Ort AS DeliveryCity,
		DP.Tel1 AS DeliveryContactPhone,
		DP.Fax1 AS DeliveryContactTelefax,
		DP.Email1 AS DeliveryContactEMail,
		DP.AnsprechVorname AS DeliveryContactFirstName,
		DP.Ansprech AS DeliveryContactLastName,
		DPA.Anrede AS DeliveryContactSalutation,
		NULL AS CustomerNumberAtSupplier,
		NULL AS IBAN,
		NULL AS BIC,
		NULL as ReceiptLink,
		Acc.UseSettingsFromCompanyGroupForReceipts AS UseSettingsFromCompanyGroupForReceipts,
		IIF(ACC.UseSettingsFromCompanyGroupForReceipts = 1, KAbwReAnschr.Name, '') AS CompanyGroupName, -- wenn die Einstellung gesetzt ist, sollte jede Addresse (und damit auch die abweichende) von dem Konzern stammen
		CAST(IIF(IsNull(ZK.DatevExport,0) = 1, 1, 0) AS BIT) AS IsBookKeepingExportActive
FROM dbo.GutKopf RK
INNER JOIN dbo.cvw_CreditVoucherHead IH ON IH.I3D = RK.I3D
LEFT OUTER JOIN dbo.ApplicationSettings Setting1 ON Setting1.I3D = 10076
LEFT OUTER JOIN dbo.Kunden K ON K.I3D = RK.KundenID -- ON ((ISNULL(RK.RechKundFremd,0) = 0 OR ISNULL(RK.RechKundI3D,0) <= 0) AND K.I3D = RK.KundenID) OR (ISNULL(RK.RechKundFremd,0) = 1 AND K.I3D = RK.RechKundI3D)
LEFT OUTER JOIN dbo.CustomerToBranches KB ON KB.CustomerNumber = K.I3D AND KB.BranchI3D = RK.FilialI3D
LEFT OUTER JOIN dbo.Kunden KAbwReAnschr ON KAbwReAnschr.I3D = RK.RechKundI3D
LEFT OUTER JOIN dbo.CustomerToBranches KBAbwReAnschr ON KBAbwReAnschr.CustomerNumber = KAbwReAnschr.I3D AND KBAbwReAnschr.BranchI3D = ISNULL(RK.FilialI3D,0)
LEFT OUTER JOIN dbo.Anschrif A ON ((ISNULL(RK.RechKundFremd,0) = 0 OR ISNULL(RK.RechKundI3D,0) <= 0) AND A.I3D = RK.AnschriftID) OR (ISNULL(RK.RechKundFremd,0) = 1 AND A.I3D = RK.RechKundAnschriftI3D)
LEFT OUTER JOIN dbo.Anschrif DA ON DA.I3D = RK.LiefKundAnschriftI3D
LEFT OUTER JOIN dbo.Personen DP ON DP.I3D = RK.LiefKundPersonI3D
LEFT OUTER JOIN dbo.Anrede DPA ON DPA.I3D = DP.AnredeI3D
LEFT OUTER JOiN dbo.Kunden KA ON KA.I3D = RK.LiefKundI3D
INNER JOIN dbo.ZahKond ZK ON ZK.I3D = RK.ZahlKondID
INNER JOIN dbo.Laenkenn LK ON LK.I3D = RK.CurrencyI3D
LEFT OUTER JOIN dbo.Personal P ON P.I3D = RK.GeaendertVonI3D
INNER JOIN dbo.Laenkenn LK2 ON LK2.I3D = RK.LandI3D
LEFT OUTER JOIN dbo.Filiale F ON F.I3D = RK.FilialI3D
LEFT OUTER JOIN AccountCustomers AC ON AC.Number = RK.KundenID
LEFT OUTER JOIN AccountTypeToAccounts ATTA ON ATTA.AccountCustomerI3D = AC.I3D
LEFT OUTER JOIN Accounts ACC ON ATTA.AccountI3D = ACC.I3D
UNION ALL
SELECT         3 AS Type,
		IH.I3D,
		IH.Number,
		'' AS Caption,
		ISNULL(RK.VarFeld1,'') AS VariableTextField1,
		RK.RechnungsNr AS ExternalReceiptNumber,
        CASE WHEN YEAR(RK.RechnungsDatum) < 1905 THEN NULL ELSE RK.RechnungsDatum END AS ExternalReceiptDate,
        CASE WHEN YEAR(RK.FaelligAm) < 1905 THEN NULL ELSE RK.FaelligAm END AS DueDate,
		IH.Date,
		IH.Version,
        CASE WHEN LF.I3D IS NULL THEN K.Datev ELSE LF.BuchhaltNr END AS AddressBookKeepingNumber,
		'' AS BookKeepingNumberDifferentInvoiceAddress,
		 K.SteuerNr AS TaxNumber,
		ZK.Zahlungstyp AS PaymentTypeNumber,
		ZK.Untdid4461,
		ZK.I3D AS PaymentConditionsI3D,
        ZK.Kurztext AS PaymentConditionsText,
		rk.ZahlKondText AS PaymentConditionFull,
		K.I3D AS AddressNumber,
		ZK.FaelligPlusTage AS DuePlusDays,
		'' AS OwnSupplierNumber,
        LK2.Land AS Country,
		ZK.LaenPer1 AS Skonto1OffDay,
		ZK.Skonto1 AS Skonto1Percent,
        P.KurzZeich AS LastChangedBy,
        ZK.LaenPer2 AS Skonto2OffDay,
		ZK.Skonto2 AS Skonto2Percent,
		ZK.LaenPer3 AS Skonto3OffDay,
        K.Name AS AddressName,
		A.Strasse AS AddressStreet,
		A.Postfach AS AddressPostOfficeBox,
		A.PLZ AS AddressZip,
        A.Ort AS AddressCity,
        RK.Tel AS ContactPhone,
		RK.Fax AS ContactTelefax,
		RK.Mail AS ContactEMail,
		K.WWW AS CustomerWebSite,
        ISNULL(IIF(RK.FIBUSammelkonto = '',NULL,RK.FIBUSammelkonto),
		K.FIBUSammelkonto) AS CollectiveAccount,
		IH.State,
        CONVERT(bit,CASE WHEN EXISTS(SELECT I3D FROM PORTWARE WHERE Art = 18 AND Verwaltungs_Nr = RK.I3D) THEN 1 ELSE 0 END) AS IsTransferred,
        IH.NetPriceComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IH.FreightNetPriceComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE IH.InsuranceNetPriceComplete END,
        IH.NetPriceFCComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IH.FreightNetPriceFCComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE  IH.InsuranceNetPriceFCComplete END,
        IH.TaxPriceComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IH.FreightTaxPriceComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE  IH.InsuranceTaxPriceComplete END,
        IH.TaxPriceFCComplete + CASE WHEN IH.FreightAsOwnPosition = 1 THEN 0 ELSE IH.FreightTaxPriceFCComplete END + CASE WHEN IH.InsuranceAsOwnPosition = 1 THEN 0 ELSE  IH.InsuranceTaxPriceFCComplete END,
        IH.ExclusiveOfVAT,
		LK.RWZeichen AS CurrencyISOCode,
        IH.IsCashAsset,
		IH.CurrencyString,
		IH.CurrencyFactor,
		RK.ESRCodierzeile AS ESRCode,
		NULL AS DeliveryConditionI3D,
		NULL AS DeliveryConditionText,
        NULL AS IsExportedToEdi,
		LK2.Kurzzeichen AS CountryShortCode,
		NULL AS TrackingNumber,
		NULL AS ExternalPurchaseOrderNumber,
        ISNULL(RK.BranchI3D,0) AS BranchI3D,
		NULL,
		NULL,
		CAST(ISNULL(ZK.DTALastschrift,0) as bit) AS IsSepaActive,
		0 AS SepaKind,
        CASE WHEN YEAR(RK.RechnungsDatum) < 1905 THEN NULL ELSE RK.RechnungsDatum END AS DeliveryDate,
        K.UmsaIdentNr AS SalesTaxIdentificationNumber,
		ISNULL(B.I3D,B2.I3D) AS BankAccountI3D,
		ISNULL(B.Kontonummer,B2.Kontonummer) AS BankAccountNumber,
        ISNULL(B.BankverbNummer,B2.BankverbNummer) AS BankNumber,
		'' AS ContactName,
		RK.DocDirI3D AS DirectoryI3D,
		NULL As DeliveryAdressI3D,
		NULL AS DeliveryContactI3D,
		NULL AS DeliveryCustomerName,
		NULL AS DeliveryStreet,
		NULL AS DeliveryPostOfficeBox,
		NULL AS DeliveryZip,
		NULL AS DeliveryCity,
		NULL AS DeliveryContactPhone,
		NULL AS DeliveryContactTelefax,
		NULL AS DeliveryContactEMail,
		NULL AS DeliveryContactFirstName,
		NULL AS DeliveryContactLastName,
		NULL AS DeliveryContactSalutation,
		COALESCE(LF.KdNrBeiLieferant,K.KredKdnr) AS CustomerNumberAtSupplier,
		ISNULL(B.IBAN,B2.IBAN) AS IBAN,
		ISNULL(B.BIC,B2.BIC) AS BIC,
		RK.ReceiptLink,
		ACC.UseSettingsFromCompanyGroupForReceipts AS UseSettingsFromCompanyGroupForReceipts,
		IIF(ACC.UseSettingsFromCompanyGroupForReceipts = 1, Company.CompanyGroupName, '') AS CompanyGroupName,
		CAST(IIF(IsNull(ZK.DatevExport,0) = 1 AND ISNULL(RK.KeinBuchhaltungsexport,0) <> 1 AND RK.Status = 2, 1, 0) AS BIT) AS IsBookKeepingExportActive
FROM dbo.KalkKopf RK
INNER JOIN dbo.cvw_SupplierInvoiceHead IH ON IH.I3D = RK.I3D
INNER JOIN dbo.Kreditor K ON K.I3D = RK.KreditorI3D
LEFT OUTER JOIN dbo.Anschrif A ON A.I3D = RK.AnschriftI3D
INNER JOIN dbo.ZahKond ZK ON ZK.I3D = RK.ZahlKondI3D
INNER JOIN dbo.Laenkenn LK ON LK.I3D = RK.CurrencyI3D
LEFT OUTER JOIN dbo.Personal P ON P.I3D = RK.GeaendertVonI3D
INNER JOIN dbo.Laenkenn LK2 ON LK2.I3D = RK.LandI3D
LEFT OUTER JOIN dbo.LieferantenToFiliale LF ON LF.LieferantI3D = K.I3D AND ISNULL(LF.FilialI3D,0) = ISNULL(RK.BranchI3D,0)  AND ISNULL(LF.BuchhaltNr,
'0') <> '0' AND ISNULL(LF.BuchhaltNr,
'') <> ''
LEFT OUTER JOIN dbo.Bankverbindungen B ON B.ObjectI3D = RK.KreditorI3D AND B.BankverbNummer = RK.BankVerbNummer AND B.ObjectArt = 1
LEFT OUTER JOIN dbo.Bankverbindungen B2 ON B2.I3D = RK.BankVerbNummer
LEFT OUTER JOIN AccountSuppliers ACS ON ACS.Number = K.I3D
LEFT OUTER JOIN AccountTypeToAccounts ATTA ON ATTA.AccountSupplierI3D = ACS.I3D
LEFT OUTER JOIN Accounts ACC ON ATTA.AccountI3D = ACC.I3D
OUTER APPLY(
	SELECT TOP (1) CompanyGroupName FROM cvw_AccountSearchAcc companySearch WHERE AccountI3D = ACC.I3D
	) AS Company
WHERE IsNull(RK.AktuelleVersion,0) = 1
UNION ALL
SELECT         4 AS Type,
		IH.I3D,
		IH.Number,
		'' AS Caption,
		ISNULL(RK.VarFeld1,'') AS VariableTextField1,
		RK.GutschriftsNr AS ExternalReceiptNumber,
        CASE WHEN YEAR(RK.GutschriftsDatum) < 1905 THEN NULL ELSE RK.GutschriftsDatum END AS ExternalReceiptDate,
        CASE WHEN YEAR(RK.FaelligAm) < 1905 THEN NULL ELSE RK.FaelligAm END AS DueDate,
		IH.Date,
		IH.Version,
        CASE WHEN LF.I3D IS NULL THEN K.Datev ELSE LF.BuchhaltNr END AS AddressBookKeepingNumber,'' AS BookKeepingNumberDifferentInvoiceAddress,
		K.SteuerNr AS TaxNumber,
		ZK.Zahlungstyp AS PaymentTypeNumber,
		ZK.Untdid4461,
		ZK.I3D AS PaymentConditionsI3D,
        ZK.Kurztext AS PaymentConditionsText,
		rk.ZahlKondText AS PaymentConditionFull,
		K.I3D AS AddressNumber,
		ZK.FaelligPlusTage AS DuePlusDays,
		'' AS OwnSupplierNumber,
        LK2.Land AS Country,
		ZK.LaenPer1 AS Skonto1OffDay,
		ZK.Skonto1 AS Skonto1Percent,
        P.KurzZeich AS LastChangedBy,
        ZK.LaenPer2 AS Skonto2OffDay,
		ZK.Skonto2 AS Skonto2Percent,
		ZK.LaenPer3 AS Skonto3OffDay,
        K.Name AS AddressName,
		A.Strasse AS AddressStreet,
		A.Postfach AS AddressPostOfficeBox,
		A.PLZ AS AddressZip,
        A.Ort AS AddressCity,
        RK.Tel AS ContactPhone,
		RK.Fax AS ContactTelefax,
		RK.Mail AS ContactEMail,
		K.WWW AS CustomerWebSite,
        ISNULL(IIF(RK.FIBUSammelkonto = '',NULL,RK.FIBUSammelkonto),K.FIBUSammelkonto) AS CollectiveAccount,
		IH.State,
        CONVERT(bit,CASE WHEN EXISTS(SELECT I3D FROM PORTWARE WHERE Art = 148 AND Verwaltungs_Nr = RK.I3D) THEN 1 ELSE 0 END) AS IsTransferred,
        IH.NetPrice,
		IH.NetPriceFC,
		IH.TaxPrice,
		IH.TaxPriceFC,
		IH.ExclusiveOfVAT,
		LK.RWZeichen AS CurrencyISOCode,
        IH.IsCashAsset,
		IH.CurrencyString,
		IH.CurrencyFactor,
		NULL AS ESRCode,
		NULL AS DeliveryConditionI3D,
		NULL AS DeliveryConditionText,
        NULL AS IsExportedToEdi,
		LK2.Kurzzeichen AS CountryShortCode,
		NULL AS TrackingNumber,
		NULL AS ExternalPurchaseOrderNumber,
        ISNULL(RK.BranchI3D,0) AS BranchI3D,
		NULL,
		NULL,
		CAST(0 as bit) AS IsSepaActive,
		0 AS SepaKind,
        CASE WHEN YEAR(RK.GutschriftsDatum) < 1905 THEN NULL ELSE RK.GutschriftsDatum END AS DeliveryDate,
        K.UmsaIdentNr AS SalesTaxIdentificationNumber,
		NULL AS BankAccountI3D,
        '' AS BankAccountNumber,
        '' AS BankNumber,
		'' AS ContactName,
		RK.DocDirI3D AS DirectoryI3D,
		NULL As DeliveryAdressI3D,
		NULL AS DeliveryContactI3D,
		NULL AS DeliveryCustomerName,
		NULL AS DeliveryStreet,
		NULL AS DeliveryPostOfficeBox,
		NULL AS DeliveryZip,
		NULL AS DeliveryCity,
		NULL AS DeliveryContactPhone,
		NULL AS DeliveryContactTelefax,
		NULL AS DeliveryContactEMail,
		NULL AS DeliveryContactFirstName,
		NULL AS DeliveryContactLastName,
		NULL AS DeliveryContactSalutation,
		COALESCE(LF.KdNrBeiLieferant,K.KredKdnr) AS CustomerNumberAtSupplier,
		NULL AS IBAN,
		NULL AS BIC,
		NULL as ReceiptLink,
		ACC.UseSettingsFromCompanyGroupForReceipts AS UseSettingsFromCompanyGroupForReceipts,
		IIF(ACC.UseSettingsFromCompanyGroupForReceipts = 1, Company.CompanyGroupName, '') AS CompanyGroupName,
		CAST(IIF(IsNull(ZK.DatevExport,0) = 1, 1, 0) AS BIT) AS IsBookKeepingExportActive
FROM dbo.LiGutKopf RK
INNER JOIN dbo.cvw_SupplierCreditVoucherHead IH ON IH.I3D = RK.I3D
INNER JOIN dbo.Kreditor K ON K.I3D = RK.KreditorI3D
LEFT OUTER JOIN dbo.Anschrif A ON A.I3D = RK.AnschriftI3D
INNER JOIN dbo.ZahKond ZK ON ZK.I3D = RK.ZahlKondI3D
INNER JOIN dbo.Laenkenn LK ON LK.I3D = RK.CurrencyI3D
LEFT OUTER JOIN dbo.Personal P ON P.I3D = RK.GeaendertVonI3D
INNER JOIN dbo.Laenkenn LK2 ON LK2.I3D = RK.LandI3D
LEFT OUTER JOIN dbo.LieferantenToFiliale LF ON LF.LieferantI3D = K.I3D AND ISNULL(LF.FilialI3D,0) = ISNULL(RK.BranchI3D,0) AND ISNULL(LF.BuchhaltNr,
'0') <> '0' AND ISNULL(LF.BuchhaltNr,
'') <> ''
LEFT OUTER JOIN AccountSuppliers ACS ON ACS.Number = K.I3D
LEFT OUTER JOIN AccountTypeToAccounts ATTA ON ATTA.AccountSupplierI3D = ACS.I3D
LEFT OUTER JOIN Accounts ACC ON ATTA.AccountI3D = ACC.I3D
OUTER APPLY(
	SELECT TOP (1) CompanyGroupName FROM cvw_AccountSearchAcc companySearch WHERE AccountI3D = ACC.I3D
	) AS Company
WHERE IsNull(RK.AktuelleVersion,0) = 1
GO
/****** Object:  Table [dbo].[AufPosVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufPosVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AufKopfI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[VertragArt] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[Kommisioniert] [float] NULL,
	[Liefermenge] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockId] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Status] [int] NULL,
	[UrsprungAngNr] [int] NULL,
	[RechLiefNr] [int] NULL,
	[RechLiefArt] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellung] [varchar](50) NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellPos] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[EKStkBestellt] [float] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[Bestellnummer] [varchar](50) NULL,
	[OriginalI3D] [int] NULL,
	[KopfVersionsI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungPosI3D] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[OldAufKopfI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[VKBasisWert] [float] NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[RMAPosI3D] [int] NULL,
	[HerstellerI3D] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[RundungsDiff] [float] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[EkStkGebucht] [float] NULL,
	[IsBillingPartList] [bit] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalComplete] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFCComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFCComplete] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFCComplete] [decimal](19, 2) NULL,
	[PurchasePriceSupplierI3D] [int] NULL,
	[InternalNote] [nvarchar](max) NULL,
	[PlannedDurationInHours] [decimal](19, 7) NOT NULL,
	[BVLInfo] [nvarchar](500) NULL,
	[LizenzDatum] [datetime2](0) NULL,
	[Direktlieferung] [int] NULL,
	[IsReverseCharge] [bit] NULL,
	[isLeasing] [int] NULL,
	[isService] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[OrderItemVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[OrderItemVersions] AS
SELECT AP.I3D
    ,AP.OriginalI3D
    ,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
    ,AP.Richtext AS RichText
    ,AP.ArtikelI3D AS ArticleI3D
    ,ISNULL(AP.Pos, 0) AS InternalPosition
    ,ISNULL(AP.Indent, 0) AS Indent
    ,ISNULL(AP.GrpID,0) AS GroupID
    ,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
    ,ISNULL(AP.Art, 0) AS Kind
    ,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
    ,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
    ,ISNULL(AP.AufKopfI3D, 0) AS ReceiptI3D
    ,AP.KopfVersionsI3D AS ReceiptVersionI3D
    ,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
    ,CONVERT(DECIMAL(19,7), ISNULL(AP.Liefermenge, 0)) AS QuantityProcessed
    ,AP.VKBasisWert AS BasePrice
    ,AP.EK AS PurchaseBasePrice
    ,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
    ,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
    ,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
    ,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
    ,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
    ,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
    ,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
    ,AP.ErloesKTO AS RevenueAccount
    ,ISNULL(AP.Visible, 1) AS Visible
    ,AP.FontStyle
    ,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
    ,AP.FontName
    ,AP.FontColor
    ,AP.Code AS ArticleCode
    ,AP.EANCode AS EANCode
    ,AP.HerstCode AS ManufacturerCode
    ,0 AS ShowImage
    ,AP.UrsprungEK AS OriginalPurchasePrice
    ,AP.EKGrund AS ReasonForCustomPurchasePrice
    ,AP.UrsprungPosI3D AS OriginReceiptItemI3D
    ,AP.UrsprungI3D AS OriginReceiptI3D
    ,AP.UrsprungArt AS OriginKind
    ,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
    ,ISNULL(AP.Abbuchung, 0) AS ChangeStock
    ,CONVERT(DECIMAL(19,7), ISNULL(AP.Kommisioniert, 0)) AS QuantityPicked
    ,AP.WEEE AS WEEE
    ,AP.Bestellinformation AS PurchaseInformations
    ,AP.Kundenkostenstelle AS CustomerCostCenter
    ,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
    ,AP.BestellNr AS PurchaseOrderNumber
    ,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
    ,CASE WHEN AP.HelpdeskI3D <= 0 THEN NULL ELSE AP.HelpdeskI3D END AS HelpdeskI3D
    ,CONVERT(DECIMAL(19,7), ISNULL(AP.EKStkBestellt, 0)) AS QuantityOrdered
    ,AP.PurchasePriceSupplierI3D AS PurchasePriceSupplierI3D
    ,AP.UniqAusgleichsArtikelID AS BalanceID
    ,AP.InternalNote AS InternalNote
    ,AP.PlannedDurationInHours AS PlannedDurationInHours
    ,AP.LizenzDatum AS LicenseDate
    ,AP.Direktlieferung AS IsDirectDeliveryPossible
	,CASE WHEN AP.GeraeteBarcodeI3D <= 0 THEN NULL ELSE AP.GeraeteBarcodeI3D END AS MasterDataListSerialNumberI3D
	,AP.IsReverseCharge
	,CAST(ISNULL(AP.isLeasing,0) AS BIT) AS IsLeasing
	,CAST(ISNULL(AP.isService,0) AS BIT) AS IsService
FROM dbo.AufPosVersions AS AP
GO
/****** Object:  View [dbo].[cvw_BookKeepingAddresses]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_BookKeepingAddresses]
      AS   
      SELECT 
         0 AS AddressKind,
      K.I3D AS AddressNumber, 
      K.BuchhaltNr AS BookKeepingNumber,
         NULL AS OwnNumberByAddress,
         0 AS IsBookKeepingNumberFromBranch,
      K.Name AS Name,
      K.Kurzbezeichnung AS Matchcode,
      K.Fon AS Phone,
      K.Fax AS Telefax,
      K.KdEMail AS EMail,
      K.KdWWW AS Website,
      K.UmsaIdentNr AS SalesTaxIdentificationNumber,
      K.SteuerNr AS TaxNumber,
      K.AnlaDatum AS CreatedDate,
      K.Aenderung AS ChangedDate,

      BVBN.BankName AS Bank, 
      BVBN.BLZ AS BankCode,
      BVBN.Kontonummer AS BankAccountNumber,
      LB.Land AS BankCountry,
	  LB.Kurzzeichen AS BankCountryCode,
      BVBN.Ort AS BankCity,
      BVBN.Strasse AS BankStreet,
      BVBN.IBAN AS BankIBAN,
      BVBN.BIC AS BankBIC,
      BVBN.Zahlungsart AS BankPaymentKind,
      BVBN.BankverbNummer AS BankNumber,
      
      CONVERT(DECIMAL(19,2), ROUND(ISNULL(K.Limit,0),2)) AS Limit,
      K.FIBUSammelkonto AS CollectiveAccount,
      (SELECT MAX(RK.Datum) FROM RechKopf RK WHERE RK.KundenID = K.I3D) AS LastInvoiceAt,
      ISNULL(KDZK.Zahlungstyp, ADZK.Zahlungstyp) AS PaymentType,
         CAST(ISNULL(KDZK.DTALastschrift,0) as bit) AS IsSepaActive, ISNULL(KDZK.DTAAuswahl,0) AS SepaKind,
         A.Abteilung AS Department,
      A.Strasse AS Street,
      A.Plz AS Zip,
      A.Postfach AS PostOfficeBox,
      A.Ort AS City,
      A.Kommentar AS Comment,
      
      L.Kurzzeichen AS CountryCode,
      L.Land AS CountryName,
      CAST(ISNULL(L.EUMitglied,0) as BIT) AS IsEUMember,
      L.RWZeichen AS CurrencyISO,
	  ISNULL(K.RWUebergabe,0) AS IsExported,

	  CONCAT(PersonenAbweichendeRechnungsMailEMpfänger.Ansprech, PersonenAbweichendeRechnungsMailEMpfänger.AnsprechVorname) AS AlternateInvoiceMailRecipient,
	  K.RechnungVersandArt AS SendingTypeOfInvoice,
	  KDZK.Kurztext AS PaymentConditionAsText,
	  CONCAT(PersonenMahnung.Ansprech, PersonenMahnung.AnsprechVorname)  AS ContactForDunning,
	  k.MahnArt AS SendingTypeOfDunning
FROM Kunden K
LEFT OUTER JOIN Anschrif A ON A.Kunde = K.I3D AND A.KundeDefault = 1 AND A.Status = 1
LEFT OUTER JOIN Laenkenn L ON L.I3D = A.Land

LEFT OUTER JOIN Bankverbindungen BVBN ON ((BVBN.ObjectI3D = K.I3D) AND ( BVBN.ObjectArt = 0 ) AND (BVBN.IsDefault = 1) AND (BVBN.Status = 1))
LEFT OUTER JOIN Laenkenn LB ON LB.I3D = BVBN.LandI3D
LEFT OUTER JOIN Laenkenn LB2 ON LB2.I3D = K.BankLand02
LEFT OUTER JOIN Zahkond KDZK ON KDZK.I3D = K.ZahlKondRech
LEFT OUTER JOIN Stammdat SD ON SD.I3D = 407
LEFT OUTER JOIN ZahKond ADZK ON ADZK.I3D = SD.Wert

LEFT OUTER JOIN Personen PersonenAbweichendeRechnungsMailEMpfänger ON PersonenAbweichendeRechnungsMailEMpfänger.I3D= K.AbwMailRechnungEmpfaengerI3D
LEFT OUTER JOIN Personen PersonenMahnung ON PersonenMahnung.I3D = K.MahnPersonI3D

WHERE 1=1
AND K.Gesperrt <> 1
AND K.Status = 1

UNION

SELECT 
         1 AS AddressKind,
      K.I3D AS AddressNumber,
         K.Datev AS BookKeepingNumber,
         K.KredKdnr AS OwnNumberByAddress,
         0 AS IsBookKeepingNumberFromBranch,
      K.Name AS Name,
      K.Kurzbezeichnung AS Matchcode,
      K.Fon AS Phone, 
      K.Fax AS Telefax,
      K.EMail AS EMail,
      K.WWW AS WebSite,
      K.UmsaIdentNr AS TaxIdentificationNumber,
      K.SteuerNr AS TaxNumber,
      K.AnlaDatum AS CreatedDate,
      K.Aenderung AS ChangedDate,

      BVBN.BankName AS Bank,
      BVBN.BLZ AS BankCode,
      BVBN.Kontonummer AS BankAccountNumber,
      LB.Land AS BankCountry,
	  LB.Kurzzeichen AS BankCountryCode,
      BVBN.Ort AS BankCity,
      BVBN.Strasse AS BankStreet,
      BVBN.IBAN AS BankIBAN,
      BVBN.BIC AS BankBIC,
      BVBN.Zahlungsart AS BankPaymentKind,
      BVBN.BankverbNummer AS BankNumber,
      
      CONVERT(DECIMAL(19,2), ROUND(ISNULL(K.Limit,0),2)) AS Limit,
      K.FIBUSammelkonto AS CollectiveAccount,
      (SELECT MAX(RK.Datum) FROM KalkKopf RK WHERE RK.KreditorI3D = K.I3D) AS LastInvoiceAt,
      ZK.Zahlungstyp AS PaymentType,
         CAST(0 as bit) AS IsSepaActive, 0 AS SepaKind,
      A.Abteilung AS Department,
      A.Strasse AS Street,
      A.Plz AS Zip,
      A.Postfach AS PostOfficeBox,
      A.Ort AS City,
      A.Kommentar AS Comment,
      L.Kurzzeichen AS CountryCode,
      L.Land AS CountryName,
      CAST(ISNULL(L.EUMitglied,0) AS Bit) AS IsEUMember,
      L.RWZeichen AS CurrencyISO,
      ISNULL(K.RWUebergabe,0) AS IsExported,
	  NULL AS AlternateInvoiceMailRecipient,
	  NULL AS SendingTypeOfInvoice,
	  NULL AS PaymentConditionAsText,
	  NULL AS ContactForDunning,
	  NULL AS SendingTypeOfDunning
FROM Kreditor K
LEFT OUTER JOIN Anschrif A ON A.Kreditor = K.I3D AND A.KreditorDefault = 1 AND A.Status = 1
LEFT OUTER JOIN Laenkenn L ON L.I3D = A.Land

LEFT OUTER JOIN Bankverbindungen BVBN ON ((BVBN.ObjectI3D = K.I3D) AND ( BVBN.ObjectArt = 1 ) AND (BVBN.IsDefault = 1) AND (BVBN.Status = 1))
LEFT OUTER JOIN Laenkenn LB ON LB.I3D = BVBN.LandI3D
LEFT OUTER JOIN Laenkenn LB2 ON LB2.I3D = K.BankLand02
LEFT OUTER JOIN Zahkond ZK ON ZK.I3D = K.ZahlKond

WHERE K.Status = 1
AND IsNull(K.KeinBuchhaltungsexport, 0) <> 1
GO
/****** Object:  Table [dbo].[LiefPosVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiefPosVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LiefKopfI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockId] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbruch] [int] NULL,
	[Status] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungNr] [int] NULL,
	[UrsprungArt] [int] NULL,
	[RechLiefNr] [int] NULL,
	[RechLiefArt] [int] NULL,
	[AbholNr] [int] NULL,
	[numAbhol] [float] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[Ausgeliefert] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellPos] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[Abbuchung] [int] NULL,
	[OriginalI3D] [int] NULL,
	[KopfVersionsI3D] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[RMAPosI3D] [int] NULL,
	[OldLiefKopfI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[VKBasisWert] [float] NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[Artikelpositionsart] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[RundungsDiff] [float] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[NoCalculateTime] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[IsBillingPartList] [bit] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalComplete] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFCComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFCComplete] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFCComplete] [decimal](19, 2) NULL,
	[LizenzDatum] [datetime2](0) NULL,
	[IsReverseCharge] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[DeliveryListItemVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[DeliveryListItemVersions]
AS
SELECT AP.I3D
	,AP.OriginalI3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.LiefKopfI3D, 0) AS ReceiptI3D
	,AP.KopfVersionsI3D AS ReceiptVersionI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.numAbhol, 0)) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.Ursprung AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
    ,AP.WEEE AS WEEE
	,AP.Bestellinformation AS PurchaseInformations
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,AP.LizenzDatum AS LicenseDate
	,CASE WHEN AP.GeraeteBarcodeI3D <= 0 THEN NULL ELSE AP.GeraeteBarcodeI3D END AS MasterDataListSerialNumberI3D
	,AP.IsReverseCharge
	,AP.RMAPosI3D AS RMAItemI3D
FROM dbo.LiefPosVersions AS AP
GO
/****** Object:  Table [dbo].[AbholPosVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbholPosVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AbholKopfI3D] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[Liefermenge] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockId] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Status] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungLiefNr] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[KundenRMAI3D] [int] NULL,
	[KundenRMANummer] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[KopfVersionsI3D] [int] NULL,
	[OriginalI3D] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[OldAbholKopfI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[RMAPosI3D] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Artikelpositionsart] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[IsBillingPartList] [bit] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[IsReverseCharge] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[PickupListItemVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[PickupListItemVersions]
AS
SELECT AP.I3D
	,AP.OriginalI3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.AbholKopfI3D, 0) AS ReceiptI3D
	,AP.KopfVersionsI3D AS ReceiptVersionI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.Ursprung AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
	,'' AS PurchaseInformations
    ,AP.WEEE AS WEEE
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,AP.IsReverseCharge
FROM dbo.AbholPosVersions AS AP
GO
/****** Object:  Table [dbo].[RechPosVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RechPosVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RechKopfI3D] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNr] [int] NULL,
	[GutAbholArt] [int] NULL,
	[GutAbholNr] [int] NULL,
	[numGutAbhol] [float] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[Import] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[OriginalI3D] [int] NULL,
	[KopfVersionsI3D] [int] NULL,
	[StkStorno] [float] NULL,
	[SummeKalkStorno] [float] NULL,
	[VertragI3DAutoRechnung] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[RMAPosI3D] [int] NULL,
	[OldRechKopfI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Status] [int] NULL,
	[VKBasisWert] [float] NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[LizenzDatum] [datetime] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[RundungsDiff] [float] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[NoCalculateTime] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[IsBillingPartList] [bit] NULL,
	[ReceiptItemServiceArticleClassificationI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalComplete] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFCComplete] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFCComplete] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalComplete] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFCComplete] [decimal](19, 2) NULL,
	[IsFixed] [bit] NOT NULL,
	[IsReverseCharge] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[InvoiceItemVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[InvoiceItemVersions]
AS
SELECT AP.I3D
	,AP.OriginalI3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.RechKopfI3D, 0) AS ReceiptI3D
	,AP.KopfVersionsI3D AS ReceiptVersionI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), ISNULL(AP.numGutAbhol, 0)) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.Ursprung AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
    ,AP.WEEE AS WEEE
	,AP.Bestellinformation AS PurchaseInformations
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,AP.BestellNr AS PurchaseOrderNumber
	,CASE WHEN YEAR(ISNULL(AP.LizenzDatum, 0)) < 1905 THEN NULL ELSE AP.LizenzDatum END AS LicenseDate
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,AP.ReceiptItemServiceArticleClassificationI3D
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,CASE WHEN AP.GeraeteBarcodeI3D <= 0 THEN NULL ELSE AP.GeraeteBarcodeI3D END AS MasterDataListSerialNumberI3D
	,AP.IsReverseCharge
	,AP.RMAPosI3D AS RMAItemI3D
FROM dbo.RechPosVersions AS AP
GO
/****** Object:  Table [dbo].[GutPosVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GutPosVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GutKopfI3D] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNr] [int] NULL,
	[Farbe] [int] NULL,
	[FontSize] [int] NULL,
	[FontStyle] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[KundenRMAI3D] [int] NULL,
	[KundenRMANummer] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[OriginalI3D] [int] NULL,
	[KopfVersionsI3D] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[OldGutKopfI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Status] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Kundenkostenstelle] [varchar](300) NULL,
	[UniqAusgleichsArtikelID] [varchar](40) NULL,
	[Artikelpositionsart] [int] NULL,
	[WertGutschrift] [int] NULL,
	[RabatttextNichtAnzeigen] [int] NULL,
	[ProvisionEmployeeI3D] [int] NULL,
	[ReverseChargeMWSTI3D] [int] NULL,
	[IsBillingPartList] [bit] NULL,
	[ReceiptItemServiceArticleClassificationI3D] [int] NULL,
	[CalculatedNetPrice] [decimal](24, 7) NULL,
	[CalculatedTaxPrice] [decimal](19, 7) NULL,
	[CalculatedNetPriceFC] [decimal](24, 7) NULL,
	[CalculatedTaxPriceFC] [decimal](19, 7) NULL,
	[CalculatedNetPriceTotal] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotal] [decimal](19, 4) NULL,
	[CalculatedNetPriceTotalFC] [decimal](19, 2) NULL,
	[CalculatedTaxPriceTotalFC] [decimal](19, 4) NULL,
	[CalculatedNetPurchasePrice] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceFC] [decimal](24, 7) NULL,
	[CalculatedNetPurchasePriceTotal] [decimal](19, 2) NULL,
	[CalculatedNetPurchasePriceTotalFC] [decimal](19, 2) NULL,
	[IsReverseCharge] [bit] NULL,
	[RMAPosI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[CreditVoucherItemVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[CreditVoucherItemVersions]
AS
SELECT AP.I3D
	,AP.OriginalI3D
	,ISNULL(CASE WHEN AP.Art IN (1,3,4,5) THEN AP.Text ELSE AP.Freitext END, '') AS Text
	,AP.Richtext AS RichText
	,AP.ArtikelI3D AS ArticleI3D
	,ISNULL(AP.Pos, 0) AS InternalPosition
	,ISNULL(AP.Indent, 0) AS Indent
	,ISNULL(AP.GrpID,0) AS GroupID
	,CASE WHEN AP.Expanded IS NULL OR AP.Expanded IN (0, 1) THEN AP.Expanded ELSE 1 END AS Expanded
	,ISNULL(AP.Art, 0) AS Kind
	,ISNULL(AP.Artikelpositionsart, 0) AS ArticlePositionKind
	,CASE WHEN AP.MwstI3d <= 0 THEN NULL ELSE AP.MwstI3d END AS VATI3D
	,ISNULL(AP.GutKopfI3D, 0) AS ReceiptI3D
	,AP.KopfVersionsI3D AS ReceiptVersionI3D
	,CONVERT(DECIMAL(19,7), ISNULL(AP.Stk,0)) AS QuantityComplete
	,CONVERT(DECIMAL(19,7), 0) AS QuantityProcessed
	,AP.VKBasisWert AS BasePrice
	,AP.EK AS PurchaseBasePrice
	,CONVERT(DECIMAL(19,12), ISNULL(AP.Rabatt,0)) AS Discount
	,CASE WHEN AP.SondervereinbarungI3D <= 0 THEN NULL ELSE AP.SondervereinbarungI3D END AS SpecialAgreementI3D
	,CONVERT(DECIMAL(9,2), ROUND(ISNULL(AP.MwstSatz,0),2)) AS VATRate
	,CASE WHEN AP.Kostenstelle <= 0 THEN NULL ELSE AP.Kostenstelle END AS CostCenterI3D
	,CASE WHEN AP.Kostentraeger <= 0 THEN NULL ELSE AP.Kostentraeger END AS CostObjectI3D
	,CASE WHEN YEAR(ISNULL(AP.Lieferdatum, 0)) < 1905 THEN NULL ELSE AP.Lieferdatum END AS DeliveryDate
	,CASE WHEN YEAR(ISNULL(AP.Benachrichtigungsdatum, 0)) < 1905 THEN NULL ELSE  AP.Benachrichtigungsdatum END AS NotificationDate
	,AP.ErloesKTO AS RevenueAccount
	,ISNULL(AP.Visible, 1) AS Visible
	,AP.FontStyle
	,CASE WHEN AP.FontSize <= 0 THEN 9 ELSE AP.FontSize END AS FontSize
	,AP.FontName
	,AP.FontColor
	,AP.Code AS ArticleCode
	,AP.EANCode AS EANCode
	,AP.HerstCode AS ManufacturerCode
	,0 AS ShowImage
	,AP.UrsprungEK AS OriginalPurchasePrice
	,AP.EKGrund AS ReasonForCustomPurchasePrice
	,AP.Ursprung AS OriginReceiptItemI3D
	,AP.UrsprungI3D AS OriginReceiptI3D
	,AP.UrsprungArt AS OriginKind
	,CASE WHEN AP.Art NOT IN (1,3) THEN NULL WHEN ISNULL(AP.NebenlagerI3D, 0) <= 0 THEN -1 ELSE AP.NebenlagerI3D END AS WarehouseI3D
	,ISNULL(AP.Abbuchung, 0) AS ChangeStock
	,'' AS PurchaseInformations
    ,AP.WEEE AS WEEE
	,AP.Kundenkostenstelle AS CustomerCostCenter
	,AP.BestellNr AS PurchaseOrderNumber
	,ISNULL(AP.IsBillingPartList,0) AS IsBillingPartList
	,AP.ReceiptItemServiceArticleClassificationI3D
	,CASE WHEN AP.VertragI3D <= 0 THEN NULL ELSE AP.VertragI3D END AS ContractI3D
	,AP.UniqAusgleichsArtikelID AS BalanceID
	,ISNULL(AP.WertGutschrift, 0) AS OnlyPriceValue
	,AP.IsReverseCharge
	,AP.RMAPosI3D as RMAItemI3D
FROM dbo.GutPosVersions AS AP
GO
/****** Object:  View [dbo].[cvw_CustomerUnpaidInvoices]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[cvw_CustomerUnpaidInvoices]
AS
WITH MainQuery AS (
SELECT
	RC.AccountI3D
	,RC.ObjectI3D
	,RC.ObjectKind
	,RC.State
	,RC.Number
	,RC.GrossPriceComplete
	,RC.IsUnattachedCreditVoucher
	,RC.CreditVoucherGrossAmount
	,CASE WHEN RC.PayedGrossAmount < 0 THEN 0 ELSE RC.PayedGrossAmount END AS PayedGrossAmount
	,CASE WHEN RC.State = 1 THEN RC.GrossPriceComplete - CASE WHEN RC.PayedGrossAmount < 0 THEN 0 ELSE RC.PayedGrossAmount END ELSE 0 END AS CalculationAmount
	,RC.CurrencyString
	,RC.CurrencyFactor
	,RC.AdditionalText
	,Rc.DueInDays
FROM (
	-- Liefert alle nicht bezahlten Rechnungen
	SELECT
		IH.CustomerI3D AS AccountI3D
		,IH.I3D AS ObjectI3D
		,4 AS ObjectKind
		,IH.State
		,IH.Date
		,IH.Number
		,IH.NetPriceFCComplete + IH.TaxPriceFCComplete AS GrossPriceComplete
		,0 AS IsUnattachedCreditVoucher
		,(IH.NetPriceFCComplete + IH.TaxPriceFCComplete) - (IH.NetPriceFC + IH.TaxPriceFC) AS CreditVoucherGrossAmount
		,CONVERT(DECIMAL(19,2),ISNULL(IH.Payed,0) - ((IH.NetPriceFCComplete + IH.TaxPriceFCComplete) - (IH.NetPriceFC + IH.TaxPriceFC))) AS PayedGrossAmount
		,IH.CurrencyString
		,IH.CurrencyFactor
		,IH.AdditionalText
		,DATEDIFF(day, I.PaymentDueDate, GETDATE()) AS DueInDays
	FROM cvw_InvoiceHead IH
	INNER JOIN Invoices I ON I.I3D = IH.I3D
	WHERE
		IH.State = 1 AND
		IH.Number <> 0
	UNION ALL
	-- Dieser Part holt alle Wertgutschriftsbeträge, von offenen Wertgutschriften die noch nicht zu Rechnungen zugeordnet wurden (Positionen)
	SELECT
		PosData.AccountI3D
		,PosData.ObjectI3D
		,PosData.ObjectKind
		,PosData.State
		,PosData.Date
		,PosData.Number
		,ROUND(SUM(PosData.GrossPriceComplete),2)
		,PosData.IsUnattachedCreditVoucher
		,0 AS CreditVoucherGrossAmount
		,0 AS PayedGrossAmount
		,PosData.CurrencyString
		,PosData.CurrencyFactor
		,PosData.AdditionalText
		,PosData.DueInDays
	FROM(
		SELECT
			CH.CustomerI3D AS AccountI3D
			,CH.I3D AS ObjectI3D
			,6 AS ObjectKind
			,CH.State
			,CH.Date
			,CH.Number
			,SUM(CP.NetPriceTotalFC + CP.TaxPriceTotalFC) AS GrossPriceComplete
			,ISNULL(GK.WertGutschrift,0) AS IsUnattachedCreditVoucher
			,CH.CurrencyString
			,CH.CurrencyFactor
			,CP.VATRate
			,CH.AdditionalText
			,0 AS DueInDays
		FROM cvw_CreditVoucherHead CH
		INNER JOIN GutKopf GK ON GK.I3D = CH.I3D AND GK.WertGutschrift = 1
		INNER JOIN GutPos GP ON GP.GutKopfI3D = GK.I3D AND GP.Art IN (1,3) AND (GP.Expanded IS NULL) AND (ISNULL(GP.Ursprung,0) <= 0)
		INNER JOIN cvw_CreditVoucherPos CP ON CP.I3D = GP.I3D
		WHERE CH.State = 1
		GROUP BY
			CH.CustomerI3D
			,CH.I3D
			,CH.State
			,CH.Date
			,CH.Number
			,ISNULL(GK.WertGutschrift,0)
			,CH.CurrencyString
			,CH.CurrencyFactor
			,CP.VATRate
			,CH.AdditionalText
		) AS PosData
		GROUP BY
			PosData.AccountI3D
			,PosData.ObjectI3D
			,PosData.ObjectKind
			,PosData.State
			,PosData.Date
			,PosData.Number
			,PosData.IsUnattachedCreditVoucher
			,PosData.CurrencyString
			,PosData.CurrencyFactor
			,PosData.AdditionalText
			,PosData.DueInDays
		) AS RC
)
SELECT
	MainQuery.AccountI3D
	,MainQuery.ObjectI3D
	,MainQuery.ObjectKind
	,MainQuery.State
	,MainQuery.Number
	,MainQuery.GrossPriceComplete
	,MainQuery.IsUnattachedCreditVoucher
	,MainQuery.CreditVoucherGrossAmount
	,MainQuery.PayedGrossAmount
	,MainQuery.CalculationAmount
	,MainQuery.CurrencyString
	,MainQuery.CurrencyFactor
	,NULL AS OriginInvoiceNumber
	,MainQuery.AdditionalText
	,MainQuery.DueInDays
FROM MainQuery
UNION ALL
-- Liefert die Gutschriften zu OPOS Rechnungen (zwecks Nachvollziehbarkeit)
SELECT
	PosData.AccountI3D
	,PosData.ObjectI3D
	,PosData.ObjectKind
	,PosData.Status
	,PosData.Number
	,ROUND(SUM(PosData.GrossPriceComplete),2)
	,PosData.IstWertGutschrift
	,0 AS CreditVoucherGrossAmount
	,0 AS PayedGrossAmount
	,CASE WHEN (PosData.Status = 1) THEN ROUND(SUM(PosData.GrossPriceComplete),2) ELSE 0 END AS CalculationAmount
	,PosData.CurrencyString
	,PosData.CurrencyFactor
	,PosData.UrsprungNr AS OriginInvoiceNumber
	,PosData.AdditionalText
	,PosData.DueInDays
FROM(
	SELECT
		CH.CustomerI3D AS AccountI3D
		,CH.I3D AS ObjectI3D
		,6 AS ObjectKind
		,CH.State AS Status
		,CH.Number
		,SUM(CP.NetPriceTotalFC + CP.TaxPriceTotalFC) AS GrossPriceComplete
		,ISNULL(GP.WertGutschrift,0) AS IstWertGutschrift
		,CH.CurrencyString
		,CH.CurrencyFactor
		,CP.VATRate
		,CASE WHEN GP.UrsprungNr <= 0 THEN NULL ELSE GP.UrsprungNr END AS UrsprungNr
		,CH.AdditionalText
		,0 as DueInDays
	FROM cvw_CreditVoucherHead CH
	INNER JOIN GutKopf GK ON GK.I3D = CH.I3D
	INNER JOIN GutPos GP ON GP.GutKopfI3D = GK.I3D
	INNER JOIN cvw_CreditVoucherPos CP ON CP.I3D = GP.I3D
	WHERE GK.Status = 1
	AND GP.Art IN (1,3)
	AND GP.Expanded IS NULL
	AND ISNULL(GP.UrsprungNr,0) > 0
	GROUP BY
		CH.CustomerI3D
		,CH.I3D
		,CH.Date
		,CH.State
		,CH.Number
		,ISNULL(GP.WertGutschrift,0)
		,CH.CurrencyString
		,CH.CurrencyFactor
		,CP.VATRate
		,CASE WHEN GP.UrsprungNr <= 0 THEN NULL ELSE GP.UrsprungNr END
		,CH.AdditionalText
) AS PosData
GROUP BY
	PosData.AccountI3D
	,PosData.ObjectI3D
	,PosData.ObjectKind
	,PosData.Status
	,PosData.Number
	,PosData.IstWertGutschrift
	,PosData.CurrencyString
	,PosData.CurrencyFactor
	,PosData.UrsprungNr
	,PosData.AdditionalText
	,PosData.DueInDays
      
GO
/****** Object:  Table [dbo].[AngKopfVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngKopfVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[Datum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](128) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlKondID] [int] NULL,
	[LieferbedID] [int] NULL,
	[Status] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[Import] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[LeasingMonate] [int] NULL,
	[LeasingSatz] [float] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LeasingRate] [float] NULL,
	[Leasing] [int] NULL,
	[LeasingGebuehr] [float] NULL,
	[Angebotklasse] [int] NULL,
	[ProjektEnde] [datetime] NULL,
	[AngebKlassifI3D] [int] NULL,
	[Projektnummer] [varchar](50) NULL,
	[AngUeberschrift] [varchar](70) NULL,
	[ToDoI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[Bar] [int] NULL,
	[AbschlGrund] [varchar](1000) NULL,
	[AbschlI3D] [int] NULL,
	[ZahlKondRechI3D] [int] NULL,
	[OriginalI3D] [int] NULL,
	[DocDirI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](1000) NULL,
	[RechnungskonditionsText] [varchar](1000) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[LockUserI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[BestNr] [varchar](50) NULL,
	[Zusatztext] [varchar](50) NULL,
	[Direktlieferung] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[Lieferdatum] [datetime] NULL,
	[LiefKundFremd] [int] NULL,
	[LSuREvVersand] [int] NULL,
	[ProjNr] [varchar](50) NULL,
	[RechKundFremd] [int] NULL,
	[Teillieferung] [int] NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[LcmStatus] [int] NULL,
	[GUI3D] [uniqueidentifier] NULL,
	[ErstelltAusI3D] [int] NULL,
	[ErstelltAusArt] [int] NULL,
	[ErstelltAusNummer] [int] NULL,
	[Rabatt] [float] NULL,
	[SummeEKOriginal] [float] NULL,
	[KostenstellenI3D] [int] NULL,
	[IsPositionProvision] [bit] NULL,
	[ServiceMonate] [int] NULL,
	[ServiceSatz] [float] NULL,
	[ServiceRate] [float] NULL,
	[IsServiceShare] [int] NULL,
	[ServiceGebuehr] [float] NULL,
	[CalculatedNetPrice] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedTaxPriceFC] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePrice] [decimal](19, 2) NOT NULL,
	[CalculatedNetPurchasePriceFC] [decimal](19, 2) NOT NULL,
	[LeasingPosSatz] [numeric](5, 2) NULL,
	[ServicePosSatz] [numeric](5, 2) NULL,
	[CustomLeasingPosSatz] [bit] NULL,
	[CustomServicePosSatz] [bit] NULL,
	[CustomLeasingSatz] [bit] NULL,
	[CustomServiceSatz] [bit] NULL,
	[IsPosCalculation] [bit] NULL,
	[VertragsI3D] [int] NULL,
	[CurrencyFactorIsFixed] [bit] NULL,
	[CampaignI3D] [int] NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[IsCart] [bit] NOT NULL,
	[CartName] [nvarchar](250) NULL,
	[CartDescription] [nvarchar](4000) NULL,
	[CartCreatorContactPersonI3D] [int] NULL,
	[ContractTypeI3D] [int] NULL,
	[ContractPositionCombinationDecision] [int] NOT NULL,
	[TakeOnlyArticles] [bit] NOT NULL,
	[CartAssembleArticles] [bit] NOT NULL,
	[CartState] [nvarchar](100) NULL,
	[ReceiptReceiverI3D] [int] NULL,
	[ReceiptReceiverInvoiceI3D] [int] NULL,
	[ReceiptReceiverDeliveryI3D] [int] NULL,
	[ReceiptReceiverLicenseI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[OfferVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[OfferVersions] AS
SELECT A.I3D
	,A.OriginalI3D
	,A.Nummer AS Number
	,A.BestNr AS PurchaseOrderNumber
	,A.Datum AS Date
	,A.AngUeberschrift AS AdditionalText
	,A.Version
	,ISNULL(A.Empfanger, '') AS Receiver
	,ISNULL(A.Tel, '') AS Phone
	,ISNULL(A.Fax, '') AS Fax
	,ISNULL(A.Mail, '') AS Email
	,CASE WHEN A.FilialI3D <= 0 THEN NULL ELSE A.FilialI3D END AS BranchI3D
	,ISNULL(A.FilialgeberI3D, 0) AS BranchOrigin
	,CASE WHEN ISNULL(A.KundenID, 0) <= 0 THEN 0 ELSE A.KundenID END AS CustomerI3D
	,CASE WHEN A.AnschriftID <= 0 THEN NULL ELSE A.AnschriftID END AS AddressI3D
	,CASE WHEN A.PersonID <= 0 THEN NULL ELSE A.PersonID END AS ContactPersonI3D
	,CASE WHEN A.BearbeiterI3D <= 0 THEN NULL ELSE A.BearbeiterI3D END AS EditorI3D
	,ISNULL(A.MwStNichtAusweisbar, 0) AS ExclusiveOfVAT
	,A.Projektnummer AS ProjectNumber
	,CASE WHEN A.AussendienstID <= 0 THEN NULL ELSE A.AussendienstID END AS SalesRepresentativeI3D
	,CASE WHEN A.InnendienstID <= 0 THEN NULL ELSE A.InnendienstID END AS OfficeStaffI3D
	,CASE WHEN A.ErstellerI3D <= 0 THEN NULL ELSE A.ErstellerI3D END AS CreatedByI3D
	,CASE WHEN YEAR(ISNULL(A.ErstelltDatum,0)) < 1905 THEN NULL ELSE A.ErstelltDatum END AS CreatedAt
    ,ISNULL (A.CentronVersion, '') AS CreatedThroughApplicationVersion
	,CASE WHEN A.GeaendertVonI3D <= 0 THEN NULL ELSE A.GeaendertVonI3D END AS ChangedByI3D
	,CASE WHEN YEAR(ISNULL(A.GeaendertDatum, 0)) < 1905 THEN NULL ELSE A.GeaendertDatum END AS ChangedAt
    ,ISNULL(A.GeaendertVersion, '') AS ChangedThroughApplicationVersion
    ,ISNULL(A.ErstelltDurch, 0) AS ChangedThroughApplication
	,A.Status AS State
	,CASE WHEN YEAR(ISNULL(A.Lieferdatum, 0)) < 1905 THEN NULL ELSE A.Lieferdatum END AS DeliveryDate
	,CASE WHEN A.ZahlKondID <= 0 THEN NULL ELSE A.ZahlKondID END AS ReceiptConditionI3D
	,A.ZahlKond AS ReceiptConditionText
	,CASE WHEN A.LieferbedID <= 0 THEN NULL ELSE A.LieferbedID END AS DeliveryConditionI3D
	,A.LieferbedingungsText AS DeliveryConditionText
	,CASE WHEN A.ZahlKondRechI3D <= 0 THEN NULL ELSE A.ZahlKondRechI3D END AS PaymentConditionI3D
	,A.RechnungskonditionsText AS PaymentConditionText
	,LTRIM(A.LiefKundEmpfaenger) AS DeliveryAddress
	,CASE WHEN A.LiefKundI3D <= 0 THEN NULL ELSE A.LiefKundI3D END AS DeliveryAddressCustomerI3D
	,CASE WHEN A.LiefKundAnschriftI3D <= 0 THEN NULL ELSE A.LiefKundAnschriftI3D END AS DeliveryAddressAddressI3D
	,CASE WHEN A.LiefKundPersonI3D <= 0 THEN NULL ELSE A.LiefKundPersonI3D END AS DeliveryAddressContactPersonI3D
	,A.LiefKundInfo AS DeliveryAddressInformation
	,LTRIM(A.RechKundEmpfaenger) AS InvoiceAddress
	,CASE WHEN A.RechKundI3D <= 0 THEN NULL ELSE A.RechKundI3D END AS InvoiceAddressCustomerI3D
	,CASE WHEN A.RechKundAnschriftI3D <= 0 THEN NULL ELSE A.RechKundAnschriftI3D END AS InvoiceAddressAddressI3D
	,CASE WHEN A.RechKundPersonI3D <= 0 THEN NULL ELSE A.RechKundPersonI3D END AS InvoiceAddressContactPersonI3D
	,A.RechKundInfo AS InvoiceAddressInformation
	,CASE WHEN YEAR(ISNULL(A.WVorlage,0)) < 1905 THEN NULL ELSE A.WVorlage END AS ReminderDate
	,CASE WHEN YEAR(ISNULL(A.Bereitstellung, 0)) < 1905 THEN NULL ELSE A.Bereitstellung END AS PreparationDate
	,CASE WHEN ISNULL(A.CurrencyI3D, 0) <= 0 THEN NULL ELSE A.CurrencyI3D END AS CurrencyI3D
	,ISNULL(A.CurrencyFactor, 1) AS CurrencyFactor
	,ISNULL(A.CurrencyString, '€') AS CurrencyString
	,ISNULL(A.Bar, 0) AS IsCashAsset
	,CASE WHEN ISNULL(A.LandI3D, 0) <= 0 THEN NULL ELSE A.LandI3D END AS CountryI3D
	,ISNULL(A.Info, '') AS Information
	,ISNULL(A.InfoAnzeigen, 0) AS ShowInformation
	,ISNULL(A.Strasse, '') AS Street
	,ISNULL(A.PostfachAktiv, 0) AS HasPostOfficeBox
	,ISNULL(A.Postfach, '') AS PostOfficeBox
	,ISNULL(A.PLZ, '') AS Zip
	,ISNULL(A.Ort, '') AS City
	,ISNULL(A.Ansprech, '') AS ContactName
	,CASE WHEN A.KostenstellenI3D <= 0 THEN NULL ELSE A.KostenstellenI3D END AS CostCenterI3D
	,CASE WHEN A.KostentraegerI3D <= 0 THEN NULL ELSE A.KostentraegerI3D END AS CostObjectI3D
	,CASE WHEN A.DocDirI3D <= 0 THEN NULL ELSE A.DocDirI3D END AS DirectoryI3D
	,ISNULL(A.Teillieferung,0) AS IsPartialDeliveryPossible
    ,CASE WHEN A.ToDoI3D <= 0 THEN NULL ELSE A.ToDoI3D END AS ToDoI3D
    ,LTRIM(A.LizenznehmerKundEmpfaenger) AS LicenseeAddress
    ,CASE WHEN A.LizenznehmerKundI3D <= 0 THEN NULL ELSE A.LizenznehmerKundI3D END AS LicenseeAddressCustomerI3D
    ,CASE WHEN A.LizenznehmerKundAnschriftI3D <= 0 THEN NULL ELSE A.LizenznehmerKundAnschriftI3D END AS LicenseeAddressAddressI3D
    ,CASE WHEN A.LizenznehmerKundPersonI3D <= 0 THEN NULL ELSE A.LizenznehmerKundPersonI3D END AS LicenseeAddressContactPersonI3D
    ,A.LizenznehmerKundInfo AS LicenseeAddressInformation
    ,CASE WHEN YEAR(ISNULL(A.ProjektEnde,0)) < 1905 THEN NULL ELSE A.ProjektEnde END AS ProjectEnd
    ,CASE WHEN A.Angebotklasse <= 0 THEN NULL ELSE A.Angebotklasse END AS ProbabilityClassificationI3D
    ,CASE WHEN A.AngebKlassifI3D <= 0 THEN NULL ELSE A.AngebKlassifI3D END AS ProductGroupClassificationI3D
	,ISNULL(A.Leasing, 0) AS IsLeasingActive
	,ISNULL(A.LeasingGebuehr, 0) AS LeasingFee
	,ISNULL(A.LeasingMonate, 0) AS LeasingMonths
	,ISNULL(A.LeasingSatz, 0) AS LeasingRatePercent
	,ISNULL(A.LeasingRate, 0) AS LeasingRatePerMonth
	,ISNULL(A.IsServiceShare, 0) AS IsServiceActive
	,ISNULL(A.ServiceGebuehr, 0) AS ServiceFee
	,ISNULL(A.ServiceMonate, 0) AS ServiceMonths
	,ISNULL(A.ServiceSatz, 0) AS ServiceRatePercent
	,ISNULL(A.ServiceRate, 0) AS ServiceRatePerMonth
	,CASE WHEN A.AbschlI3D <= 0 THEN NULL ELSE A.AbschlI3D END AS CompleteReasonI3D
	,A.AbschlGrund AS CompleteReasonText
	,A.VertragsI3D AS ContractI3D
	,ISNULL(A.CurrencyFactorIsFixed, 0) AS CurrencyFactorIsFixed
	,A.GUI3D AS ConcurrencyControlGuid
	,A.CampaignI3D
	,A.ReceiptUserStateI3D
	,A.IsCart
	,A.CartName
	,A.CartDescription
	,A.CartCreatorContactPersonI3D
	,A.CartAssembleArticles
	,A.CartState
	,A.ReceiptReceiverI3D
	,A.ReceiptReceiverInvoiceI3D
	,A.ReceiptReceiverDeliveryI3D
	,A.ReceiptReceiverLicenseI3D
FROM dbo.AngKopfVersions AS A
GO
/****** Object:  Table [dbo].[Bundesland]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Bundesland](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bundesland] [varchar](255) NULL,
	[LaenkennI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Mandant]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mandant](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Mandant] [varchar](255) NULL,
	[Anschrift] [varchar](255) NULL,
	[HRB] [varchar](20) NULL,
	[Bei] [varchar](60) NULL,
	[Geschaeftsfuehrer] [varchar](255) NULL,
	[Tel] [varchar](22) NULL,
	[Fax] [varchar](22) NULL,
	[EMail] [varchar](255) NULL,
	[WWW] [varchar](255) NULL,
	[Bank1] [varchar](60) NULL,
	[BLZ1] [varchar](40) NULL,
	[Konto1] [varchar](40) NULL,
	[Bank2] [varchar](60) NULL,
	[BLZ2] [varchar](40) NULL,
	[Konto2] [varchar](40) NULL,
	[Kopfzeile] [varchar](100) NULL,
	[UStID] [varchar](20) NULL,
	[Bank3] [varchar](60) NULL,
	[BLZ3] [varchar](40) NULL,
	[Konto3] [varchar](40) NULL,
	[Bank4] [varchar](60) NULL,
	[BLZ4] [varchar](40) NULL,
	[Konto4] [varchar](40) NULL,
	[Pool] [int] NULL,
	[AngeNr] [int] NULL,
	[KaufNr] [int] NULL,
	[ProfNr] [int] NULL,
	[RechNr] [int] NULL,
	[LeihNr] [int] NULL,
	[MietNr] [int] NULL,
	[Bank1L] [int] NULL,
	[Bank2L] [int] NULL,
	[Bank3L] [int] NULL,
	[Bank4L] [int] NULL,
	[Status] [int] NULL,
	[MietAngeNr] [int] NULL,
	[Land] [int] NULL,
	[Bild] [image] NULL,
	[Bild2] [image] NULL,
	[Verzeichnis] [varchar](50) NULL,
	[Lieferscheinnummer] [int] NULL,
	[Rechnungsnummer] [int] NULL,
	[Abholscheinnummer] [int] NULL,
	[Gutschriftnummer] [int] NULL,
	[UmstNr] [varchar](30) NULL,
	[Strasse] [varchar](80) NULL,
	[PLZ] [varchar](10) NULL,
	[Ort] [varchar](60) NULL,
	[PLZPostfach] [varchar](10) NULL,
	[Postfach] [varchar](20) NULL,
	[IBAN1] [varchar](40) NULL,
	[BIC1] [varchar](40) NULL,
	[IBAN2] [varchar](40) NULL,
	[BIC2] [varchar](40) NULL,
	[IBAN3] [varchar](40) NULL,
	[BIC3] [varchar](40) NULL,
	[IBAN4] [varchar](40) NULL,
	[BIC4] [varchar](40) NULL,
	[Bild3] [image] NULL,
	[Bild4] [image] NULL,
	[Bild5] [image] NULL,
	[Bild6] [image] NULL,
	[Bild7] [image] NULL,
	[Bild8] [image] NULL,
	[Bild1Breite] [int] NULL,
	[Bild1Hoehe] [int] NULL,
	[Bild1Zentriert] [int] NULL,
	[Bild1Gestreckt] [int] NULL,
	[Bild1Proportional] [int] NULL,
	[Bild2Breite] [int] NULL,
	[Bild2Hoehe] [int] NULL,
	[Bild2Zentriert] [int] NULL,
	[Bild2Gestreckt] [int] NULL,
	[Bild2Proportional] [int] NULL,
	[Bild3Breite] [int] NULL,
	[Bild3Hoehe] [int] NULL,
	[Bild3Zentriert] [int] NULL,
	[Bild3Gestreckt] [int] NULL,
	[Bild3Proportional] [int] NULL,
	[Bild4Breite] [int] NULL,
	[Bild4Hoehe] [int] NULL,
	[Bild4Zentriert] [int] NULL,
	[Bild4Gestreckt] [int] NULL,
	[Bild4Proportional] [int] NULL,
	[Bild5Breite] [int] NULL,
	[Bild5Hoehe] [int] NULL,
	[Bild5Zentriert] [int] NULL,
	[Bild5Gestreckt] [int] NULL,
	[Bild5Proportional] [int] NULL,
	[Bild6Breite] [int] NULL,
	[Bild6Hoehe] [int] NULL,
	[Bild6Zentriert] [int] NULL,
	[Bild6Gestreckt] [int] NULL,
	[Bild6Proportional] [int] NULL,
	[Bild7Breite] [int] NULL,
	[Bild7Hoehe] [int] NULL,
	[Bild7Zentriert] [int] NULL,
	[Bild7Gestreckt] [int] NULL,
	[Bild7Proportional] [int] NULL,
	[Bild8Breite] [int] NULL,
	[Bild8Hoehe] [int] NULL,
	[Bild8Zentriert] [int] NULL,
	[Bild8Gestreckt] [int] NULL,
	[Bild8Proportional] [int] NULL,
	[Farbe1] [int] NULL,
	[Farbe2] [int] NULL,
	[Farbe3] [int] NULL,
	[Inhaber1] [nvarchar](250) NULL,
	[Inhaber2] [nvarchar](250) NULL,
	[Inhaber3] [nvarchar](250) NULL,
	[Inhaber4] [nvarchar](250) NULL,
	[Zusatztext1] [varchar](500) NULL,
	[Zusatztext2] [varchar](500) NULL,
	[Zusatztext3] [varchar](500) NULL,
	[FilialI3D] [int] NULL,
	[MandantI3D] [int] NULL,
	[Standard] [int] NULL,
	[FettText1] [int] NULL,
	[FettText2] [int] NULL,
	[FettText3] [int] NULL,
	[GroesseText1] [int] NULL,
	[GroesseText2] [int] NULL,
	[GroesseText3] [int] NULL,
	[StretchedText1] [int] NULL,
	[StretchedText2] [int] NULL,
	[StretchedText3] [int] NULL,
	[StretchedRTF] [int] NULL,
	[DruckenText1] [int] NULL,
	[DruckenText2] [int] NULL,
	[DruckenText3] [int] NULL,
	[DruckenRTF] [int] NULL,
	[AusrichtungText1] [int] NULL,
	[AusrichtungText2] [int] NULL,
	[AusrichtungText3] [int] NULL,
	[ZusatztextRTF] [text] NULL,
	[andereGroesseText1] [int] NULL,
	[andereGroesseText2] [int] NULL,
	[andereGroesseText3] [int] NULL,
	[Text1FormatierungI3D] [int] NULL,
	[Text2FormatierungI3D] [int] NULL,
	[Text3FormatierungI3D] [int] NULL,
	[TextRTFFormatierungI3D] [int] NULL,
	[Bild1Links] [int] NULL,
	[Bild1Oben] [int] NULL,
	[Bild2Links] [int] NULL,
	[Bild2Oben] [int] NULL,
	[Bild3Links] [int] NULL,
	[Bild3Oben] [int] NULL,
	[Bild4Links] [int] NULL,
	[Bild4Oben] [int] NULL,
	[Bild5Links] [int] NULL,
	[Bild5Oben] [int] NULL,
	[Bild6Links] [int] NULL,
	[Bild6Oben] [int] NULL,
	[Bild7Links] [int] NULL,
	[Bild7Oben] [int] NULL,
	[Bild8Links] [int] NULL,
	[Bild8Oben] [int] NULL,
	[BundeslandI3D] [int] NULL,
	[Bank1PLZ] [varchar](10) NULL,
	[Bank1Ort] [varchar](60) NULL,
	[Bank2PLZ] [varchar](10) NULL,
	[Bank2Ort] [varchar](60) NULL,
	[Bank3PLZ] [varchar](10) NULL,
	[Bank3Ort] [varchar](60) NULL,
	[Bank4PLZ] [varchar](10) NULL,
	[Bank4Ort] [varchar](60) NULL,
	[BankFuerESRVerwenden] [int] NULL,
	[Bank1Index] [varchar](25) NULL,
	[Bank2Index] [varchar](25) NULL,
	[Bank3Index] [varchar](25) NULL,
	[Bank4Index] [varchar](25) NULL,
	[HRBOderHRA] [int] NULL,
	[SepaIdentificationNumber] [nvarchar](64) NULL,
	[CustomerI3D] [int] NULL,
	[CompanyInfo] [nvarchar](4000) NULL,
	[BankOneAssignmentNotice] [nvarchar](500) NULL,
	[BankTwoAssignmentNotice] [nvarchar](500) NULL,
	[BankThreeAssignmentNotice] [nvarchar](500) NULL,
	[BankFourAssignmentNotice] [nvarchar](500) NULL,
 CONSTRAINT [PK_Mandant] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  View [dbo].[cvw_Company]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[cvw_Company] 
AS
SELECT 
	M.I3D
	,ISNULL(M.Status,1) AS Status
	,ISNULL(M.Standard,0) AS IsDefault
	,M.Mandant AS Name
	,M.Strasse AS Street
	,M.PLZ AS Zip
	,M.Ort AS City
	,M.PLZPostfach AS ZipPostOfficeBox
	,M.Postfach AS PostOfficeBox
	,M.Anschrift AS AddressComplete
	,M.Kopfzeile AS SingleRowAddressComplete
	,M.Tel AS Phone
	,M.EMail AS EMail
	,M.WWW AS WebSite
	,M.Geschaeftsfuehrer AS CEO
	,M.UStID AS VATin
	,M.UmstNr AS TaxNumber
	,M.HRB AS CommercialRegister
	,M.Bei AS CommercialRegisterLocation
	,M.SepaIdentificationNumber
	,L.I3D AS CountryI3D
	,L.Land AS CountryName
	,L.Kurzzeichen AS CountryCode
	,L.PlzKurz AS CountryCodeShort
	,L.Waehrung AS CurrencyName
	,L.Zeichen AS CurrencySymbol
	,B.I3D AS FederalStateI3D
	,B.Bundesland AS FederalStateName
FROM Mandant M
INNER JOIN Laenkenn L ON L.I3D = CASE WHEN ISNULL(M.Land,0) <= 0 THEN (SELECT TOP 1 I3D FROM Laenkenn WHERE Standard = 1) ELSE M.Land END
LEFT OUTER JOIN Bundesland B ON B.I3D = M.BundeslandI3D
GO
/****** Object:  Table [dbo].[AbholKopfErweitert]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbholKopfErweitert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AbholkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AbholKopfErweitert] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AbholKopfErweitertVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbholKopfErweitertVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AbholkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[OriginalI3D] [int] NULL,
	[Version] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AbholProv]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbholProv](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AbholKopfI3D] [int] NULL,
	[AbholNummer] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Provision] [float] NULL,
	[Status] [int] NULL,
	[Standard] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Abteilung]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Abteilung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Abteilung] [varchar](50) NULL,
	[Kommentar] [varchar](5000) NULL,
	[Status] [int] NULL,
	[RepGroup] [varchar](3) NULL,
 CONSTRAINT [PK_Abteilung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AbtTaetigkeiten]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbtTaetigkeiten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Kostenstelle] [int] NULL,
	[Status] [int] NULL,
	[Beschreibung] [varchar](500) NULL,
	[Farbe] [varchar](50) NULL,
	[ArtikelI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AbtTaetigkeitenZuordnung]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbtTaetigkeitenZuordnung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AbtI3D] [int] NULL,
	[TaetI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AbweichendeAnschrift]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AbweichendeAnschrift](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[AnschriftArt] [int] NULL,
	[OriginalKundenI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountActivityForReceipt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountActivityForReceipt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptKind] [int] NOT NULL,
	[ReceiptI3D] [int] NOT NULL,
	[AccountActivityI3D] [int] NOT NULL,
	[ReceiptNumber] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Index [CI_AccountActivityForReceipt_ReceiptKind_ReceiptI3D_AccountActivityI3D]    Script Date: 11.11.2025 11:20:26 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_AccountActivityForReceipt_ReceiptKind_ReceiptI3D_AccountActivityI3D] ON [dbo].[AccountActivityForReceipt]
(
	[ReceiptKind] ASC,
	[ReceiptI3D] ASC,
	[AccountActivityI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountActivityProcessLogs]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountActivityProcessLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProcessActivityI3D] [int] NOT NULL,
	[AccountActivityKind] [int] NULL,
	[Kind] [nvarchar](100) NOT NULL,
	[Caption] [nvarchar](200) NOT NULL,
	[Text] [nvarchar](max) NOT NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedVersion] [varchar](16) NOT NULL,
 CONSTRAINT [PK_AccountActivityProcessLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountActivityTemplates]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountActivityTemplates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[Configuration] [nvarchar](max) NULL,
 CONSTRAINT [PK_ActivityTemplates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountArticleSpecialPricesImportSettings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountArticleSpecialPricesImportSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CentronColumn] [int] NOT NULL,
	[ColumnName] [nvarchar](500) NOT NULL,
	[IsActiveForImport] [bit] NOT NULL,
 CONSTRAINT [PK_AccountArticleSpecialPricesImportSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountBusinessLine]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountBusinessLine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[BusinessLineI3D] [int] NOT NULL,
 CONSTRAINT [PK_AccountBusinessLine] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountContractKinds]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountContractKinds](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](256) NULL,
	[BranchI3D] [int] NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedAt] [datetime2](0) NOT NULL,
	[CreatedVersion] [nvarchar](20) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedAt] [datetime2](0) NOT NULL,
	[ChangedVersion] [nvarchar](20) NOT NULL,
	[NetTotalPrice] [decimal](19, 2) NULL,
	[GrossTotalPrice] [decimal](19, 2) NULL,
	[CurrencyI3D] [int] NULL,
	[CurrencyFactor] [decimal](9, 2) NULL,
	[CurrencyString] [nvarchar](10) NULL,
	[CountryI3D] [int] NULL,
	[IsDeleted] [bit] NOT NULL,
	[Information] [nvarchar](4000) NULL,
	[Prolongation] [int] NULL,
	[AutomatedProlongation] [bit] NOT NULL,
	[TerminationDeadlineKind1] [int] NULL,
	[TerminationDeadlineKind2] [int] NULL,
	[TerminationDeadlineDuration1] [int] NULL,
	[TerminationDeadlineDuration2] [int] NULL,
	[TerminationKind] [int] NULL,
	[TerminationReason] [nvarchar](4000) NULL,
	[Duration] [int] NULL,
	[DurationKind] [int] NULL,
	[DurationTime] [int] NULL,
 CONSTRAINT [PK_AccountContractKinds] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountContracts]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountContracts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReferenceNumber] [nvarchar](255) NULL,
	[Name] [nvarchar](256) NULL,
	[Date] [datetime2](0) NOT NULL,
	[AdditionalText] [nvarchar](100) NULL,
	[Phone] [nvarchar](30) NULL,
	[Fax] [nvarchar](30) NULL,
	[Email] [nvarchar](255) NULL,
	[BranchI3D] [int] NULL,
	[AccountI3D] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedAt] [datetime2](0) NOT NULL,
	[CreatedVersion] [nvarchar](20) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedAt] [datetime2](0) NOT NULL,
	[ChangedVersion] [nvarchar](20) NOT NULL,
	[IsClosed] [bit] NOT NULL,
	[ReminderDate] [datetime2](0) NULL,
	[NetTotalPrice] [decimal](19, 2) NOT NULL,
	[GrossTotalPrice] [decimal](19, 2) NOT NULL,
	[CurrencyI3D] [int] NOT NULL,
	[CurrencyFactor] [decimal](9, 2) NOT NULL,
	[CurrencyString] [nvarchar](10) NOT NULL,
	[CountryI3D] [int] NOT NULL,
	[Information] [nvarchar](max) NULL,
	[DirectoryI3D] [int] NULL,
	[ToDoI3D] [int] NULL,
	[AccountContractKindI3D] [int] NULL,
	[ContractTermination] [datetime2](0) NULL,
	[ContractBegin] [datetime2](0) NULL,
	[ContractEnd] [datetime2](0) NULL,
	[Prolongation] [int] NULL,
	[AutomatedProlongation] [bit] NOT NULL,
	[TerminationDeadlineKind1] [int] NULL,
	[TerminationDeadlineKind2] [int] NULL,
	[TerminationDeadlineDuration1] [int] NULL,
	[TerminationDeadlineDuration2] [int] NULL,
	[TerminationKind] [int] NULL,
	[TerminationReason] [nvarchar](4000) NULL,
	[Duration] [int] NULL,
	[DurationKind] [int] NULL,
	[DurationTime] [int] NULL,
	[FinishDate] [datetime2](0) NULL,
	[EmployeeI3D] [int] NULL,
 CONSTRAINT [PK_AccountContracts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountCustomFilters]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountCustomFilters](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](200) NOT NULL,
	[IsPublic] [bit] NOT NULL,
	[IsStatic] [bit] NOT NULL,
	[CustomFilter] [varbinary](max) NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedVersion] [varchar](16) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[ChangedVersion] [varchar](16) NOT NULL,
	[OnlySearchResult] [bit] NOT NULL,
	[ObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[IsForSetting] [bit] NOT NULL,
 CONSTRAINT [PK_AccountCustomFilters] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [IC_AccountCustomFilters]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [IC_AccountCustomFilters] ON [dbo].[AccountCustomFilters]
(
	[CreatedByI3D] ASC,
	[IsPublic] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountCustomFilterStaticItems]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountCustomFilterStaticItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountCustomFilterI3D] [int] NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[AccountAddressI3D] [int] NOT NULL,
	[AccountAddressContactI3D] [int] NOT NULL,
 CONSTRAINT [PK_AccountCustomFilterStaticItems] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [IC_AccountCustomFilterStaticItems]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [IC_AccountCustomFilterStaticItems] ON [dbo].[AccountCustomFilterStaticItems]
(
	[AccountCustomFilterI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountDeviceLogs]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountDeviceLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountDeviceI3D] [int] NOT NULL,
	[Timestamp] [datetime2](2) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[Message] [nvarchar](1000) NOT NULL,
 CONSTRAINT [PK_AccountDeviceLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountDeviceUris]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountDeviceUris](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountDeviceI3D] [int] NOT NULL,
	[Kind] [int] NOT NULL,
	[Uri] [nvarchar](2000) NOT NULL,
 CONSTRAINT [PK_AccountDeviceUris] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountInterest]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountInterest](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[InterestI3D] [int] NOT NULL,
 CONSTRAINT [PK_AccountInterest] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountLogs]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[EmployeeShortSign] [nvarchar](10) NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[Message] [nvarchar](4000) NOT NULL,
	[ReferenceObjectI3D] [int] NULL,
	[ReferenceObjectKind] [int] NULL,
	[OldValue] [nvarchar](4000) NOT NULL,
	[NewValue] [nvarchar](4000) NOT NULL,
 CONSTRAINT [PK_AccountLogs] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_AccountLogs]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [CI_AccountLogs] ON [dbo].[AccountLogs]
(
	[AccountI3D] ASC,
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountProduct]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountProduct](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[ProductI3D] [int] NOT NULL,
	[Description] [nvarchar](250) NULL,
	[AmountLicence] [int] NOT NULL,
	[Active] [int] NOT NULL,
	[Carepack] [int] NOT NULL,
	[Resubmission] [datetime] NULL,
 CONSTRAINT [PK_AccountProduct] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountRelationships]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountRelationships](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[PartnerAccountI3D] [int] NOT NULL,
	[PartnerAccountContactI3D] [int] NOT NULL,
	[NotifyAtCrmActivities] [bit] NOT NULL,
	[NotifyAtOffers] [bit] NOT NULL,
	[NotifyAtOrders] [bit] NOT NULL,
	[SendMailThroughBcc] [bit] NOT NULL,
	[NotifyAtCrmActivitiesTo] [bit] NOT NULL,
	[NotifyAtCrmActivitiesBCC] [bit] NOT NULL,
 CONSTRAINT [PK_AccountRelationships] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_AccountRelationships]    Script Date: 11.11.2025 11:20:26 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_AccountRelationships] ON [dbo].[AccountRelationships]
(
	[PartnerAccountI3D] ASC,
	[AccountI3D] ASC,
	[PartnerAccountContactI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AccountVPNAccesses]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AccountVPNAccesses](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[Image] [image] NULL,
	[Name] [nvarchar](200) NOT NULL,
	[Path] [nvarchar](400) NOT NULL,
	[CommandLineParameters] [nvarchar](400) NULL,
	[ConnectionDuration] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ActImport]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ActImport](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CentronTable] [varchar](10) NULL,
	[CentronField] [varchar](20) NULL,
	[ActFieldLabel] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AddressContactPersonWebAccountRequests]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AddressContactPersonWebAccountRequests](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VerificationLink] [nvarchar](200) NULL,
	[LinkGenerationDateTime] [datetime] NULL,
	[AcceptanceLink] [nvarchar](200) NULL,
	[AcceptanceLinkGenerationDateTime] [datetime] NULL,
	[SalutationI3D] [int] NOT NULL,
	[Firstname] [nvarchar](200) NOT NULL,
	[Lastname] [nvarchar](200) NOT NULL,
	[EMail] [nvarchar](200) NOT NULL,
	[Password] [nvarchar](200) NOT NULL,
	[Street] [nvarchar](200) NULL,
	[Place] [nvarchar](200) NULL,
	[PLZ] [nvarchar](200) NULL,
	[AccountI3D] [int] NOT NULL,
	[ContactPersonI3D] [int] NULL,
	[State] [int] NOT NULL,
	[HelpdeskNumber] [int] NULL,
	[GUID] [nvarchar](64) NULL,
 CONSTRAINT [PK_AddressContactPersonWebAccountRequests] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AddressToAsset]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AddressToAsset](
	[AssetKind] [int] NOT NULL,
	[AssetI3D] [int] NOT NULL,
	[AddressKind] [int] NOT NULL,
	[AssetVersion] [int] NOT NULL,
	[OneWayContactI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AdminMessages]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AdminMessages](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[Art] [varchar](20) NULL,
	[Text] [varchar](1000) NULL,
	[Gelesen] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AdminMessages] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AGArbeitssicherheit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AGArbeitssicherheit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsgangI3D] [int] NULL,
	[ArbeitssicherheitI3D] [int] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AGArbeitssicherheit] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AGLohngruppe]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AGLohngruppe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsgangI3D] [int] NULL,
	[LohngruppeI3D] [int] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AGLohngruppe] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AGMaterial]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AGMaterial](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsgangI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Menge] [float] NULL,
	[EK] [float] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AGMaterial] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AGPrufvorschrift]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AGPrufvorschrift](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsgangI3D] [int] NULL,
	[PrufvorschriftI3D] [int] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AGPrufvorschrift] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AGUmweltschutz]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AGUmweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsgangI3D] [int] NULL,
	[UmweltschutzI3D] [int] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AGUmweltschutz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AktionArt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AktionArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AktionArtI3D] [int] NULL,
	[Text] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AktionArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Aktivitaet]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Aktivitaet](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Aktivitaet] [varchar](200) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Aktivitaet] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnfahrtZonen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnfahrtZonen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnfZone] [int] NULL,
	[Status] [int] NULL,
	[Komentar] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnfrKopfVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnfrKopfVersions](
	[I3D] [int] NOT NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[Datum] [datetime] NULL,
	[Lieferdatum] [datetime] NULL,
	[WiedervorlageDatum] [datetime] NULL,
	[WiedervorlageToDoI3D] [int] NULL,
	[Empfanger] [varchar](500) NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[LieferEmpfanger] [varchar](500) NULL,
	[LieferKreditorI3D] [int] NULL,
	[LieferAnschriftI3D] [int] NULL,
	[LieferPersonI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](100) NULL,
	[LandI3D] [int] NULL,
	[WaehrungI3D] [int] NULL,
	[WaehrungsKursZuEuro] [float] NULL,
	[Notiz] [text] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[Lockuser] [nvarchar](50) NULL,
	[Status] [int] NULL,
	[BVLGenerated] [int] NULL,
	[Direktlieferung] [int] NULL,
	[LockUserI3D] [int] NULL,
	[Bar] [int] NULL,
	[ToDoI3D] [int] NULL,
	[DocDirI3D] [int] NULL,
 CONSTRAINT [PK_AnfrKopfVersions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnfrPosVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnfrPosVersions](
	[I3D] [int] NULL,
	[AnfrKopfI3D] [int] NULL,
	[Version] [int] NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](20) NULL,
	[Artikeltext] [varchar](5000) NULL,
	[Kreditorcode] [varchar](100) NULL,
	[Hersteller] [varchar](100) NULL,
	[Herstellercode] [varchar](100) NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[BlockID] [int] NULL,
	[Stk] [float] NULL,
	[Preis] [float] NULL,
	[VK_Druck] [float] NULL,
	[SummeDruck] [float] NULL,
	[MwStSatz] [float] NULL,
	[PositionArt] [int] NULL,
	[Freitext] [varchar](5000) NULL,
	[LieferDatumSoll] [datetime] NULL,
	[LieferDatumIst] [datetime] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[Fontcolor] [int] NULL,
	[UebernommenInI3D] [int] NULL,
	[UebernommenInArt] [int] NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
	[Bestellinformation] [varchar](200) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AngebotBewertung]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngebotBewertung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[AngebotI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Bewertung] [int] NULL,
	[Bemerkung] [varchar](1000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AngebotBewertungEinstellungen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngebotBewertungEinstellungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Sortierung] [int] NULL,
	[AngezeigterText] [varchar](255) NULL,
	[Bemerkung] [varchar](1000) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AngebotKlassif]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngebotKlassif](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [char](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AngebotKlassif] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AngebotVerloren]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngebotVerloren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AngKopfErweitert]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngKopfErweitert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AngkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[LeasingSatz] [float] NULL,
	[Status] [int] NULL,
	[ServiceSatz] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AngKopfErweitertVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngKopfErweitertVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AngkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[OriginalI3D] [int] NULL,
	[Version] [int] NULL,
	[LeasingSatz] [float] NULL,
	[Status] [int] NULL,
	[ServiceSatz] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AngProv]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AngProv](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AngKopfI3D] [int] NULL,
	[AngNummer] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Provisio] [float] NULL,
	[Provision] [float] NULL,
	[Status] [int] NULL,
	[Standard] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnlageFreigaben]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnlageFreigaben](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GruppeI3D] [int] NULL,
	[FreigabeArt] [int] NULL,
	[FreigabeTyp] [int] NULL,
	[MindestBetrag] [float] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnlageFreigabenGesetzt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnlageFreigabenGesetzt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnlageI3D] [int] NOT NULL,
	[AnlageArtOA] [int] NOT NULL,
	[AnlageVersion] [int] NOT NULL,
	[AnlageFreigabeI3D] [int] NOT NULL,
	[MitarbeiterI3D] [int] NOT NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnlageFreigabenWarengruppen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnlageFreigabenWarengruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NULL,
	[GruppeI3D] [int] NULL,
	[WarengruppenI3D] [int] NULL,
	[UnterwarengruppenI3D] [int] NULL,
	[Warengruppe] [int] NULL,
	[Bezeichnung] [varchar](40) NULL,
	[Angebot2Auftrag] [int] NULL,
	[Angebot2Lieferschein] [int] NULL,
	[Angebot2Rechnung] [int] NULL,
	[AngebotGenerell] [int] NULL,
	[Auftrag2Lieferschein] [int] NULL,
	[Auftrag2Rechnung] [int] NULL,
	[AuftragGenerell] [int] NULL,
	[Lieferschein2Rechnung] [int] NULL,
	[Lieferschein2Abholschein] [int] NULL,
	[LieferscheinGenerell] [int] NULL,
	[AbholscheinGenerell] [int] NULL,
	[Rechnung2Gutschrift] [int] NULL,
	[RechnungGenerell] [int] NULL,
	[GutschriftGenerell] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnlageFreigabenWarengruppenBenoetigt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnlageFreigabenWarengruppenBenoetigt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NULL,
	[GruppeI3D] [int] NULL,
	[WarengruppenI3D] [int] NULL,
	[UnterwarengruppenI3D] [int] NULL,
	[Warengruppe] [int] NULL,
	[Bezeichnung] [varchar](40) NULL,
	[Angebot2Auftrag] [int] NULL,
	[Angebot2Lieferschein] [int] NULL,
	[Angebot2Rechnung] [int] NULL,
	[AngebotGenerell] [int] NULL,
	[Auftrag2Lieferschein] [int] NULL,
	[Auftrag2Rechnung] [int] NULL,
	[AuftragGenerell] [int] NULL,
	[Lieferschein2Rechnung] [int] NULL,
	[Lieferschein2Abholschein] [int] NULL,
	[LieferscheinGenerell] [int] NULL,
	[AbholscheinGenerell] [int] NULL,
	[Rechnung2Gutschrift] [int] NULL,
	[RechnungGenerell] [int] NULL,
	[GutschriftGenerell] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnlageGrund]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnlageGrund](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Beschreibung] [varchar](500) NULL,
	[Status] [int] NULL,
	[Pflicht] [int] NULL,
	[ObjektArt] [int] NULL,
	[Kosten] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnlageLog]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnlageLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnlageArt] [int] NULL,
	[Art] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[PersonalI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[AnlageI3D] [int] NULL,
	[AnlageVersion] [int] NULL,
	[Beschreibung] [varchar](1000) NULL,
	[Status] [int] NULL,
	[ContactPersonI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnschriftArt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnschriftArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](50) NULL,
	[Kommentar] [varchar](254) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AnschriftArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnschriftGeodaten]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnschriftGeodaten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KontaktI3D] [int] NULL,
	[KontaktArt] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[Laengengrad] [float] NULL,
	[Breitengrad] [float] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[ErstelltVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnschriftSonderartikel]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnschriftSonderartikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NOT NULL,
	[AnfahrtZonenI3D] [int] NULL,
	[ArtikelI3D] [int] NOT NULL,
	[AbrechnungsArt] [int] NOT NULL,
	[Multiplikator] [decimal](19, 7) NULL,
	[Preis] [float] NULL,
	[AnschriftI3D] [int] NULL,
	[AddressI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnsprechpartnerBeziehung]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnsprechpartnerBeziehung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BusinesspartnerI3D] [int] NULL,
	[BusinesspartnerArt] [int] NULL,
	[BeziehungI3D] [int] NULL,
	[BusinesspartnerI3DRelated] [int] NULL,
	[BusinesspartnerArtRelated] [int] NULL,
	[Status] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVon] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AnsprechpartnerBeziehungText]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AnsprechpartnerBeziehungText](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](100) NULL,
	[Status] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVon] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanArbeitsplatz]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanArbeitsplatz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGangI3D] [int] NULL,
	[ArbeitsplatzI3D] [int] NULL,
	[Aufruestzeit] [float] NULL,
	[Abruestzeit] [float] NULL,
	[Stueckzeit] [float] NULL,
	[Zykluszeit] [float] NULL,
	[Nutzen] [float] NULL,
	[Bemerkung] [varchar](100) NULL,
	[APlanI3D] [int] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_APlanArbeitsplatz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanArbeitsschutz]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanArbeitsschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGangI3D] [int] NULL,
	[ArbeitsschutzI3D] [int] NULL,
	[Bemerkung] [varchar](100) NULL,
	[APlanI3D] [int] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_APlanArbeitsschutz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanArtikel]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGangI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Menge] [float] NULL,
	[Bemerkung] [varchar](100) NULL,
	[APlanI3D] [int] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[Nettogewicht] [float] NULL,
	[Bruttogewicht] [float] NULL,
	[SpezGewicht] [float] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_APlanArtikel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanKalkulation]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanKalkulation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[APlanI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[M_Kosten] [float] NULL,
	[M_GemKosten] [float] NULL,
	[M_GemKostenProz] [float] NULL,
	[F_Kosten_I] [float] NULL,
	[F_GemKosten_I] [float] NULL,
	[F_GemKostenProz_I] [float] NULL,
	[F_SEKF_I] [float] NULL,
	[VwGK] [float] NULL,
	[VtGK] [float] NULL,
	[VwGKProz] [float] NULL,
	[VtGKProz] [float] NULL,
	[SEK_d_Vertriebs] [float] NULL,
	[Entwicklungs_GK] [float] NULL,
	[GewinnProz] [float] NULL,
	[Provision] [float] NULL,
	[ProvisionProz] [float] NULL,
	[KundenSkonto] [float] NULL,
	[KundenRabatt] [float] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanLohnGruppe]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanLohnGruppe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGangI3D] [int] NULL,
	[LohngruppeI3D] [int] NULL,
	[Menge] [float] NULL,
	[Bemerkung] [varchar](100) NULL,
	[APlanI3D] [int] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_APlanLohnGruppe] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanMaterial]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanMaterial](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGangI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[APlanI3D] [int] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanMaterialListe]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanMaterialListe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[APlanI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Bemerkung] [varchar](100) NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_APlanMaterialListe] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanUmweltschutz]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanUmweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGangI3D] [int] NULL,
	[UmweltschutzI3D] [int] NULL,
	[Bemerkung] [varchar](100) NULL,
	[APlanI3D] [int] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_APlanUmweltschutz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[APlanWerkzeug]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[APlanWerkzeug](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGangI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Menge] [int] NULL,
	[Bemerkung] [varchar](50) NULL,
	[APlanI3D] [int] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AppGroupCustomerAssignments]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AppGroupCustomerAssignments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AppGroupI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
 CONSTRAINT [PK_AppGroupCustomerAssignments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AppGroupCustomerLists]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AppGroupCustomerLists](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](128) NOT NULL,
 CONSTRAINT [PK_AppGroupCustomerLists] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AppGroupCustomerListToAppGroupAssignments]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AppGroupCustomerListToAppGroupAssignments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AppGroupI3D] [int] NOT NULL,
	[AppGroupCustomerListI3D] [int] NOT NULL,
	[IsBlacklist] [bit] NOT NULL,
 CONSTRAINT [PK_AppGroupCustomerListToAppGroupAssignments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ApplicationUserStatistics]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ApplicationUserStatistics](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Action] [varchar](500) NOT NULL,
	[Counter] [int] NOT NULL,
	[LastUsed] [datetime] NOT NULL,
 CONSTRAINT [PK_ApplicationUserStatistics] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [IX_ApplicationUserStatistics_ActionUniqueCluster] UNIQUE CLUSTERED 
(
	[Action] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ApplicationVersions]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ApplicationVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ApplicationKind] [bigint] NULL,
	[CurrentVersion] [nvarchar](16) NULL,
	[LastLogin] [datetime] NULL,
	[AppUserI3D] [int] NULL,
	[LoginMachine] [nvarchar](512) NULL,
	[LoginIP] [nvarchar](512) NULL,
	[WebAccountI3D] [int] NULL,
	[MonitoringTokenI3D] [int] NULL,
	[ApplicationGuid] [nvarchar](64) NULL,
	[Caption] [nvarchar](64) NULL,
 CONSTRAINT [PK__ApplicationVersions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AppointmentProposals]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AppointmentProposals](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AppointmentRequestI3D] [int] NOT NULL,
	[StartDate] [datetime2](0) NOT NULL,
	[EndDate] [datetime2](0) NULL,
	[AppointmentId] [varchar](256) NULL,
	[AllDay] [bit] NOT NULL,
 CONSTRAINT [PK_AppointmentProposals] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_AppointmentProposals]    Script Date: 11.11.2025 11:20:26 ******/
CREATE CLUSTERED INDEX [CI_AppointmentProposals] ON [dbo].[AppointmentProposals]
(
	[AppointmentRequestI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AppointmentRequests]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AppointmentRequests](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[StartDate] [datetime2](0) NULL,
	[CustomerI3D] [int] NULL,
	[AddressContactI3D] [int] NULL,
	[ContactEmail] [nvarchar](100) NOT NULL,
	[ContactName] [nvarchar](100) NOT NULL,
	[ObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[InternalNote] [nvarchar](2000) NULL,
	[Subject] [nvarchar](200) NULL,
	[RequestState] [int] NOT NULL,
	[Guid] [uniqueidentifier] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
	[EmployeeI3D] [int] NULL,
	[CustomerName] [nvarchar](100) NULL,
	[SalutationI3D] [int] NULL,
	[Body] [nvarchar](max) NULL,
	[Place] [nvarchar](400) NULL,
	[Message] [nvarchar](2000) NULL,
 CONSTRAINT [PK_AppointmentRequests] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Arbeitsauftrag]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Arbeitsauftrag](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](256) NULL,
	[Status] [int] NULL,
	[Datum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](24) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](24) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Arbeitsgang]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Arbeitsgang](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplanI3D] [int] NULL,
	[Pos] [int] NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Bemerkung] [varchar](300) NULL,
	[ErstelltVon] [varchar](50) NULL,
	[ErstelltAm] [datetime] NULL,
	[LetzteAenderungVon] [varchar](50) NULL,
	[LetzteAenderungAm] [datetime] NULL,
	[Text] [text] NULL,
	[Muster] [int] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[Anweisung] [varchar](500) NULL,
	[ArbeitsplatzI3D] [int] NULL,
	[Aufruestzeit] [float] NULL,
	[Abruestzeit] [float] NULL,
	[Stueckzeit] [float] NULL,
	[Nutzen] [float] NULL,
	[Zykluszeit] [float] NULL,
	[ArbgangArtikelI3D] [int] NULL,
	[ArbgangLohnI3D] [int] NULL,
	[ArbgangASchutzI3D] [int] NULL,
	[AgangMaschGruI3D] [int] NULL,
	[AgangUmweltI3d] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Arbeitsgang] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Arbeitsplan]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Arbeitsplan](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsauftragI3D] [int] NULL,
	[Status] [int] NULL,
	[Bezeichnung] [varchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArbeitsplanArtikel]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArbeitsplanArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplanI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArbeitsplanVorlage]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArbeitsplanVorlage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[Bezeichnung] [varchar](256) NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](24) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](24) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArbeitsplanVorlageArtikel]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArbeitsplanVorlageArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplanVorlageI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Arbeitsplatz]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Arbeitsplatz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [varchar](50) NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](300) NULL,
	[Bild] [image] NULL,
	[BildErweiterung] [varchar](5) NULL,
	[BildHersteller] [image] NULL,
	[Inventarnummer] [varchar](50) NULL,
	[Standort] [varchar](50) NULL,
	[VerantwortlicherI3D] [int] NULL,
	[Anschaffungsdatum] [datetime] NULL,
	[Baujahr] [int] NULL,
	[Abschreibungsdauer] [int] NULL,
	[Anschaffungswert] [float] NULL,
	[Buchwert] [float] NULL,
	[Seriennummer] [varchar](50) NULL,
	[Nutzungsdauer] [int] NULL,
	[Service] [varchar](50) NULL,
	[ServiceStrasse] [varchar](50) NULL,
	[ServicePLZ] [varchar](50) NULL,
	[ServiceOrt] [varchar](50) NULL,
	[ServiceTelefon] [varchar](50) NULL,
	[ServiceFax] [varchar](50) NULL,
	[ServiceHotline] [varchar](50) NULL,
	[ServiceNotdienst] [varchar](50) NULL,
	[ServiceeMail] [varchar](50) NULL,
	[Servicewww] [varchar](50) NULL,
	[Wartungsintervall1] [int] NULL,
	[Wartungsintervall1text] [varchar](300) NULL,
	[Wartungsintervall2] [int] NULL,
	[Wartungsintervall2Text] [varchar](300) NULL,
	[Aufruestzeit] [float] NULL,
	[Abruestzeit] [float] NULL,
	[Reinigungszeit] [float] NULL,
	[Reinigungsintervall] [float] NULL,
	[Personaleinsatz] [float] NULL,
	[GleichzeitigeBedienung] [int] NULL,
	[Nutzungskosten] [float] NULL,
	[Wartungskosten] [float] NULL,
	[Rohkosten] [float] NULL,
	[Aufschlag1] [float] NULL,
	[Aufschlag2] [float] NULL,
	[Gesamtkosten] [float] NULL,
	[Aktiv] [int] NULL,
	[BetriebsstundenWoche] [int] NULL,
	[KostenstelleI3D] [int] NULL,
	[Fixkosten] [float] NULL,
	[Fixkostenstundensatz] [float] NULL,
	[LohngruppeI3D] [int] NULL,
	[Abschreibungskosten] [float] NULL,
	[Kostenstellekosten] [float] NULL,
	[APGruppeI3D] [int] NULL,
	[APStandortI3D] [int] NULL,
	[Maschinenstundensatz] [float] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Arbeitsplatz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArbeitsplatzGruppen]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArbeitsplatzGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Gruppe] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArbeitsplatzStandorte]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArbeitsplatzStandorte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Standort] [varchar](250) NULL,
	[Ansprechpartner] [varchar](100) NULL,
	[Strasse] [varchar](100) NULL,
	[PLZ] [varchar](100) NULL,
	[Ort] [varchar](50) NULL,
	[Telefon] [varchar](50) NULL,
	[Email] [varchar](50) NULL,
	[Bemerkung] [text] NULL,
	[Telefon2] [varchar](50) NULL,
	[Handy] [varchar](50) NULL,
	[LandI3D] [int] NULL,
	[Abteilung] [varchar](100) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Arbeitsschritt]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Arbeitsschritt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplanI3D] [int] NULL,
	[Position] [int] NULL,
	[Status] [int] NULL,
	[KurzBeschreibung] [varchar](256) NULL,
	[Beschreibung] [varchar](2048) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArbeitsschrittHistorie]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArbeitsschrittHistorie](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[SeriennummerZuArbeitsauftragI3D] [int] NULL,
	[AlterArbeitsschrittI3D] [int] NULL,
	[NeuerArbeitsschrittI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Datum] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArbeitsschrittVorlage]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArbeitsschrittVorlage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplanVorlageI3D] [int] NULL,
	[Position] [int] NULL,
	[KurzBeschreibung] [varchar](256) NULL,
	[Beschreibung] [varchar](2048) NULL,
	[Status] [int] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](24) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](24) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Arbeitssicherheit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Arbeitssicherheit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Beschreibung] [text] NULL,
	[Bild] [image] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Arbeitssicherheit] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleImportDistributors]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleImportDistributors](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleImportI3D] [int] NOT NULL,
	[ImportDistributorName] [nvarchar](255) NULL,
	[DistributorI3D] [int] NOT NULL,
 CONSTRAINT [PK_ArticleImportDistributors] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleImportField]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleImportField](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleImportI3D] [int] NOT NULL,
	[Filename] [nvarchar](250) NOT NULL,
	[ColumnName] [nvarchar](250) NOT NULL,
	[ColumnNumber] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleImportLogs]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleImportLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleImportI3D] [int] NULL,
	[Type] [nvarchar](255) NOT NULL,
	[Message] [nvarchar](255) NOT NULL,
	[Date] [datetime2](7) NOT NULL,
	[State] [int] NOT NULL,
	[ImportOwner] [int] NOT NULL,
 CONSTRAINT [PK_ArticleImportLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleImportMappings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleImportMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleImportI3D] [int] NOT NULL,
	[Property] [nvarchar](255) NOT NULL,
	[ValueExpression] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_ArticleImportMappings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleImportMultiDistributor]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleImportMultiDistributor](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleImportI3D] [int] NOT NULL,
	[DistributorName] [nvarchar](100) NOT NULL,
	[CentronDistributorI3D] [int] NOT NULL,
 CONSTRAINT [PK_ArticleImportMultiDistributor] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleImports]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleImports](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DistributorI3D] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[Type] [nvarchar](255) NULL,
	[LastImportHash] [image] NULL,
	[IsAvailabilityList] [bit] NOT NULL,
	[RecurrenceType] [int] NULL,
	[RecurrenceTime] [datetime] NULL,
	[DownloadType] [int] NOT NULL,
	[ImportKind] [int] NULL,
	[IsArchive] [bit] NOT NULL,
	[FileInArchive] [nvarchar](255) NULL,
	[Encoding] [nvarchar](255) NULL,
	[FirstRowContainsHeaders] [bit] NOT NULL,
	[DelimiterCharacter] [int] NULL,
	[DecimalCharacter] [int] NULL,
	[QuoteCharacter] [nvarchar](255) NULL,
	[FilePath] [nvarchar](255) NULL,
	[UseNewestFile] [bit] NOT NULL,
	[Url] [nvarchar](255) NULL,
	[UseAuthentication] [bit] NOT NULL,
	[Username] [nvarchar](255) NULL,
	[Password] [nvarchar](255) NULL,
	[Address] [nvarchar](255) NULL,
	[Port] [int] NULL,
	[Directory] [nvarchar](255) NULL,
	[FileName] [nvarchar](255) NULL,
	[FileNameinCompression] [nchar](255) NULL,
	[FileCompression] [int] NOT NULL,
	[HerstellerImportI3D] [int] NULL,
	[DistributorField] [int] NULL,
	[Notice] [nvarchar](500) NULL,
	[AllowMultirowsTexte] [int] NULL,
	[ActivationDate] [datetime] NULL,
	[State] [bit] NULL,
	[ImportType] [int] NULL,
 CONSTRAINT [PK_ArticleImports] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleProductionMaterials]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleProductionMaterials](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleI3D] [int] NOT NULL,
	[MaterialArticleI3D] [int] NOT NULL,
	[Quantity] [decimal](9, 2) NULL,
	[Comment] [nvarchar](4000) NULL,
 CONSTRAINT [PK_ArticleProductionMaterials] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleProductionOrderStepItemTimeDataRecordings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleProductionOrderStepItemTimeDataRecordings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleProductionOrderStepItemI3D] [int] NOT NULL,
	[ArticleProductionOrderTimeI3D] [int] NOT NULL,
 CONSTRAINT [PK_ArticleProductionOrderStepItemTimeDataRecordings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleProductionOrderStepItemTimes]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleProductionOrderStepItemTimes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[StartTime] [datetime2](0) NOT NULL,
	[EndTime] [datetime2](0) NULL,
 CONSTRAINT [PK_ArticleProductionOrderStepItemTimes] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArticleUnitGroup]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArticleUnitGroup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArticleI3D] [int] NOT NULL,
	[Caption] [nvarchar](100) NULL,
	[Quantity] [decimal](19, 7) NOT NULL,
 CONSTRAINT [PK_ArticleUnitGroup] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtificialIntelligencePromptCategory]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtificialIntelligencePromptCategory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Description] [nvarchar](500) NOT NULL,
	[IsActive] [bit] NULL,
 CONSTRAINT [PK_ArtificialIntelligencePromptCategory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtificialIntelligencePromptSettings]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtificialIntelligencePromptSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Description] [nvarchar](500) NOT NULL,
	[Prompt] [nvarchar](max) NULL,
	[PromptCategoryI3D] [int] NULL,
	[IsActive] [bit] NULL,
 CONSTRAINT [PK_ArtificialIntelligencePromptSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ARTIKAAA]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ARTIKAAA](
	[I3D] [int] NOT NULL,
	[Artikelcode] [varchar](60) NULL,
	[Sortierkriterium] [int] NULL,
	[Kurzbegriff] [varchar](15) NULL,
	[Artikelbeschreibung] [varchar](5000) NULL,
	[VK_1] [float] NULL,
	[VK_2] [float] NULL,
	[VK_3] [float] NULL,
	[VK_4] [float] NULL,
	[EK] [float] NULL,
	[Mwst_Satz] [float] NULL,
	[Warengruppe] [int] NULL,
	[Barcode_Selector] [int] NULL,
	[Kalkulationsfaktor] [float] NULL,
	[Beschreibung_1] [varchar](60) NULL,
	[Beschreibung_2] [varchar](60) NULL,
	[Beschreibung_3] [varchar](60) NULL,
	[Abbuchung] [varchar](1) NULL,
	[Menge] [float] NULL,
	[Auftragsbestand] [float] NULL,
	[Mindestbestand] [float] NULL,
	[Zulauf] [float] NULL,
	[Angelegt_am] [datetime] NULL,
	[Geandert_am] [datetime] NULL,
	[Usersystem] [varchar](8) NULL,
	[Benutzer] [varchar](8) NULL,
	[Bestandskontrolle] [datetime] NULL,
	[Reparaturmenge] [float] NULL,
	[Defektbestand] [float] NULL,
	[Ausleihe_Bestand] [float] NULL,
	[Produktionsbestand] [float] NULL,
	[Status] [varchar](1) NULL,
	[RohEK1] [float] NULL,
	[RohEK1Datum] [datetime] NULL,
	[RohEk2] [float] NULL,
	[RohEK2Datum] [datetime] NULL,
	[Zusatzinfo1] [varchar](55) NULL,
	[Zusatzinfo2] [varchar](55) NULL,
	[Zusatzinfo3] [varchar](55) NULL,
	[Hersteller] [varchar](60) NULL,
	[InBearbeitung] [float] NULL,
	[VertriebsInfoAnzeigen] [int] NULL,
	[FertigungsInfoAnzeigen] [int] NULL,
	[KreditorI3D] [int] NULL,
	[Lieferbestand] [float] NULL,
	[StatistikText] [int] NULL,
	[TextAenderbar] [int] NULL,
	[EOL] [int] NULL,
	[Farbe] [int] NULL,
	[MailTo] [varchar](80) NULL,
	[Mindestpreis] [float] NULL,
	[EKGleichVK] [int] NULL,
	[WEBArtik] [int] NULL,
	[FolgeArtikel] [varchar](15) NULL,
	[Bild1] [image] NULL,
	[Bild1Ext] [varchar](4) NULL,
	[Bild2] [image] NULL,
	[Bild2Ext] [varchar](4) NULL,
	[Bild3] [image] NULL,
	[Bild3Ext] [varchar](4) NULL,
	[Bild4] [image] NULL,
	[Bild4Ext] [varchar](4) NULL,
	[EVK] [float] NULL,
	[WEBKategorie] [int] NULL,
	[VPE] [float] NULL,
	[Lieferbar] [int] NULL,
	[Kommisionieren] [int] NULL,
	[BarcodeScanen] [int] NULL,
	[BarcodeScanenOld] [int] NULL,
	[DocI3D] [int] NULL,
	[Lieferzeit] [int] NULL,
	[Import] [int] NULL,
	[Kundenbestand] [float] NULL,
	[Fremdbestand] [float] NULL,
	[Teilbar] [int] NULL,
	[StkListe] [int] NULL,
	[Reparaturbestand] [float] NULL,
	[ALieferantI3D] [int] NULL,
	[BLieferantI3D] [int] NULL,
	[CLieferantI3D] [int] NULL,
	[LagerortI3D] [int] NULL,
	[LagerplatzI3D] [int] NULL,
	[Bild1Uploaded] [int] NULL,
	[Bild2Uploaded] [int] NULL,
	[Bild3Uploaded] [int] NULL,
	[Bild4Uploaded] [int] NULL,
	[EinkInfo] [text] NULL,
	[GespInfo] [text] NULL,
	[Gesperrt] [int] NULL,
	[Nettogewicht] [float] NULL,
	[Bruttogewicht] [float] NULL,
	[SpezGewicht] [float] NULL,
	[Volumen] [float] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[EKgiltBis] [datetime] NULL,
	[UrsprungsLandI3d] [int] NULL,
	[Warennummer] [varchar](50) NULL,
	[GarantieZeit] [int] NULL,
	[Geandert_von] [int] NULL,
	[FertigungsInfo] [text] NULL,
	[VertriebsInfo] [text] NULL,
	[Fertigungsware] [int] NULL,
	[M_GemKosten] [float] NULL,
	[F_GemKosten_I] [float] NULL,
	[Montieren] [int] NULL,
	[M_GemKostenProz] [float] NULL,
	[F_GemKosten_IProz] [float] NULL,
	[F_GemKosten_IIProz] [float] NULL,
	[ToDoEKI3D] [int] NULL,
	[ToDoBenachI3D] [int] NULL,
	[Angelegt_von] [int] NULL,
	[Nachkommastellen] [int] NULL,
	[Einheit] [int] NULL,
	[MwstI3D] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[KTOPriority] [int] NULL,
	[QSInfo] [varchar](500) NULL,
	[ErloesKTO] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Beschaffenheit] [int] NULL,
	[GewichtEinheit] [int] NULL,
	[MassEinheit] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[NebenlagerI3D] [int] NULL,
	[BeschLaenge] [int] NULL,
	[BeschHoehe] [int] NULL,
	[BeschBreite] [int] NULL,
	[BeschBruttoGewicht] [int] NULL,
	[BeschNettoGewicht] [int] NULL,
	[BeschSpezGewicht] [int] NULL,
	[KostenstelleI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[MaxSperre] [int] NULL,
	[MaxLaenge] [float] NULL,
	[MaxBreite] [float] NULL,
	[MaxHoehe] [float] NULL,
	[VorLaenge] [float] NULL,
	[VorBreite] [float] NULL,
	[VorHoehe] [float] NULL,
	[EinLaenge] [float] NULL,
	[EinBreite] [float] NULL,
	[EinHoehe] [float] NULL,
	[GewEinheit] [int] NULL,
	[MasEinheit] [int] NULL,
	[GewProEinheit] [float] NULL,
	[PreisAnzeige] [int] NULL,
	[Dimension] [int] NULL,
	[MassPro] [int] NULL,
	[GewichtPro] [int] NULL,
	[MaxLaengeE] [int] NULL,
	[MaxBreiteE] [int] NULL,
	[MaxHoeheE] [int] NULL,
	[EinLaengeE] [int] NULL,
	[EinBreiteE] [int] NULL,
	[EinHoeheE] [int] NULL,
	[LagerLaenge] [float] NULL,
	[LagerBreite] [float] NULL,
	[LagerHoehe] [float] NULL,
	[LagerLaengeE] [int] NULL,
	[LagerBreiteE] [int] NULL,
	[LagerHoeheE] [int] NULL,
	[VerkaufLaenge] [float] NULL,
	[VerkaufBreite] [float] NULL,
	[VerkaufHoehe] [float] NULL,
	[VerkaufLaengeE] [int] NULL,
	[VerkaufBreiteE] [int] NULL,
	[VerkaufHoeheE] [int] NULL,
	[HinweisBei] [int] NULL,
	[HinweisText] [varchar](1000) NULL,
	[Garantie1Wert] [int] NULL,
	[Garantie1Art] [int] NULL,
	[Garantie2Wert] [int] NULL,
	[Garantie2Art] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[SondervereinbarungsPflichtig] [int] NULL,
	[SondervereinbarungsEK] [float] NULL,
	[SondervereinbarungsI3D] [int] NULL,
 CONSTRAINT [PK_ARTIKAAA] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ARTIKALT]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ARTIKALT](
	[I3D] [int] NOT NULL,
	[Artikelcode] [varchar](60) NULL,
	[Sortierkriterium] [int] NULL,
	[Kurzbegriff] [varchar](15) NULL,
	[Artikelbeschreibung] [varchar](5000) NULL,
	[VK_1] [float] NULL,
	[VK_2] [float] NULL,
	[VK_3] [float] NULL,
	[VK_4] [float] NULL,
	[EK] [float] NULL,
	[Mwst_Satz] [float] NULL,
	[Warengruppe] [int] NULL,
	[Barcode_Selector] [int] NULL,
	[Kalkulationsfaktor] [float] NULL,
	[Beschreibung_1] [varchar](60) NULL,
	[Beschreibung_2] [varchar](60) NULL,
	[Beschreibung_3] [varchar](60) NULL,
	[Abbuchung] [varchar](1) NULL,
	[Menge] [float] NULL,
	[Auftragsbestand] [float] NULL,
	[Mindestbestand] [float] NULL,
	[Zulauf] [float] NULL,
	[Angelegt_am] [datetime] NULL,
	[Geandert_am] [datetime] NULL,
	[Usersystem] [varchar](8) NULL,
	[Benutzer] [varchar](8) NULL,
	[Bestandskontrolle] [datetime] NULL,
	[Reparaturmenge] [float] NULL,
	[Defektbestand] [float] NULL,
	[Ausleihe_Bestand] [float] NULL,
	[Produktionsbestand] [float] NULL,
	[Status] [varchar](1) NULL,
	[RohEK1] [float] NULL,
	[RohEK1Datum] [datetime] NULL,
	[RohEk2] [float] NULL,
	[RohEK2Datum] [datetime] NULL,
	[Zusatzinfo1] [varchar](55) NULL,
	[Zusatzinfo2] [varchar](55) NULL,
	[Zusatzinfo3] [varchar](55) NULL,
	[Hersteller] [varchar](60) NULL,
	[InBearbeitung] [float] NULL,
	[VertriebsInfoAnzeigen] [int] NULL,
	[FertigungsInfoAnzeigen] [int] NULL,
	[KreditorI3D] [int] NULL,
	[Lieferbestand] [float] NULL,
	[StatistikText] [int] NULL,
	[TextAenderbar] [int] NULL,
	[EOL] [int] NULL,
	[Farbe] [int] NULL,
	[MailTo] [varchar](80) NULL,
	[Mindestpreis] [float] NULL,
	[EKGleichVK] [int] NULL,
	[WEBArtik] [int] NULL,
	[FolgeArtikel] [varchar](15) NULL,
	[Bild1] [image] NULL,
	[Bild1Ext] [varchar](4) NULL,
	[Bild2] [image] NULL,
	[Bild2Ext] [varchar](4) NULL,
	[Bild3] [image] NULL,
	[Bild3Ext] [varchar](4) NULL,
	[Bild4] [image] NULL,
	[Bild4Ext] [varchar](4) NULL,
	[EVK] [float] NULL,
	[WEBKategorie] [int] NULL,
	[VPE] [float] NULL,
	[Lieferbar] [int] NULL,
	[Kommisionieren] [int] NULL,
	[BarcodeScanen] [int] NULL,
	[BarcodeScanenOld] [int] NULL,
	[DocI3D] [int] NULL,
	[Lieferzeit] [int] NULL,
	[Import] [int] NULL,
	[Kundenbestand] [float] NULL,
	[Fremdbestand] [float] NULL,
	[Teilbar] [int] NULL,
	[StkListe] [int] NULL,
	[Reparaturbestand] [float] NULL,
	[ALieferantI3D] [int] NULL,
	[BLieferantI3D] [int] NULL,
	[CLieferantI3D] [int] NULL,
	[LagerortI3D] [int] NULL,
	[LagerplatzI3D] [int] NULL,
	[Bild1Uploaded] [int] NULL,
	[Bild2Uploaded] [int] NULL,
	[Bild3Uploaded] [int] NULL,
	[Bild4Uploaded] [int] NULL,
	[EinkInfo] [text] NULL,
	[GespInfo] [text] NULL,
	[Gesperrt] [int] NULL,
	[Nettogewicht] [float] NULL,
	[Bruttogewicht] [float] NULL,
	[SpezGewicht] [float] NULL,
	[Volumen] [float] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[EKgiltBis] [datetime] NULL,
	[UrsprungsLandI3d] [int] NULL,
	[Warennummer] [varchar](50) NULL,
	[GarantieZeit] [int] NULL,
	[Geandert_von] [int] NULL,
	[FertigungsInfo] [text] NULL,
	[VertriebsInfo] [text] NULL,
	[Fertigungsware] [int] NULL,
	[M_GemKosten] [float] NULL,
	[F_GemKosten_I] [float] NULL,
	[Montieren] [int] NULL,
	[M_GemKostenProz] [float] NULL,
	[F_GemKosten_IProz] [float] NULL,
	[F_GemKosten_IIProz] [float] NULL,
	[ToDoEKI3D] [int] NULL,
	[ToDoBenachI3D] [int] NULL,
	[Angelegt_von] [int] NULL,
	[Nachkommastellen] [int] NULL,
	[Einheit] [int] NULL,
	[MwstI3D] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[KTOPriority] [int] NULL,
	[QSInfo] [varchar](500) NULL,
	[ErloesKTO] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Beschaffenheit] [int] NULL,
	[GewichtEinheit] [int] NULL,
	[MassEinheit] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[NebenlagerI3D] [int] NULL,
	[BeschLaenge] [int] NULL,
	[BeschHoehe] [int] NULL,
	[BeschBreite] [int] NULL,
	[BeschBruttoGewicht] [int] NULL,
	[BeschNettoGewicht] [int] NULL,
	[BeschSpezGewicht] [int] NULL,
	[KostenstelleI3D] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[MaxSperre] [int] NULL,
	[MaxLaenge] [float] NULL,
	[MaxBreite] [float] NULL,
	[MaxHoehe] [float] NULL,
	[VorLaenge] [float] NULL,
	[VorBreite] [float] NULL,
	[VorHoehe] [float] NULL,
	[EinLaenge] [float] NULL,
	[EinBreite] [float] NULL,
	[EinHoehe] [float] NULL,
	[GewEinheit] [int] NULL,
	[MasEinheit] [int] NULL,
	[GewProEinheit] [float] NULL,
	[PreisAnzeige] [int] NULL,
	[Dimension] [int] NULL,
	[MassPro] [int] NULL,
	[GewichtPro] [int] NULL,
	[MaxLaengeE] [int] NULL,
	[MaxBreiteE] [int] NULL,
	[MaxHoeheE] [int] NULL,
	[EinLaengeE] [int] NULL,
	[EinBreiteE] [int] NULL,
	[EinHoeheE] [int] NULL,
	[LagerLaenge] [float] NULL,
	[LagerBreite] [float] NULL,
	[LagerHoehe] [float] NULL,
	[LagerLaengeE] [int] NULL,
	[LagerBreiteE] [int] NULL,
	[LagerHoeheE] [int] NULL,
	[VerkaufLaenge] [float] NULL,
	[VerkaufBreite] [float] NULL,
	[VerkaufHoehe] [float] NULL,
	[VerkaufLaengeE] [int] NULL,
	[VerkaufBreiteE] [int] NULL,
	[VerkaufHoeheE] [int] NULL,
	[HinweisBei] [int] NULL,
	[HinweisText] [varchar](1000) NULL,
	[Garantie1Wert] [int] NULL,
	[Garantie1Art] [int] NULL,
	[Garantie2Wert] [int] NULL,
	[Garantie2Art] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[SondervereinbarungsPflichtig] [int] NULL,
	[SondervereinbarungsEK] [float] NULL,
	[SondervereinbarungsI3D] [int] NULL,
 CONSTRAINT [PK_ARTIKALT] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ARTIKArbeitssicherheit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ARTIKArbeitssicherheit](
	[i3d] [int] IDENTITY(1,1) NOT NULL,
	[ArtikI3D] [int] NULL,
	[ArbeitssicherheitI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[i3d] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikDistributorCode]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikDistributorCode](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[DistributorI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikDistributorVKStaffelpreise]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikDistributorVKStaffelpreise](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikI3D] [int] NULL,
	[DistributorI3D] [int] NULL,
	[VKMenge1] [float] NULL,
	[VKPreis1] [float] NULL,
	[VKMenge2] [float] NULL,
	[VKPreis2] [float] NULL,
	[VKMenge3] [float] NULL,
	[VKPreis3] [float] NULL,
	[VKMenge4] [float] NULL,
	[VKPreis4] [float] NULL,
	[VKMenge5] [float] NULL,
	[VKPreis5] [float] NULL,
	[Status] [int] NULL,
	[EKMenge1] [float] NULL,
	[EKPreis1] [float] NULL,
	[EKMenge2] [float] NULL,
	[EKPreis2] [float] NULL,
	[EKMenge3] [float] NULL,
	[EKPreis3] [float] NULL,
	[EKMenge4] [float] NULL,
	[EKPreis4] [float] NULL,
	[EKMenge5] [float] NULL,
	[EKPreis5] [float] NULL,
	[KreditorCode] [varchar](100) NULL,
	[VPE] [float] NULL,
	[Mindestbestellmenge] [float] NULL,
	[Verrechnungsfaktor] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikEAN]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikEAN](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikI3D] [int] NULL,
	[EANCODE] [varchar](50) NULL,
	[Stueck] [float] NULL,
	[Status] [int] NULL,
	[EANCODEBasis] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Artikel]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Artikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelArtI3D] [int] NULL,
	[KreditorI3D] [int] NULL,
	[Code] [varchar](15) NOT NULL,
	[HerstellerCode] [varchar](30) NULL,
	[EAN] [varchar](13) NULL,
	[UCC] [varchar](50) NULL,
	[Farbe] [int] NULL,
	[EOL] [int] NOT NULL,
	[Abbuchung] [int] NOT NULL,
	[TextAenderbar] [int] NOT NULL,
	[Kommisionieren] [int] NOT NULL,
	[SNErfassen] [int] NOT NULL,
	[EKGleichVk] [int] NOT NULL,
	[Lieferbar] [int] NOT NULL,
	[WEB] [int] NULL,
	[AlternativArtikelI3D] [int] NULL,
	[EinheitI3D] [int] NULL,
	[ToDoI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Artikel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelAGArbeitssicherheit]    Script Date: 11.11.2025 11:20:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelAGArbeitssicherheit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGArbeitssicherheitI3D] [int] NULL,
	[ArtikelArbeitsgangI3D] [int] NULL,
	[ArbeitssicherheitI3D] [int] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelAGArbeitssicherheit] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelAGLohngruppe]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelAGLohngruppe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGLohngruppeI3D] [int] NULL,
	[ArtikelArbeitsgangI3D] [int] NULL,
	[LohngruppeI3D] [int] NULL,
	[Pos] [int] NULL,
	[KalkPosI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelAGLohngruppe] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelAGMaterial]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelAGMaterial](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGMaterialI3D] [int] NULL,
	[ArtikelArbeitsgangI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[EK] [float] NULL,
	[Menge] [float] NULL,
	[Pos] [int] NULL,
	[KalkPosI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelAGMaterial] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelAGPrufvorschrift]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelAGPrufvorschrift](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGPrufvorschriftI3D] [int] NULL,
	[ArtikelArbeitsgangI3D] [int] NULL,
	[PrufvorschriftI3D] [int] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelAGPrufvorschrift] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelAGUmweltschutz]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelAGUmweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGUmweltschutzI3D] [int] NULL,
	[ArtikelArbeitsgangI3D] [int] NULL,
	[UmweltschutzI3D] [int] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelAGUmweltschutz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelAlternativartikel]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelAlternativartikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerArtikelI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelAlternativartikel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelArbeitsgang]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelArbeitsgang](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AGI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Bezeichnung] [varchar](150) NULL,
	[text] [text] NULL,
	[ArbeitsplatzI3D] [int] NULL,
	[Aufruestzeit] [float] NULL,
	[Abruestzeit] [float] NULL,
	[Stueckzeit] [float] NULL,
	[Nutzen] [float] NULL,
	[Zykluszeit] [float] NULL,
	[Pos] [int] NULL,
	[KalkPosI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelArbeitsgang] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelArbeitsplan]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelArbeitsplan](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[OwnerArtikelI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelArbeitsplan] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelArt]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KurzText] [varchar](30) NOT NULL,
	[Beschreibung] [varchar](300) NULL,
	[Handelsartikel] [int] NOT NULL,
	[Eigenfertigung] [int] NOT NULL,
	[Stücklisten] [int] NOT NULL,
	[Arbeitsplan] [int] NOT NULL,
	[Maschienenplan] [int] NOT NULL,
	[Kalkulation] [int] NOT NULL,
	[Maße] [int] NOT NULL,
	[MaÃŸe] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelBestand]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelBestand](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NOT NULL,
	[MandantI3D] [int] NOT NULL,
	[Bestand] [float] NOT NULL,
	[Mindestbestand] [float] NOT NULL,
	[Auftragsbestand] [float] NOT NULL,
	[Kommisionsbestand] [float] NOT NULL,
	[Lieferbestand] [float] NOT NULL,
	[Zulauf] [float] NOT NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelBestand] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelBilder]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelBilder](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[HerstellerCode] [varchar](60) NULL,
	[Bild1] [image] NULL,
	[Bild1Ext] [varchar](4) NULL,
	[Bild2] [image] NULL,
	[Bild2Ext] [varchar](4) NULL,
	[Bild3] [image] NULL,
	[Bild3Ext] [varchar](4) NULL,
	[Bild4] [image] NULL,
	[Bild4Ext] [varchar](4) NULL,
	[Bild1Uploaded] [int] NULL,
	[Bild2Uploaded] [int] NULL,
	[Bild3Uploaded] [int] NULL,
	[Bild4Uploaded] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelDateiLinks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelDateiLinks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[DateiLinksI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelDateiLinks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelErsatzteile]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelErsatzteile](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerArtikelI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelErsatzteile] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelKalkulation]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelKalkulation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[Pos] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Prozent] [float] NULL,
	[KostenVariabel] [float] NULL,
	[KostenFix] [float] NULL,
	[KostenGesamt] [float] NULL,
	[Art] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelKalkulation] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelMaschienenplan]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelMaschienenplan](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[OwnerArtikelI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelMaschienenplan] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelMasse]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelMasse](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NOT NULL,
	[RohLange] [float] NULL,
	[RohHoehe] [float] NULL,
	[RohBreite] [float] NULL,
	[RohGewicht] [float] NULL,
	[RohVolumen] [float] NULL,
	[PackLaenge] [float] NULL,
	[PackHoehe] [float] NULL,
	[PackBreite] [float] NULL,
	[PackGewicht] [float] NULL,
	[PackVolumen] [float] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelMasse] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelPreis]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelPreis](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PreisGueltigI3D] [int] NOT NULL,
	[ArtikelI3D] [int] NOT NULL,
	[EK] [float] NULL,
	[EVP] [float] NULL,
	[VK1] [float] NULL,
	[VK2] [float] NULL,
	[VK3] [float] NULL,
	[VK4] [float] NULL,
	[VK5] [float] NULL,
	[VK6] [float] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelPreis] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelSpezifikationen]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelSpezifikationen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[Bezeichnung] [varchar](250) NULL,
	[Wert] [varchar](50) NULL,
	[Einheit] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelSpezifikationen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelSpezTypes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelSpezTypes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Status] [int] NULL,
	[CODE] [char](3) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelSpezVorlage]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelSpezVorlage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](250) NULL,
	[Wert] [varchar](50) NULL,
	[Einheit] [varchar](50) NULL,
	[Typ] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelStueckliste]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelStueckliste](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NOT NULL,
	[OwnerArtikelI3D] [int] NOT NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelStueckliste] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelText]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelText](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NOT NULL,
	[MandantI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[Beschreibung] [varchar](5000) NULL,
	[VertriebsInfo] [image] NULL,
	[FertigungsInfo] [image] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelText] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelToSpez]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelToSpez](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[SpezI3D] [int] NULL,
	[Wert] [varchar](50) NULL,
	[Status] [int] NULL,
	[FileSize] [varchar](20) NULL,
	[MediumKind] [varchar](20) NULL,
	[MediumCase] [varchar](20) NULL,
	[MediumCount] [int] NULL,
	[MediumBooklet] [varchar](20) NULL,
	[MediumCover] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelVar]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelVar](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [varchar](20) NULL,
	[ArtikelI3D] [int] NULL,
	[VarFloat] [float] NULL,
	[VarText] [varchar](150) NULL,
	[VarType] [int] NULL,
	[VarKlasse1] [int] NULL,
	[VarKlasse2] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelVerfolgung]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelVerfolgung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNummer] [int] NULL,
	[ZielArt] [int] NULL,
	[ZielNummer] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelVerfolgung] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikelWartungsartikel]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikelWartungsartikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerArtikelI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikelWartungsartikel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikEx]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikEx](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Artikelcode] [varchar](60) NULL,
	[FertigungsInfo] [text] NULL,
	[VertriebsInfo] [text] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ArtikEx] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikLagerStkListe]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikLagerStkListe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[AufKopfI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ARTIKlog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ARTIKlog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[BearbeiterI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Wert] [varchar](500) NULL,
	[AlterWert] [text] NULL,
	[NeuerWert] [text] NULL,
	[DifferenzMenge] [float] NULL,
	[Art] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikStaffelpreise]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikStaffelpreise](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[abMenge] [int] NULL,
	[VK_1] [float] NULL,
	[VK_2] [float] NULL,
	[VK_3] [float] NULL,
	[VK_4] [float] NULL,
	[EVK] [float] NULL,
	[Mindestpreis] [float] NULL,
	[Listenpreis] [float] NULL,
	[EK] [float] NULL,
	[Status] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[VK1_ErtragBasis] [int] NULL,
	[VK2_ErtragBasis] [int] NULL,
	[VK3_ErtragBasis] [int] NULL,
	[VK4_ErtragBasis] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikStkListe]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikStkListe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[StuecklisteI3D] [int] NULL,
	[ArtikelI3D] [int] NOT NULL,
	[Code] [varchar](60) NULL,
	[Text] [varchar](5000) NULL,
	[VK1] [float] NULL,
	[VK2] [float] NULL,
	[VK3] [float] NULL,
	[VK4] [float] NULL,
	[EK] [float] NULL,
	[Stk] [float] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[MengePro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Laenge] [float] NULL,
	[Breite] [float] NULL,
	[Hoehe] [float] NULL,
	[GewichtProEinheit] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[Masseinheit] [int] NULL,
	[Dimension] [int] NULL,
	[Groesse] [varchar](50) NULL,
	[GroesseGesamt] [varchar](50) NULL,
	[Gewicht] [varchar](50) NULL,
	[GewichtGesamt] [varchar](50) NULL,
	[MwstI3D] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[Abbuchung] [varchar](1) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK__ArtikStkListe__2F4FF79D] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ArtikTexte]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ArtikTexte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikI3D] [int] NULL,
	[LaenkennI3D] [int] NULL,
	[Artikelbeschreibung] [varchar](300) NULL,
	[VertriebsInfo] [text] NULL,
	[EinkInfo] [text] NULL,
	[FertigungsInfo] [text] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ARTIKUmweltschutz]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ARTIKUmweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ARTIKI3D] [int] NULL,
	[UmweltschutzI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementActiveDirectories]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementActiveDirectories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Type] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementActiveDirectoryGroups]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementActiveDirectoryGroups](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[GroupName] [nvarchar](256) NULL,
	[GroupType] [nvarchar](256) NULL,
	[DistinguishedName] [nvarchar](256) NULL,
	[SamAccountName] [nvarchar](256) NULL,
	[SamAccountType] [nvarchar](256) NULL,
	[CreatedOn] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementActiveDirectoryUsers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementActiveDirectoryUsers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[UserName] [nvarchar](256) NULL,
	[EmailID] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[UserGroup] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADBuiltInDomains]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADBuiltInDomains](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Adspath] [nvarchar](256) NULL,
	[Objectguid] [nvarchar](256) NULL,
	[Objectsid] [nvarchar](256) NULL,
	[Cn] [nvarchar](256) NULL,
	[Creationtime] [nvarchar](256) NULL,
	[Distinguishedname] [nvarchar](256) NULL,
	[Forcelogoff] [nvarchar](256) NULL,
	[Instancetype] [nvarchar](256) NULL,
	[Iscriticalsystemobject] [nvarchar](256) NULL,
	[Lockoutduration] [nvarchar](256) NULL,
	[Lockoutobservationwindow] [nvarchar](256) NULL,
	[Lockoutthreshold] [nvarchar](256) NULL,
	[Maxpwdage] [nvarchar](256) NULL,
	[Minpwdage] [nvarchar](256) NULL,
	[Minpwdlength] [nvarchar](256) NULL,
	[Modifiedcount] [nvarchar](256) NULL,
	[Modifiedcountatlastprom] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[Nextrid] [nvarchar](256) NULL,
	[Objectcategory] [nvarchar](256) NULL,
	[Objectclass] [nvarchar](256) NULL,
	[Pwdhistorylength] [nvarchar](256) NULL,
	[Pwdproperties] [nvarchar](256) NULL,
	[Showinadvancedviewonly] [nvarchar](256) NULL,
	[Systemflags] [nvarchar](256) NULL,
	[Uascompat] [nvarchar](256) NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[OrganizationalUnitI3D] [int] NULL,
	[Whenchanged] [datetime] NULL,
	[Whencreated] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADComputers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADComputers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Cn] [nvarchar](256) NULL,
	[Countrycode] [nvarchar](256) NULL,
	[Displayname] [nvarchar](256) NULL,
	[Distinguishedname] [nvarchar](256) NULL,
	[Dnshostname] [nvarchar](256) NULL,
	[Localpolicyflags] [nvarchar](256) NULL,
	[Memberof] [ntext] NULL,
	[Name] [nvarchar](256) NULL,
	[Objectguid] [nvarchar](256) NULL,
	[Objectsid] [nvarchar](256) NULL,
	[Operatingsystem] [nvarchar](256) NULL,
	[Operatingsystemservicepack] [nvarchar](256) NULL,
	[Operatingsystemversion] [nvarchar](256) NULL,
	[Primarygroupid] [nvarchar](256) NULL,
	[Samaccountname] [nvarchar](256) NULL,
	[Serviceprincipalname] [ntext] NULL,
	[Useraccountcontrol] [int] NOT NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[WhenChanged] [datetime] NULL,
	[WhenCreated] [datetime] NULL,
	[OrganizationalUnitI3D] [int] NULL,
	[DeviceI3D] [int] NULL,
	[Lastlogontimestamp] [datetime] NULL,
	[Accountexpires] [datetime] NULL,
	[Pwdlastset] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADContacts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADContacts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Cn] [nvarchar](256) NULL,
	[Displayname] [nvarchar](256) NULL,
	[Distinguishedname] [nvarchar](256) NULL,
	[Email] [nvarchar](256) NULL,
	[Memberof] [ntext] NULL,
	[Name] [nvarchar](256) NULL,
	[Objectcategory] [nvarchar](256) NULL,
	[Objectclass] [nvarchar](256) NULL,
	[Objectguid] [nvarchar](256) NULL,
	[Objectsid] [nvarchar](256) NULL,
	[Samaccountname] [nvarchar](256) NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[OrganizationalUnitI3D] [int] NULL,
	[Whencreated] [datetime] NULL,
	[Whenchanged] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADForeignSecurityPrincipals]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADForeignSecurityPrincipals](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Cn] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[Distinguishedname] [nvarchar](256) NULL,
	[Instancetype] [nvarchar](256) NULL,
	[Iscriticalsystemobject] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[Objectcategory] [nvarchar](256) NULL,
	[Objectclass] [nvarchar](256) NULL,
	[Objectguid] [nvarchar](256) NULL,
	[Showinadvancedviewonly] [nvarchar](256) NULL,
	[Systemflags] [nvarchar](256) NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[OrganizationalUnitI3D] [int] NULL,
	[Whencreated] [datetime] NULL,
	[Whenchanged] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADGroups]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADGroups](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[GroupName] [nvarchar](256) NULL,
	[DistinguishedName] [nvarchar](256) NULL,
	[SamAccountName] [nvarchar](256) NULL,
	[Cn] [nvarchar](256) NULL,
	[Objectguid] [nvarchar](256) NULL,
	[Objectsid] [nvarchar](256) NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[OrganizationalUnitI3D] [int] NULL,
	[Whencreated] [datetime] NULL,
	[Whenchanged] [datetime] NULL,
	[MemberOf] [ntext] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADGroupToGroup]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADGroupToGroup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ParentGroupI3D] [int] NOT NULL,
	[ChildGroupI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementADGroupToGroup] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADInetOrgPersons]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADInetOrgPersons](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Memberof] [ntext] NULL,
	[Accountexpires] [nvarchar](256) NULL,
	[Badpasswordtime] [nvarchar](256) NULL,
	[Lockouttime] [nvarchar](256) NULL,
	[Mail] [nvarchar](256) NULL,
	[Objectguid] [nvarchar](256) NULL,
	[Pwdlastset] [nvarchar](256) NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[Adspath] [nvarchar](256) NULL,
	[Badpwdcount] [nvarchar](256) NULL,
	[Cn] [nvarchar](256) NULL,
	[Codepage] [nvarchar](256) NULL,
	[Countrycode] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[Displayname] [nvarchar](256) NULL,
	[Distinguishedname] [nvarchar](256) NULL,
	[Instancetype] [nvarchar](256) NULL,
	[Iscriticalsystemobject] [nvarchar](256) NULL,
	[Msexchalobjectversion] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[Objectcategory] [nvarchar](256) NULL,
	[Objectclass] [nvarchar](256) NULL,
	[Objectsid] [nvarchar](256) NULL,
	[Primarygroupid] [nvarchar](256) NULL,
	[Samaccounttype] [nvarchar](256) NULL,
	[Useraccountcontrol] [nvarchar](256) NULL,
	[Samaccountname] [nvarchar](256) NULL,
	[OrganizationalUnitI3D] [int] NULL,
	[Whenchanged] [datetime] NULL,
	[Whencreated] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADOrganizationalUnits]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADOrganizationalUnits](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ParentI3D] [int] NULL,
	[CustomerI3D] [int] NOT NULL,
	[ObjectClass] [nvarchar](256) NOT NULL,
	[Ou] [nvarchar](256) NOT NULL,
	[DistinguishedName] [nvarchar](256) NOT NULL,
	[InstanceType] [nvarchar](256) NULL,
	[WhenCreated] [nvarchar](256) NULL,
	[WhenChanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NOT NULL,
	[Objectguid] [nvarchar](256) NOT NULL,
	[Objectcategory] [nvarchar](256) NOT NULL,
	[Dscorepropagationdata] [nvarchar](256) NULL,
	[Ntsecuritydescriptor] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDate] [datetime] NULL,
	[CustomerSiteI3D] [int] NULL,
 CONSTRAINT [PK_AssetManagementADOrganizationalUnits] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADSystemUserExclusion]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADSystemUserExclusion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExclusionKind] [int] NOT NULL,
	[ObjectSID] [nvarchar](512) NOT NULL,
	[SamAccountName] [nvarchar](512) NOT NULL,
 CONSTRAINT [PK_AssetManagementADSystemUserExclusion] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADUsers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADUsers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[EmailID] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[Cn] [nvarchar](256) NULL,
	[Displayname] [nvarchar](256) NULL,
	[Distinguishedname] [nvarchar](256) NULL,
	[Memberof] [ntext] NULL,
	[Objectguid] [nvarchar](256) NULL,
	[Objectsid] [nvarchar](256) NULL,
	[Samaccountname] [nvarchar](256) NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[PrivatePhoneNumber] [nvarchar](256) NULL,
	[MobilePhoneNumber] [nvarchar](256) NULL,
	[PhoneNumber] [nvarchar](256) NULL,
	[Company] [nvarchar](256) NULL,
	[Address] [nvarchar](256) NULL,
	[Zip] [nvarchar](256) NULL,
	[City] [nvarchar](256) NULL,
	[FederalState] [nvarchar](256) NULL,
	[Country] [nvarchar](256) NULL,
	[Title] [nvarchar](256) NULL,
	[IsAdministrator] [bit] NULL,
	[UserAccountControl] [int] NULL,
	[WhenChanged] [datetime] NULL,
	[WhenCreated] [datetime] NULL,
	[OrganizationalUnitI3D] [int] NULL,
	[Lastlogontimestamp] [datetime] NULL,
	[Accountexpires] [datetime] NULL,
	[Pwdlastset] [datetime] NULL,
	[CustomerSiteI3D] [int] NULL,
	[FirstName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADUserToGroup]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADUserToGroup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GroupI3D] [int] NOT NULL,
	[UserI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementADUserToGroup] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementADVolumes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementADVolumes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Admindescription] [nvarchar](256) NULL,
	[Admindisplayname] [nvarchar](256) NULL,
	[Cn] [nvarchar](256) NULL,
	[Defaulthidingvalue] [nvarchar](256) NULL,
	[Defaultsecuritydescriptor] [nvarchar](256) NULL,
	[Distinguishedname] [nvarchar](256) NULL,
	[Governsid] [nvarchar](256) NULL,
	[Instancetype] [nvarchar](256) NULL,
	[Ldapdisplayname] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[Objectcategory] [nvarchar](256) NULL,
	[Objectclass] [nvarchar](256) NULL,
	[Objectclasscategory] [nvarchar](256) NULL,
	[Objectguid] [nvarchar](256) NULL,
	[Rdnattid] [nvarchar](256) NULL,
	[Schemaidguid] [nvarchar](256) NULL,
	[Showinadvancedviewonly] [nvarchar](256) NULL,
	[Subclassof] [nvarchar](256) NULL,
	[Systemflags] [nvarchar](256) NULL,
	[Systemmustcontain] [nvarchar](256) NULL,
	[Systemonly] [nvarchar](256) NULL,
	[Systemposssuperiors] [nvarchar](256) NULL,
	[Usnchanged] [nvarchar](256) NULL,
	[Usncreated] [nvarchar](256) NULL,
	[Whenchanged] [nvarchar](256) NULL,
	[Whencreated] [nvarchar](256) NULL,
	[OrganizationalUnitI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementAntivirusChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementAntivirusChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PerformCheck] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementAntivirusInformations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementAntivirusInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AntiVirusName] [nvarchar](256) NOT NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDate] [datetime] NULL,
	[IsDeleted] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementAntivirusInformations] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementAntivirusSoftware]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementAntivirusSoftware](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[DisplayName] [nvarchar](512) NOT NULL,
	[CompanyName] [nvarchar](128) NULL,
	[IsProductUpToDate] [bit] NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementApplicationClassificationProducts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementApplicationClassificationProducts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Product] [nvarchar](256) NOT NULL,
	[ClassificationI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementApplicationClassifications]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementApplicationClassifications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](256) NOT NULL,
	[ShortSign] [nvarchar](16) NULL,
	[Description] [nvarchar](4000) NULL,
	[SortOrder] [int] NULL,
	[Parent] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementArticleAssignment]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementArticleAssignment](
	[AssetArticleTypeId] [int] NULL,
	[ArticleCode] [varchar](60) NOT NULL,
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RMMArticleKind] [int] NULL,
	[ArticleI3D] [int] NOT NULL,
	[TypeKind] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementAviraConfigurations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementAviraConfigurations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[EntryInStartMenu] [bit] NOT NULL,
	[DesktopSymbol] [bit] NOT NULL,
	[Password] [nvarchar](512) NULL,
	[Language] [int] NOT NULL,
	[AviraGuard] [bit] NOT NULL,
	[MailScanner] [bit] NOT NULL,
	[WebGuard] [bit] NOT NULL,
	[Firewall] [bit] NOT NULL,
	[ShellExtension] [bit] NOT NULL,
	[Rootkit] [bit] NOT NULL,
	[ProActiv] [bit] NOT NULL,
	[ShowReadMe] [bit] NOT NULL,
	[RestartWindows] [bit] NOT NULL,
	[ShowRestartMessage] [bit] NOT NULL,
	[SetupMode] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementAviraLicenseInformations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementAviraLicenseInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[LicenseRuntimeInMonth] [int] NOT NULL,
	[LicenseCount] [int] NOT NULL,
	[AviraProductID] [int] NULL,
	[AviraProductName] [nvarchar](512) NULL,
	[ActiveLicenseCount] [int] NOT NULL,
	[LicenseKey] [ntext] NULL,
	[ExpirationDate] [datetime] NULL,
	[ActivationKind] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementBackupJobs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementBackupJobs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[JobId] [nvarchar](255) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[AdditionalInformation] [text] NULL,
	[StartTime] [datetime] NOT NULL,
	[EndTime] [datetime] NOT NULL,
	[ErrorReason] [nvarchar](4000) NULL,
	[Status] [int] NOT NULL,
	[Product] [nvarchar](255) NOT NULL,
	[ProductVersion] [nvarchar](255) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[LastAction] [datetime] NULL,
 CONSTRAINT [PK_CSI_AssetManagementBackupJobs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementBackupStatusChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementBackupStatusChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BackupTypeI3D] [int] NOT NULL,
	[ServerName] [nvarchar](256) NOT NULL,
	[DatabaseName] [nvarchar](256) NOT NULL,
	[Domain] [nvarchar](256) NULL,
	[UserName] [nvarchar](256) NULL,
	[Password] [nvarchar](256) NULL,
	[NextRun] [int] NULL,
	[IntegratedSecurity] [bit] NULL,
	[BackupJobId] [nvarchar](256) NULL,
 CONSTRAINT [PK_CSI_AssetManagementBackupStatusChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCheckErrorLogs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCheckErrorLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceId] [int] NULL,
	[CheckType] [int] NULL,
	[CheckConfigurationId] [int] NULL,
	[ErrorDescription] [ntext] NOT NULL,
	[ErrorDate] [datetime] NOT NULL,
	[Type] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCheckResultsHistory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCheckResultsHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CheckResultID] [int] NOT NULL,
	[CheckConfigurationID] [int] NOT NULL,
	[State] [nvarchar](50) NOT NULL,
	[Resolved] [nvarchar](50) NULL,
	[Message] [nvarchar](max) NULL,
	[Date] [datetime] NULL,
	[ActualResultValue] [nvarchar](256) NULL,
	[HistoryCreatedDate] [datetime] NOT NULL,
	[OriginalValue] [nvarchar](256) NULL,
 CONSTRAINT [IX_AssetManagementCheckResultsHistory_UniqueI3D] UNIQUE NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementCheckResultsHistory_CheckConfigurationId]    Script Date: 11.11.2025 11:20:27 ******/
CREATE CLUSTERED INDEX [IX_AssetManagementCheckResultsHistory_CheckConfigurationId] ON [dbo].[AssetManagementCheckResultsHistory]
(
	[CheckConfigurationID] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementChecks](
	[CheckID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](64) NOT NULL,
	[IsActive] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[CheckID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementComments]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementComments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Description] [nvarchar](max) NULL,
	[ShortDescription] [nvarchar](512) NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDate] [datetime] NULL,
	[ObjectSpecialKey] [nvarchar](100) NULL,
 CONSTRAINT [PK_AssetManagementComments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementComputerSystem]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementComputerSystem](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Manufacturer] [nvarchar](256) NULL,
	[Model] [nvarchar](256) NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[TotalPhysicalMemory] [bigint] NULL,
	[PopulatedMemorySlots] [int] NULL,
	[TotalMemorySlots] [int] NULL,
	[UUID] [nvarchar](256) NULL,
	[NetBIOSName] [nvarchar](256) NULL,
	[SystemType] [nvarchar](256) NULL,
	[QSTEnabled] [bit] NULL,
	[PopulatedMemory_Slots] [varchar](255) NULL,
	[TotalMemory_Slots] [varchar](255) NULL,
	[UserName] [nvarchar](256) NULL,
	[ThermalState] [int] NULL,
	[SystemSKUNumber] [nvarchar](256) NULL,
	[PowerSupplyState] [int] NULL,
	[PowerState] [int] NULL,
	[Domain] [nvarchar](256) NULL,
	[DNSHostName] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[AdminPasswordStatus] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCustomCategoryColumns]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCustomCategoryColumns](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](512) NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[DataKind] [int] NOT NULL,
	[DefaultValue] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCustomCategoryData]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCustomCategoryData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ColumnI3D] [int] NOT NULL,
	[Value] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCustomCategoryLayouts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCustomCategoryLayouts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Value] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCustomCategorySettings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCustomCategorySettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ColumnI3D] [int] NOT NULL,
	[Value] [nvarchar](512) NOT NULL,
	[Name] [nvarchar](512) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCustomDeviceCategories]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCustomDeviceCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Image] [image] NULL,
	[IsActive] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCustomerDomains]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCustomerDomains](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DomainName] [nvarchar](256) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDatetime] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDatetime] [datetime] NULL,
 CONSTRAINT [PK_AssetManagementCustomerDomains] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCustomInventories]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCustomInventories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](64) NOT NULL,
	[CustomDeviceCategoryI3D] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCveSecurityIssueApplications]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCveSecurityIssueApplications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SecurityIssueI3D] [int] NOT NULL,
	[CveEntryID] [varchar](64) NOT NULL,
	[Application] [nvarchar](512) NOT NULL,
	[Version] [nvarchar](64) NULL,
	[Publisher] [nvarchar](64) NULL,
 CONSTRAINT [PK_AssetManagementCveSecurityIssueApplications] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementCveSecurityIssueReferenceLinks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementCveSecurityIssueReferenceLinks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SecurityIssueI3D] [int] NOT NULL,
	[CveEntryID] [varchar](64) NOT NULL,
	[Link] [nvarchar](4000) NOT NULL,
	[Description] [nvarchar](4000) NULL,
 CONSTRAINT [PK_AssetManagementCveSecurityIssueReferenceLinks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDefaultCheckConfigurations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDefaultCheckConfigurations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CheckName] [nvarchar](50) NULL,
	[Drive] [nvarchar](50) NULL,
	[Error] [float] NULL,
	[Warning] [float] NULL,
	[NameOfServices] [ntext] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDeviceChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDeviceChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CheckConfigurationI3D] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDeviceChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDeviceDependenyMappings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDeviceDependenyMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[ParentDeviceI3D] [int] NULL,
	[ChildDeviceI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDeviceRating]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDeviceRating](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Caption] [nvarchar](500) NULL,
	[Comment] [nvarchar](4000) NOT NULL,
	[Rating] [int] NOT NULL,
	[RatingDate] [datetime] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDeviceToMonitoringClient]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDeviceToMonitoringClient](
	[CustomerToMonitoringClientI3D] [int] NOT NULL,
	[AssetManagementDevicesI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDeviceToOrgUnits]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDeviceToOrgUnits](
	[OrgUnitI3D] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDHCPDetails]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDHCPDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[BindingAddress] [nvarchar](256) NULL,
	[BindingDescription] [nvarchar](256) NULL,
	[ScopeAddress] [nvarchar](256) NULL,
	[ScopeAddressValue] [nvarchar](256) NULL,
	[ScopeDescription] [nvarchar](256) NULL,
	[ScopeStartAddress] [nvarchar](256) NULL,
	[ScopeEndAddress] [nvarchar](256) NULL,
	[ScopeSubnetMask] [nvarchar](256) NULL,
	[ReservationIPAddress] [nvarchar](256) NULL,
	[ReservationIPAddressValue] [nvarchar](256) NULL,
	[ReservationDescription] [nvarchar](256) NULL,
	[ReservationSubnetAddress] [nvarchar](256) NULL,
	[ReservationSubnetAddressValue] [nvarchar](256) NULL,
	[ReservationMACAddress] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDHCPFilterRecords]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDHCPFilterRecords](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServerConfigurationI3D] [int] NULL,
	[FilterRecordComment] [nvarchar](256) NULL,
	[FilterRecordIsWildcard] [nvarchar](256) NULL,
	[FilterRecordPattern] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDHCPServerConfigurations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDHCPServerConfigurations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[ServerVersion] [nvarchar](256) NULL,
	[ServerName] [nvarchar](256) NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDHCPServerSubnetInfos]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDHCPServerSubnetInfos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServerConfigurationI3D] [int] NULL,
	[Subnet] [nvarchar](256) NULL,
	[SubNetName] [nvarchar](256) NULL,
	[SubNetStatus] [nvarchar](256) NULL,
	[SubNetMask] [nvarchar](256) NULL,
	[SubNetLeaseDuration] [nvarchar](256) NULL,
	[SubNetOfferDelay] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDHCPServerSubnetIPRanges]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDHCPServerSubnetIPRanges](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServerSubnetInfoI3D] [int] NULL,
	[IpRangeHighAddress] [nvarchar](256) NULL,
	[IpRangeLowAddress] [nvarchar](256) NULL,
	[IpRangeType] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDHCPServerSubnetLeaseInfos]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDHCPServerSubnetLeaseInfos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServerSubnetInfoI3D] [int] NULL,
	[LeaseHostInfoComment] [nvarchar](256) NULL,
	[LeaseHostInfoIPv4] [nvarchar](256) NULL,
	[LeaseHostInfoIsReserved] [nvarchar](256) NULL,
	[LeaseHostInfoLeaseExpires] [nvarchar](256) NULL,
	[LeaseHostInfoMAC] [nvarchar](256) NULL,
	[LeaseHostInfoMask] [nvarchar](256) NULL,
	[LeaseHostInfoName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDHCPServerSubnetOptions]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDHCPServerSubnetOptions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServerSubnetInfoI3D] [int] NULL,
	[OptionID] [nvarchar](256) NULL,
	[OptionValues] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[ServerConfigurationI3D] [int] NULL,
	[TypeID] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDHCPServerSubnetReservationsHostInfos]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDHCPServerSubnetReservationsHostInfos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServerSubnetInfoI3D] [int] NULL,
	[ReservationsHostInfoComment] [nvarchar](256) NULL,
	[ReservationsHostInfoIPv4] [nvarchar](256) NULL,
	[ReservationsHostInfoIsReserved] [nvarchar](256) NULL,
	[ReservationsHostInfoLeaseExpires] [nvarchar](256) NULL,
	[ReservationsHostInfoMAC] [nvarchar](256) NULL,
	[ReservationsHostInfoMask] [nvarchar](256) NULL,
	[ReservationsHostInfoName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDiagramPreviews]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDiagramPreviews](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DiagramI3D] [int] NOT NULL,
	[Name] [nvarchar](150) NULL,
	[Image] [image] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDiagrams]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDiagrams](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DiagramData] [text] NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[Description] [nvarchar](1000) NULL,
	[CustomerI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDiagrams] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDiagramShapes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDiagramShapes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Data] [nvarchar](4000) NOT NULL,
 CONSTRAINT [PK_AssetManagementDiagramShapes] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDNSInformations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDNSInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[DNSObjectTypeI3D] [int] NULL,
	[KeyName] [nvarchar](256) NULL,
	[Value] [nvarchar](500) NULL,
	[Type] [nvarchar](256) NULL,
	[ContainerName] [nvarchar](256) NULL,
	[DnsServerName] [nvarchar](500) NULL,
	[DomainName] [nvarchar](256) NULL,
	[IPAddress] [nvarchar](256) NULL,
	[Aging] [nvarchar](256) NULL,
	[ForwarderSlave] [nvarchar](256) NULL,
	[ForwarderTimeout] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[ZoneType] [nvarchar](256) NULL,
	[BindSecondaries] [nvarchar](256) NULL,
	[BootMethod] [nvarchar](256) NULL,
	[NoRecursion] [nvarchar](256) NULL,
	[TTL] [nvarchar](256) NULL,
	[PrimaryServer] [nvarchar](256) NULL,
	[StrictFileParsing] [nvarchar](256) NULL,
	[Version] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDNSObjectTypes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDNSObjectTypes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectTypeName] [nvarchar](50) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDNSServers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDNSServers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[ServerName] [nvarchar](255) NOT NULL,
	[IPAddress] [nvarchar](25) NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDNSServerSettings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDNSServerSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DNSServerI3D] [int] NOT NULL,
	[BindSecondaries] [bit] NULL,
	[BootMethod] [int] NOT NULL,
	[EnableIPv6] [bit] NULL,
	[LocalNetPriority] [bit] NULL,
	[VersionNumber] [nvarchar](25) NULL,
	[RoundRobin] [bit] NULL,
	[StrictFileParsing] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDNSStatistics]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDNSStatistics](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DNSServerI3D] [int] NOT NULL,
	[TotalQueriesReceived] [int] NULL,
	[TotalResponsesSent] [int] NULL,
	[UDPQueriesReceived] [int] NULL,
	[UDPResponsesSent] [int] NULL,
	[UDPQueriesSent] [int] NULL,
	[UDPResponsesReceived] [int] NULL,
	[TCPClientConnections] [int] NULL,
	[TCPQueriesReceived] [int] NULL,
	[TCPResponsesSent] [int] NULL,
	[TCPQueriesSent] [int] NULL,
	[TCPResponsesReceived] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDNSZones]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDNSZones](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DNSServerI3D] [int] NOT NULL,
	[ZoneName] [nvarchar](255) NOT NULL,
	[ZoneType] [int] NOT NULL,
	[IsAutoCreated] [bit] NULL,
	[IsDsIntegrated] [bit] NULL,
	[IsReverseLookupZone] [bit] NULL,
	[IsSigned] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDocumentation]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDocumentation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CurrentVersion] [int] NOT NULL,
	[Name] [nvarchar](200) NULL,
	[CustomerI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDocumentation] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDocumentationFile]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDocumentationFile](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GroupI3D] [int] NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[Name] [nvarchar](200) NULL,
	[Data] [image] NULL,
	[Kind] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDocumentationFile] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDocumentationGroup]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDocumentationGroup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentationI3D] [int] NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[Name] [nvarchar](200) NULL,
 CONSTRAINT [PK_AssetManagementDocumentationGroup] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDocumentationTemplate]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDocumentationTemplate](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NULL,
 CONSTRAINT [PK_AssetManagementDocumentationTemplate] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDocumentationTemplateGroup]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDocumentationTemplateGroup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[Name] [nvarchar](200) NULL,
	[TemplateI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDocumentationTemplateGroup] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDocumentationVersion]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDocumentationVersion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentationI3D] [int] NOT NULL,
	[Version] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[Data] [image] NULL,
 CONSTRAINT [PK_AssetManagementDocumentationVersion] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDomain]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDomain](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DomainName] [varchar](255) NOT NULL,
	[LastActivityDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDomainContacts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDomainContacts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DomainI3D] [int] NOT NULL,
	[ContactName] [nvarchar](256) NOT NULL,
	[ContactEmail] [nvarchar](256) NOT NULL,
	[ContactPhone] [nvarchar](30) NULL,
	[ContactFax] [nvarchar](30) NULL,
	[IsActive] [bit] NOT NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDatetime] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDatetime] [datetime] NULL,
 CONSTRAINT [PK_AssetManagementDomainContacts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotDriver]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotDriver](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[CategoryI3D] [int] NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[Description] [ntext] NULL,
	[DefaultVersionI3D] [int] NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotDriver] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotDriverCategory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotDriverCategory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[Description] [ntext] NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotDriverCategory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotDriverVersion]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotDriverVersion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DriverI3D] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [ntext] NULL,
	[FileGuid] [uniqueidentifier] NULL,
	[FileSize] [bigint] NULL,
	[ReleaseDate] [datetime] NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[FileUpdateDate] [datetime] NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotDriverVersion] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotModel]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotModel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Manufacturer] [nvarchar](255) NULL,
	[Model] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotModel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotModelToVersion]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotModelToVersion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VersionI3D] [int] NOT NULL,
	[ModelI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotModelToVersion] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotOperatingSystem]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotOperatingSystem](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Architecture] [nvarchar](32) NULL,
	[IsReadOnly] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotOperatingSystem] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotOperatingSystemToVersion]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotOperatingSystemToVersion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VersionI3D] [int] NOT NULL,
	[OperatingSystemI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotOperatingSystemToVersion] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotTyp]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotTyp](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotTyp] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotTypToModel]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotTypToModel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ModelI3D] [int] NOT NULL,
	[TypI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotTypToModel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDriverDepotTypToVersion]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDriverDepotTypToVersion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VersionI3D] [int] NOT NULL,
	[TypI3D] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementDriverDepotTypToVersion] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementDrivers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementDrivers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NULL,
	[Caption] [nvarchar](256) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[InstallDate] [datetime] NULL,
	[DriverState] [nvarchar](128) NULL,
	[CreationClassName] [nvarchar](512) NULL,
	[DriverVersion] [nvarchar](32) NULL,
	[Status] [nvarchar](256) NULL,
	[StartName] [nvarchar](256) NULL,
	[StartMode] [nvarchar](256) NULL,
	[DisplayName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementEmergencyPlan]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementEmergencyPlan](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmergencyItemI3D] [int] NOT NULL,
	[EmergencyKind] [nvarchar](50) NULL,
	[ReactionTimePerHour] [int] NOT NULL,
	[CountOfAffectedEmployees] [int] NOT NULL,
	[ShortDescription] [nvarchar](256) NULL,
	[ProcedureDescription] [nvarchar](256) NULL,
	[Status] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementEmergencyTypes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementEmergencyTypes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmergencyTypeName] [nvarchar](256) NOT NULL,
	[ReactionTimePerHour] [int] NULL,
	[Description] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementEventlog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementEventlog](
	[I3D] [bigint] IDENTITY(1,1) NOT NULL,
	[OccuredDateTime] [datetime] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[EventId] [int] NOT NULL,
	[Severity] [int] NOT NULL,
	[Message] [nvarchar](4000) NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceName] [nvarchar](500) NOT NULL,
	[ProviderName] [nvarchar](200) NULL,
	[LogFileName] [nvarchar](512) NULL
) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementEventlogCustomerIndex]    Script Date: 11.11.2025 11:20:27 ******/
CREATE CLUSTERED INDEX [AssetManagementEventlogCustomerIndex] ON [dbo].[AssetManagementEventlog]
(
	[CustomerI3D] ASC,
	[OccuredDateTime] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementEventLogChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementEventLogChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LogType] [nvarchar](256) NOT NULL,
	[ProviderName] [nvarchar](256) NOT NULL,
	[IntervalInDays] [int] NOT NULL,
	[EventId] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementEventLogChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementEventLogDescription]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementEventLogDescription](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EventCategory] [nvarchar](256) NOT NULL,
	[EventID] [int] NOT NULL,
	[EventDescription] [nvarchar](512) NULL,
	[EventCategoryTyp] [int] NOT NULL,
	[OptionalDescription] [ntext] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementEWSMailBoxes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementEWSMailBoxes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[IdentityValue] [nvarchar](256) NULL,
	[Mailbox] [nvarchar](256) NULL,
	[Domain] [nvarchar](256) NULL,
	[Alias] [nvarchar](256) NULL,
	[ServerName] [nvarchar](256) NULL,
	[ProhibitSendQuota] [nvarchar](256) NULL,
	[ProhibitSendReceiveQuota] [nvarchar](256) NULL,
	[MaxSendSize] [nvarchar](256) NULL,
	[MaxReceiveSize] [nvarchar](256) NULL,
	[DatabaseName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementEWSPermissions]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementEWSPermissions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MailBoxI3D] [int] NULL,
	[IdentityValue] [nvarchar](256) NULL,
	[DenyValue] [nvarchar](256) NULL,
	[AccessRights] [nvarchar](256) NULL,
	[InheritanceType] [nvarchar](256) NULL,
	[IsValid] [nvarchar](256) NOT NULL,
	[ObjectState] [nvarchar](256) NULL,
	[UserName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementEWSStatistics]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementEWSStatistics](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[UserName] [nvarchar](256) NULL,
	[DisplayName] [nvarchar](500) NULL,
	[TotalItemSize] [nvarchar](256) NULL,
	[ItemCount] [nvarchar](256) NULL,
	[MailBoxI3D] [int] NULL,
	[IdentityValue] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementExMailboxDatabases]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementExMailboxDatabases](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExServerI3D] [int] NOT NULL,
	[IdentityValue] [nvarchar](256) NOT NULL,
	[DatabaseSize] [nvarchar](256) NULL,
	[IssueWarningQuota] [nvarchar](256) NULL,
	[ServerName] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[ProhibitSendQuota] [nvarchar](256) NULL,
	[ProhibitSendReceiveQuota] [nvarchar](256) NULL,
	[PublicFolderDatabase] [nvarchar](256) NULL,
	[GuidIdentifier] [nvarchar](256) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementExMailboxFolderStatistics]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementExMailboxFolderStatistics](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExMailboxI3D] [int] NOT NULL,
	[FolderId] [nvarchar](256) NOT NULL,
	[FolderPath] [nvarchar](256) NULL,
	[FolderAndSubfolderSize] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementExMailboxPermissions]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementExMailboxPermissions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExMailboxI3D] [int] NOT NULL,
	[UserName] [nvarchar](256) NOT NULL,
	[AccessRights] [nvarchar](256) NULL,
	[IdentityValue] [nvarchar](256) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementExMailboxs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementExMailboxs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExMailboxDBI3D] [int] NOT NULL,
	[DatabaseName] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[UserPrincipalName] [nvarchar](256) NULL,
	[GuidIdentifier] [nvarchar](256) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementExMailboxStatistics]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementExMailboxStatistics](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExMailboxI3D] [int] NOT NULL,
	[DatabaseName] [nvarchar](256) NULL,
	[DisplayName] [nvarchar](256) NULL,
	[IdentityValue] [nvarchar](256) NOT NULL,
	[ItemCount] [int] NULL,
	[TotalItemSize] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementExServers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementExServers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Name] [nvarchar](256) NOT NULL,
	[Domain] [nvarchar](256) NULL,
	[OrganizationalUnit] [nvarchar](256) NULL,
	[IdentityValue] [nvarchar](256) NOT NULL,
	[GuidIdentifier] [nvarchar](256) NOT NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementFolderForShare]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementFolderForShare](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[ShareName] [nvarchar](256) NULL,
	[Path] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementFolderInformations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementFolderInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[ParentI3D] [int] NULL,
	[FolderName] [nvarchar](256) NOT NULL,
	[FolderPath] [nvarchar](1000) NOT NULL,
	[FolderType] [bigint] NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[CreatedDatetime] [datetime] NOT NULL,
	[ChangedBy] [int] NULL,
	[ChangedDatetime] [datetime] NULL,
	[IsShareRoot] [bit] NOT NULL,
	[PermissionsNotEqualToParent] [bit] NOT NULL,
	[ParentI3DWithPermissions] [int] NULL,
 CONSTRAINT [PK_AssetManagementFolderInformations] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementFolderPermissions]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementFolderPermissions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FolderI3D] [int] NOT NULL,
	[PermissionType] [int] NOT NULL,
	[Permission] [int] NOT NULL,
	[UserName] [nvarchar](256) NOT NULL,
	[AccountDomainSid] [nvarchar](256) NULL,
	[AccountSid] [nvarchar](256) NOT NULL,
 CONSTRAINT [IX_AssetManagementFolderPermissions_I3DUnique] UNIQUE NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementFolderPermissions_FolderI3DClustered]    Script Date: 11.11.2025 11:20:27 ******/
CREATE CLUSTERED INDEX [IX_AssetManagementFolderPermissions_FolderI3DClustered] ON [dbo].[AssetManagementFolderPermissions]
(
	[FolderI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHardDriveChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHardDriveChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Drive] [nvarchar](256) NOT NULL,
	[Error] [float] NULL,
	[Warning] [float] NULL,
	[Criteria] [nvarchar](10) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHttpChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHttpChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WebsiteUrl] [nvarchar](255) NOT NULL,
	[Timeout] [int] NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_CSI_AssetManagementHttpChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVComputerSystems]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVComputerSystems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HVSystemServiceSettingI3D] [int] NOT NULL,
	[ElementName] [nvarchar](255) NULL,
	[Description] [nvarchar](255) NULL,
	[EnabledState] [int] NULL,
	[HealthState] [int] NULL,
	[OperationalStatus] [int] NULL,
	[InstallDate] [datetime] NULL,
	[OnTimeInMilliseconds] [int] NULL,
	[SnapshotDataRoot] [nvarchar](255) NULL,
	[AutomaticShutdownAction] [int] NULL,
	[AutomaticStartupAction] [int] NULL,
	[AutomaticStartupActionDelay] [datetime] NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVMemorys]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVMemorys](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HVVirtualSystemSettingsI3D] [int] NOT NULL,
	[DynamicMemoryEnabled] [bit] NULL,
	[Limit] [int] NULL,
	[VirtualQuantity] [int] NULL,
	[Weight] [int] NULL,
	[TargetMemoryBuffer] [int] NULL,
	[ElementName] [nvarchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVPortDetails]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVPortDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HVSwitchPortI3D] [int] NOT NULL,
	[Name] [nvarchar](255) NULL,
	[SharedNetworkAdapter] [bit] NULL,
	[VLANID] [int] NULL,
	[IdentifyVLAN] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVProcessors]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVProcessors](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HVVirtualSystemSettingsI3D] [int] NOT NULL,
	[ElementName] [nvarchar](255) NULL,
	[Limit] [int] NULL,
	[LimitCPUID] [int] NULL,
	[LimitProcessorFeatures] [int] NULL,
	[VirtualQuantity] [int] NULL,
	[Reservation] [int] NULL,
	[Weight] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVSwitchPorts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVSwitchPorts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HVVirtualSwitchI3D] [int] NOT NULL,
	[PortType] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVSystemServices]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVSystemServices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceName] [nvarchar](255) NULL,
	[OperationalStatus] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVSystemServiceSettings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVSystemServiceSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HVSystemServiceI3D] [int] NOT NULL,
	[ScanDate] [datetime] NULL,
	[DefaultExternalDataRoot] [nvarchar](255) NULL,
	[DefaultVirtualHardDiskPath] [nvarchar](255) NULL,
	[MaximumMacAddress] [nvarchar](255) NULL,
	[MinimumMacAddress] [nvarchar](255) NULL,
	[NumaSpanningEnabled] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVVirtualSwitchs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVVirtualSwitchs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HVSystemServiceSettingI3D] [int] NOT NULL,
	[ElementName] [nvarchar](255) NULL,
	[Description] [nvarchar](255) NULL,
	[Name] [nvarchar](255) NULL,
	[HealthState] [int] NULL,
	[EnabledDefault] [int] NULL,
	[Status] [nvarchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementHVVirtualSystemSettings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementHVVirtualSystemSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HVComputerSystemI3D] [int] NOT NULL,
	[BaseBoardSerialNumber] [nvarchar](255) NULL,
	[BIOSGUID] [nvarchar](255) NULL,
	[BIOSNumLock] [bit] NULL,
	[Notes] [nvarchar](255) NULL,
	[SettingType] [int] NULL,
	[SnapshotName] [nvarchar](255) NULL,
	[Parent] [int] NULL,
	[BootOrder] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISApplicationPools]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISApplicationPools](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[ApplicationPoolName] [nvarchar](256) NULL,
	[AppPoolStatus] [nvarchar](256) NULL,
	[FrameworkVersion] [nvarchar](256) NULL,
	[ManagedPipelineMode] [nvarchar](256) NULL,
	[AppPoolIdentity] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISMimeMapSettings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISMimeMapSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IISServerI3D] [int] NULL,
	[Extension] [nvarchar](256) NULL,
	[MimeType] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISServers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISServers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[ServerName] [nvarchar](256) NULL,
	[ServerIP] [nvarchar](256) NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISServerSites]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISServerSites](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ApplicationPoolI3D] [int] NULL,
	[SiteName] [nvarchar](256) NULL,
	[AppPoolId] [nvarchar](256) NULL,
	[AccessSSL] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISWebsiteErrors]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISWebsiteErrors](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IISWebsiteI3D] [int] NULL,
	[HandlerType] [nvarchar](256) NULL,
	[HttpErrorCode] [nvarchar](256) NULL,
	[HttpErrorSubcode] [nvarchar](256) NULL,
	[HandlerLocation] [nvarchar](256) NULL,
	[WebsiteErrorStringID] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISWebsiteFilters]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISWebsiteFilters](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IISWebsiteI3D] [int] NULL,
	[FilterEnabled] [nvarchar](256) NULL,
	[FilterPath] [nvarchar](256) NULL,
	[FilterState] [int] NULL,
	[Name] [nvarchar](256) NULL,
	[FilterDescription] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISWebsiteMIMETypes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISWebsiteMIMETypes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IISWebsiteI3D] [int] NULL,
	[Extension] [nvarchar](256) NULL,
	[MimeType] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISWebsites]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISWebsites](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IISServerI3D] [int] NULL,
	[AccessExecute] [bit] NULL,
	[AccessFlags] [int] NULL,
	[AccessNoRemoteExecute] [bit] NULL,
	[AccessNoRemoteRead] [bit] NULL,
	[AccessNoRemoteScript] [bit] NULL,
	[AccessNoRemoteWrite] [bit] NULL,
	[AccessRead] [bit] NULL,
	[AccessScript] [bit] NULL,
	[AccessSource] [bit] NULL,
	[AccessSSL] [bit] NULL,
	[AccessSSL128] [bit] NULL,
	[AccessSSLFlags] [int] NULL,
	[AccessSSLMapCert] [bit] NULL,
	[AccessSSLNegotiateCert] [bit] NULL,
	[AccessSSLRequireCert] [bit] NULL,
	[AccessWrite] [bit] NULL,
	[AllowKeepAlive] [bit] NULL,
	[AnonymousUserName] [nvarchar](256) NULL,
	[AnonymousUserPass] [nvarchar](256) NULL,
	[AppAllowClientDebug] [bit] NULL,
	[AppAllowDebugging] [bit] NULL,
	[AppFriendlyName] [nvarchar](256) NULL,
	[AppPoolId] [nvarchar](256) NULL,
	[AspAllowOutOfProcComponents] [bit] NULL,
	[AspAllowSessionState] [bit] NULL,
	[AspBufferingLimit] [int] NULL,
	[AspBufferingOn] [bit] NULL,
	[AspEnableSxs] [bit] NULL,
	[AspScriptErrorMessage] [nvarchar](256) NULL,
	[AspScriptErrorSentToBrowser] [bit] NULL,
	[AspScriptLanguage] [nvarchar](256) NULL,
	[AspScriptTimeout] [int] NULL,
	[AspSessionTimeout] [int] NULL,
	[AspSxsName] [nvarchar](256) NULL,
	[AuthAdvNotifyDisable] [bit] NULL,
	[AuthAnonymous] [bit] NULL,
	[AuthBasic] [bit] NULL,
	[AuthChangeDisable] [bit] NULL,
	[AuthChangeUnsecure] [bit] NULL,
	[AuthFlags] [int] NULL,
	[AuthMD5] [bit] NULL,
	[AuthNTLM] [bit] NULL,
	[AuthPassport] [bit] NULL,
	[AuthPersistence] [int] NULL,
	[AuthPersistSingleRequest] [bit] NULL,
	[CacheISAPI] [bit] NULL,
	[CertCheckMode] [int] NULL,
	[ClusterEnabled] [bit] NULL,
	[ConnectionTimeout] [int] NULL,
	[ContentIndexed] [bit] NULL,
	[DefaultDocFooter] [nvarchar](256) NULL,
	[DefaultLogonDomain] [nvarchar](256) NULL,
	[DirBrowseFlags] [int] NULL,
	[DirBrowseShowDate] [bit] NULL,
	[DirBrowseShowExtension] [bit] NULL,
	[DirBrowseShowLongDate] [bit] NULL,
	[DirBrowseShowSize] [bit] NULL,
	[DirBrowseShowTime] [bit] NULL,
	[DoDynamicCompression] [bit] NULL,
	[DontLog] [bit] NULL,
	[DoStaticCompression] [bit] NULL,
	[EnableDefaultDoc] [bit] NULL,
	[EnableDirBrowsing] [bit] NULL,
	[EnableReverseDns] [bit] NULL,
	[LogExtFileBytesRecv] [bit] NULL,
	[LogExtFileBytesSent] [bit] NULL,
	[LogExtFileClientIp] [bit] NULL,
	[LogExtFileComputerName] [bit] NULL,
	[LogExtFileCookie] [bit] NULL,
	[LogExtFileDate] [bit] NULL,
	[LogExtFileHost] [bit] NULL,
	[LogExtFileMethod] [bit] NULL,
	[LogExtFileProtocolVersion] [bit] NULL,
	[LogExtFileReferer] [bit] NULL,
	[LogExtFileServerIp] [bit] NULL,
	[LogExtFileServerPort] [bit] NULL,
	[LogExtFileTime] [bit] NULL,
	[LogExtFileTimeTaken] [bit] NULL,
	[LogExtFileUriQuery] [bit] NULL,
	[LogExtFileUriStem] [bit] NULL,
	[LogExtFileUserAgent] [bit] NULL,
	[LogExtFileUserName] [bit] NULL,
	[LogExtFileWin32Status] [bit] NULL,
	[LogFileDirectory] [nvarchar](256) NULL,
	[LogFileLocaltimeRollover] [int] NULL,
	[LogFilePeriod] [int] NULL,
	[LogOdbcDataSource] [nvarchar](256) NULL,
	[LogOdbcPassword] [nvarchar](256) NULL,
	[LogOdbcTableName] [nvarchar](256) NULL,
	[LogOdbcUserName] [nvarchar](256) NULL,
	[MaxBandwidth] [int] NULL,
	[MaxConnections] [int] NULL,
	[MaxEndpointConnections] [int] NULL,
	[MaxRequestEntityAllowed] [int] NULL,
	[Name] [nvarchar](256) NULL,
	[NTAuthenticationProviders] [nvarchar](256) NULL,
	[Realm] [nvarchar](256) NULL,
	[ServerState] [int] NULL,
	[SSLStoreName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISWebsiteScriptMaps]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISWebsiteScriptMaps](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IISWebsiteI3D] [int] NULL,
	[Extensions] [nvarchar](256) NULL,
	[IncludedVerbs] [nvarchar](256) NULL,
	[ScriptProcessor] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementIISWebsiteServerBindings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementIISWebsiteServerBindings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IISWebsiteI3D] [int] NULL,
	[IP] [nvarchar](256) NULL,
	[Port] [nvarchar](256) NULL,
	[HostName] [nvarchar](256) NULL,
	[IsSecureServer] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementImageEditImages]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementImageEditImages](
	[I3D] [bigint] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Image] [image] NULL,
	[Thumbnail] [image] NULL,
	[Name] [nvarchar](255) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementImageEditShapes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementImageEditShapes](
	[I3D] [bigint] IDENTITY(1,1) NOT NULL,
	[VersionI3D] [bigint] NOT NULL,
	[X] [int] NOT NULL,
	[Y] [int] NOT NULL,
	[Width] [int] NOT NULL,
	[Height] [int] NOT NULL,
	[Color] [int] NOT NULL,
	[ColorFill] [int] NOT NULL,
	[StrokeThickness] [int] NOT NULL,
	[Fill] [bit] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Rotate] [float] NOT NULL,
	[Value] [ntext] NULL,
	[Type] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementImageEditVersions]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementImageEditVersions](
	[I3D] [bigint] IDENTITY(1,1) NOT NULL,
	[ImageI3D] [bigint] NOT NULL,
	[ImageCopy] [image] NULL,
	[Thumbnail] [image] NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Comment] [ntext] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementInventoryDocumentationStructures]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementInventoryDocumentationStructures](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[InventoryModuleKind] [int] NOT NULL,
	[Introduction] [nvarchar](max) NULL,
	[FinalCredits] [nvarchar](max) NULL,
 CONSTRAINT [PK_AssetManagementInventoryDocumentationStructures] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementLicenseContainer]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLicenseContainer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](256) NOT NULL,
	[Description] [nvarchar](1024) NULL,
	[Category] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementLicenseLicenseSource]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLicenseLicenseSource](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](500) NOT NULL,
	[Description] [nvarchar](500) NULL,
	[ProductI3D] [int] NOT NULL,
	[LicenseCount] [int] NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementLicenseProduct]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLicenseProduct](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](256) NOT NULL,
	[Description] [nvarchar](1024) NULL,
	[OwnLicenseCount] [int] NOT NULL,
	[UsedLicenseCount] [int] NOT NULL,
	[ContainerI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementLicenseSoftware]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLicenseSoftware](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](256) NOT NULL,
	[Manufacturer] [nvarchar](256) NOT NULL,
	[Version] [nvarchar](256) NOT NULL,
	[ProductI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementLocalGroup]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLocalGroup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Description] [ntext] NULL,
	[Domain] [nvarchar](255) NULL,
	[Name] [nvarchar](255) NOT NULL,
	[SID] [nvarchar](255) NOT NULL,
	[SIDType] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementLocalGroup] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementLocalGroupAssigned]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLocalGroupAssigned](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LocalGroupI3D] [int] NOT NULL,
	[Type] [int] NOT NULL,
	[Domain] [nvarchar](255) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[SID] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_AssetManagementLocalGroupAssigned] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementLogicalDeviceHistory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLogicalDeviceHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[VolumeName] [nvarchar](256) NULL,
	[MaxCapacity] [nvarchar](24) NULL,
	[FreeCapacity] [nvarchar](24) NULL,
	[HistoryDate] [datetime] NULL,
	[LogicalDeviceI3D] [int] NOT NULL,
	[PersistentVolumeID] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[Status] [nvarchar](256) NULL,
	[SerialNumber] [int] NULL,
	[Name] [nvarchar](256) NULL,
	[FileSystem] [nvarchar](256) NULL,
	[DeviceID] [nvarchar](256) NULL,
	[Automount] [bit] NULL,
	[IsEncrypted] [bit] NULL,
 CONSTRAINT [PK_AssetManagementLogicalDeviceHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementLoginFailedChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementLoginFailedChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BackDays] [int] NOT NULL,
	[Error] [float] NOT NULL,
	[Warning] [float] NOT NULL,
 CONSTRAINT [PK_AssetManagementLoginFailedChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementMappedDrive]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementMappedDrive](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[RemotePath] [nvarchar](256) NULL,
	[DeviceName] [nvarchar](256) NULL,
	[DriveName] [nvarchar](256) NULL,
	[VolumeSerialNumber] [nvarchar](256) NULL,
	[SystemName] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[Status] [nvarchar](256) NULL,
	[InstallDate] [datetime] NULL,
	[FreeSpace] [bigint] NULL,
	[FileSystem] [nvarchar](256) NULL,
	[DeviceID] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[Space] [nvarchar](256) NULL,
	[Path] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementMediaAccessDevice]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementMediaAccessDevice](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[UniqueID] [nvarchar](256) NULL,
	[MediaType] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementMemoryArray]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementMemoryArray](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MotherboardI3D] [int] NOT NULL,
	[Caption] [nchar](64) NULL,
	[CreationClassName] [nchar](256) NULL,
	[Depth] [float] NULL,
	[Description] [nchar](512) NULL,
	[Height] [float] NULL,
	[HotSwappable] [bit] NULL,
	[InstallDate] [datetime] NULL,
	[Location] [int] NULL,
	[Manufacturer] [nchar](256) NULL,
	[MaxCapacity] [bigint] NULL,
	[MemoryDevices] [int] NULL,
	[MemoryErrorCorrection] [int] NULL,
	[Model] [nchar](64) NULL,
	[Name] [nchar](256) NULL,
	[OtherIdentifyingInfo] [nchar](512) NULL,
	[PartNumber] [nchar](256) NULL,
	[PoweredOn] [bit] NULL,
	[Removable] [bit] NULL,
	[Replaceable] [bit] NULL,
	[SerialNumber] [nchar](64) NULL,
	[SKU] [nchar](64) NULL,
	[Status] [int] NULL,
	[Tag] [nchar](256) NULL,
	[Use] [int] NULL,
	[Version] [nchar](64) NULL,
	[Weight] [float] NULL,
	[Width] [float] NULL,
 CONSTRAINT [PK_AssetManagementMemoryArray] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementMobilePhones]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementMobilePhones](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Serialnumber] [nvarchar](256) NULL,
	[IMEI] [nvarchar](256) NULL,
	[Vendor] [nvarchar](256) NULL,
	[OperatingSystem] [nvarchar](256) NULL,
	[MACAddress] [nvarchar](256) NULL,
	[Model] [nvarchar](256) NULL,
	[Mobilenumber] [nvarchar](256) NULL,
	[CreatedOn] [datetime] NULL,
	[ModifiedOn] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementMonitors]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementMonitors](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[ManufacturerName] [nvarchar](256) NULL,
	[ProductCodeID] [nvarchar](256) NOT NULL,
	[SerialNumberID] [nvarchar](256) NOT NULL,
	[Name] [nvarchar](256) NULL,
	[WeekOfManufacture] [int] NULL,
	[YearOfManufacture] [nvarchar](20) NULL,
	[InstanceName] [nvarchar](256) NULL,
	[ScreenWidthInCms] [int] NULL,
	[ScreenHeightInCms] [int] NULL,
	[Resolution] [nvarchar](20) NULL,
 CONSTRAINT [PK_AssetManagementMonitors] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementMotherboard]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementMotherboard](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Manufacturer] [nvarchar](256) NULL,
	[Product] [nvarchar](256) NULL,
	[Version] [nvarchar](256) NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[BiosVersion] [nvarchar](256) NULL,
	[Width] [int] NULL,
	[Status] [nvarchar](256) NULL,
	[Depth] [int] NULL,
	[Description] [nvarchar](256) NULL,
	[Height] [int] NULL,
	[HotSwappable] [bit] NULL,
	[Model] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[OtherIdentifyingInfo] [nvarchar](256) NULL,
	[PartNumber] [nvarchar](256) NULL,
	[SKU] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementMSBackupChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementMSBackupChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BackupStart] [datetime] NULL,
	[BackupEnd] [datetime] NULL,
	[BackupStatus] [nvarchar](500) NULL,
	[IsCheckEnabled] [bit] NOT NULL,
 CONSTRAINT [PK_CSI_AssetManagementMSBackupChecks ] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementNetworkAdapter]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementNetworkAdapter](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Description] [nvarchar](256) NULL,
	[MACAddress] [nvarchar](256) NULL,
	[Gateway] [nvarchar](256) NULL,
	[IPAddress] [nvarchar](256) NULL,
	[DNSServer] [nvarchar](256) NULL,
	[DHCPServer] [nvarchar](256) NULL,
	[SecondaryDNSServer] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[Status] [nvarchar](256) NULL,
	[Speed] [bigint] NULL,
	[MaxSpeed] [bigint] NULL,
	[DeviceID] [nvarchar](256) NULL,
	[Manufacturer] [nvarchar](256) NULL,
	[IpSubnetMask] [nvarchar](256) NULL,
	[Ipv6Address] [nvarchar](256) NULL,
	[Ipv6SubnetMask] [nvarchar](256) NULL,
	[AdapterTypeId] [int] NOT NULL,
	[NetConnectionStatus] [int] NOT NULL,
	[IsPhysicalAdapter] [bit] NOT NULL,
	[IsNetEnabled] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementNetworkScanHost]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementNetworkScanHost](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HostIP] [nvarchar](500) NOT NULL,
	[OS] [nvarchar](500) NULL,
	[LastScanned] [datetime] NULL,
	[DeviceId] [int] NULL,
	[DeviceType] [int] NULL,
	[CustomerI3D] [int] NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementNetworkScanPort]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementNetworkScanPort](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HostI3D] [int] NOT NULL,
	[Port] [int] NOT NULL,
	[Status] [int] NULL,
	[Service] [nvarchar](1000) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementOperationSystems]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementOperationSystems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NULL,
	[OSType] [int] NULL,
	[OSArchitecture] [int] NULL,
	[LicenseKey] [nvarchar](256) NULL,
	[LicenseType] [int] NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[Publisher] [nvarchar](256) NULL,
	[Version] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementOrgUnits]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementOrgUnits](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NOT NULL,
	[Description] [varchar](4000) NULL,
	[CustomerI3D] [int] NULL,
 CONSTRAINT [PK_AssetManagementOrgUnits] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementOrgUnitToItems]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementOrgUnitToItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[OrgUnitI3D] [int] NULL,
 CONSTRAINT [PK_AssetManagementOrgUnitToItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementOSFeatures]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementOSFeatures](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[FeatureID] [int] NOT NULL,
	[FeatureParentID] [int] NULL,
	[Name] [nvarchar](500) NOT NULL,
 CONSTRAINT [PK_AssetManagementOSFeatures] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPartnerItems]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPartnerItems](
	[PartnerI3D] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPartners]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPartners](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Company] [nvarchar](255) NULL,
	[Title] [nvarchar](255) NULL,
	[ContactFirstName] [nvarchar](255) NULL,
	[ContactLastName] [nvarchar](255) NULL,
	[Street] [nvarchar](255) NULL,
	[Zip] [nvarchar](255) NULL,
	[City] [nvarchar](255) NULL,
	[Phone] [nvarchar](255) NULL,
	[Fax] [nvarchar](255) NULL,
	[Email] [nvarchar](255) NULL,
	[Web] [nvarchar](255) NULL,
	[Contract] [nvarchar](255) NULL,
	[Description] [text] NULL,
	[IsTemplate] [bit] NULL,
	[TemplateI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPatchesChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPatchesChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Error] [float] NULL,
	[Warning] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPerformanceChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPerformanceChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServiceTypeID] [int] NOT NULL,
	[ServiceName] [nvarchar](50) NOT NULL,
	[Error] [float] NOT NULL,
	[Warning] [float] NOT NULL,
	[BackExecutionTimes] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementPerformanceChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPhysicalDrive]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPhysicalDrive](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Capacity] [nvarchar](24) NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[ModelNumber] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[DeviceID] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[Status] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[SystemName] [nvarchar](256) NULL,
	[IsPrimaryDrive] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPingChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPingChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IPOrComputerName] [nvarchar](70) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPort]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPort](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[ServiceName] [nvarchar](256) NULL,
	[port] [int] NULL,
	[DNSHostName] [nvarchar](256) NULL,
	[DNSDomainSuffixSearchOrderSecondary] [nvarchar](256) NULL,
	[DNSDomainSuffixSearchOrderPrimary] [nvarchar](256) NULL,
	[DNSDomain] [nvarchar](256) NULL,
	[DHCPLeaseExpires] [datetime] NULL,
	[DHCPEnabled] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPowerShellChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPowerShellChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PowerShellScript] [nvarchar](max) NOT NULL,
	[ExecuationInterval] [int] NOT NULL,
 CONSTRAINT [PK_AssetManagementPowerShellChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementPrinter]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementPrinter](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Name] [nvarchar](256) NULL,
	[SystemDefault] [bit] NULL,
	[Path] [nvarchar](256) NULL,
	[Port] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[Status] [nvarchar](256) NULL,
	[SpoolEnabled] [bit] NULL,
	[ShareName] [nvarchar](256) NULL,
	[Queued] [bit] NULL,
	[PrintProcessor] [nvarchar](256) NULL,
	[PrinterStatus] [int] NULL,
	[PrinterState] [int] NULL,
	[JobCountSinceLastReset] [int] NULL,
	[InstallDate] [datetime] NULL,
	[DriverName] [nvarchar](256) NULL,
	[DeviceID] [nvarchar](256) NULL,
	[CurrentPaperType] [nvarchar](256) NULL,
	[Attributes] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementProcesses]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementProcesses](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[Name] [nvarchar](256) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementProcessesToAssets]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementProcessesToAssets](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProcessI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementProcessor]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementProcessor](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Name] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[MaxClockSpeed] [int] NULL,
	[NumberOfCores] [int] NULL,
	[Architecture] [nvarchar](256) NULL,
	[CPUID] [nvarchar](256) NULL,
	[Vendor] [nvarchar](256) NULL,
	[SystemName] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[Status] [nvarchar](256) NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[ProcessorType] [int] NULL,
	[ProcessorId] [nvarchar](256) NULL,
	[DeviceID] [nvarchar](256) NULL,
	[CpuStatus] [int] NULL,
	[Characteristics] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementRAIDController]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementRAIDController](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[ControllerName] [nvarchar](256) NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[EnabledState] [nvarchar](256) NULL,
	[DataRedundancy] [nvarchar](256) NULL,
	[NumberOfBlocks] [int] NULL,
	[ControllerID] [nvarchar](256) NULL,
	[SystemName] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[HardwareVersion] [nvarchar](256) NULL,
	[DriverName] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSecurityIssues]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSecurityIssues](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[ApplicationI3D] [int] NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[ExternalEntryID] [nvarchar](64) NOT NULL,
	[ExternalEntryIDKind] [int] NOT NULL,
	[CveID] [varchar](40) NULL,
	[AccessVector] [nvarchar](256) NULL,
	[AccessComplexity] [nvarchar](256) NULL,
	[Authentication] [nvarchar](256) NULL,
	[ConfidentialityImpact] [nvarchar](256) NULL,
	[IntegrityImpact] [nvarchar](256) NULL,
	[AvailabilityImpact] [nvarchar](256) NULL,
	[Source] [nvarchar](256) NULL,
	[GenerationDate] [datetime] NULL,
	[Score] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementService]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementService](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Caption] [nvarchar](256) NULL,
	[ExecutableName] [nvarchar](256) NULL,
	[ServiceName] [nvarchar](256) NULL,
	[StartupType] [nvarchar](256) NULL,
	[UserAccount] [nvarchar](256) NULL,
	[Status] [nvarchar](256) NULL,
	[State] [nvarchar](256) NULL,
	[StartMode] [nvarchar](256) NULL,
	[Started] [bit] NULL,
	[ProcessId] [int] NULL,
	[DisplayName] [nvarchar](256) NULL,
	[Description] [nvarchar](2000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementServiceConnectorStatus]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementServiceConnectorStatus](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[IsInstalled] [bit] NOT NULL,
	[ServiceStatus] [nvarchar](7) NULL,
	[InstallationDate] [datetime] NOT NULL,
 CONSTRAINT [PK_CSI_AssetManagementServiceConnectorStatus] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSnmpArpAppCaches]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSnmpArpAppCaches](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SnmpDetailI3D] [int] NOT NULL,
	[IpAddress] [nvarchar](50) NOT NULL,
	[MacAddress] [nvarchar](50) NULL,
	[AppCacheType] [nvarchar](20) NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementSnmpArpAppCaches] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSnmpArpInterfaceIpMaps]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSnmpArpInterfaceIpMaps](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SnmpArpNetworkMapDeviceI3D] [int] NOT NULL,
	[InterfaceIpMapName] [nvarchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementSnmpArpInterfaceIpMaps] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSnmpArpNetworkMapDevices]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSnmpArpNetworkMapDevices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ParentI3D] [int] NULL,
	[SnmpDetailI3D] [int] NOT NULL,
	[NetworkMapName] [nvarchar](256) NULL,
	[NetworkMapDescription] [nvarchar](1000) NULL,
	[IsSwitch] [bit] NOT NULL,
	[IsWorkstation] [bit] NOT NULL,
	[IsPrinter] [bit] NOT NULL,
	[IpAddress] [nvarchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementSnmpArpNetworkMapDevices] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSnmpArpRoutings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSnmpArpRoutings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SnmpDetailI3D] [int] NOT NULL,
	[RoutingDestination] [nvarchar](50) NOT NULL,
	[RoutingSubnet] [nvarchar](50) NOT NULL,
	[Gateway] [nvarchar](50) NOT NULL,
	[RoutingMetric] [nvarchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementSnmpArpRoutings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSnmpArpSegmentMaps]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSnmpArpSegmentMaps](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SnmpArpNetworkMapDeviceI3D] [int] NOT NULL,
	[SegmentMapName] [nvarchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementSnmpArpSegmentMaps] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSNMPBackupChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSNMPBackupChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PortNumber] [int] NOT NULL,
	[JobName] [nvarchar](256) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CommunityString] [nvarchar](30) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSNMPChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSNMPChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServiceDescription] [nvarchar](256) NULL,
	[SystemName] [nvarchar](100) NULL,
	[CommunityString] [nvarchar](30) NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_AssetManagementSNMPChecks_1] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSNMPDetails]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSNMPDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[IPAddress] [nvarchar](256) NULL,
	[DeviceName] [nvarchar](256) NULL,
	[DeviceType] [nvarchar](256) NULL,
	[IsHTTPSupported] [bit] NOT NULL,
	[DeviceOID] [nvarchar](256) NULL,
	[IsSNMPEnabled] [bit] NOT NULL,
	[Vendor] [nvarchar](256) NULL,
	[MIBFileName] [nvarchar](256) NULL,
	[Description] [nvarchar](4000) NULL,
	[Location] [nvarchar](255) NULL,
	[IsSSHEnabled] [bit] NOT NULL,
	[IsTelnetEnabled] [bit] NOT NULL,
	[IsHttpsSupported] [bit] NOT NULL,
	[MacAddress] [nvarchar](256) NULL,
	[CustomDeviceType] [nvarchar](256) NULL,
	[LastUpdate] [datetime] NULL,
	[CustomDeviceName] [nvarchar](512) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSNMPOIDChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSNMPOIDChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SNMPCheckI3D] [int] NOT NULL,
	[OID] [nvarchar](256) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[SnmpType] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSNMPOidClasses]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSNMPOidClasses](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SNMPDetailI3D] [int] NULL,
	[Name] [nvarchar](256) NULL,
	[OID] [nvarchar](256) NULL,
	[Value] [nvarchar](256) NULL,
	[Description] [nvarchar](512) NULL,
 CONSTRAINT [IX_AssetManagementSNMPOidClasses_UniqueI3D] UNIQUE NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementSNMPOidClasses_SnmpDetailClustered]    Script Date: 11.11.2025 11:20:27 ******/
CREATE CLUSTERED INDEX [IX_AssetManagementSNMPOidClasses_SnmpDetailClustered] ON [dbo].[AssetManagementSNMPOidClasses]
(
	[SNMPDetailI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSNMPOidInformations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSNMPOidInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Oid] [nvarchar](255) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [nvarchar](4000) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSNMPWMIInformations]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSNMPWMIInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SNMPDetailI3D] [int] NULL,
	[KeyName] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[Value] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSocustomer]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSocustomer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[CustomerID] [nvarchar](256) NULL,
	[CustomerName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSQLDatabases]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSQLDatabases](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SQLInstanceI3D] [int] NOT NULL,
	[DatabaseName] [nvarchar](256) NULL,
	[Size] [float] NULL,
	[CreatedOn] [datetime] NULL,
	[LastBackupDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSQLInformation]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSQLInformation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[InstanceName] [nvarchar](256) NULL,
	[SecuritySetting] [nvarchar](256) NULL,
	[Version] [nvarchar](100) NULL,
	[IsClustred] [bit] NOT NULL,
	[ServerInformation] [nvarchar](256) NULL,
	[CreatedOn] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSQLInstances]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSQLInstances](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SQLServerI3D] [int] NOT NULL,
	[InstanceName] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSQLServerChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSQLServerChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SQLDatabaseI3D] [int] NOT NULL,
	[SqlServerName] [nvarchar](256) NOT NULL,
	[SqlInstanceName] [nvarchar](256) NOT NULL,
	[SqlDatabaseName] [nvarchar](256) NOT NULL,
	[IntegratedSecurity] [bit] NOT NULL,
	[SqlUserName] [nvarchar](256) NULL,
	[SqlPassword] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSQLServers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSQLServers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[DeviceName] [nvarchar](256) NULL,
	[DeviceIPAddress] [nvarchar](256) NULL,
	[ServerInformation] [nvarchar](256) NULL,
	[Version] [nvarchar](256) NULL,
	[IsClustred] [bit] NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementSslCertificateChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementSslCertificateChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CertificateName] [nvarchar](256) NOT NULL,
	[Error] [float] NOT NULL,
	[Warning] [float] NOT NULL,
	[Criteria] [nvarchar](10) NOT NULL,
 CONSTRAINT [PK_AssetManagementSslCertificateChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementStartupPrograms]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementStartupPrograms](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[ProgramName] [nvarchar](256) NOT NULL,
	[Location] [nvarchar](256) NULL,
	[UserName] [nvarchar](256) NULL,
	[Command] [nvarchar](256) NOT NULL,
	[PublisherName] [nvarchar](256) NOT NULL,
	[ProcessID] [int] NULL,
	[IsEnabled] [bit] NOT NULL,
	[DiskUsage] [float] NULL,
	[CpuUsage] [float] NULL,
	[StartupImpact] [int] NULL,
	[StartupType] [int] NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDate] [datetime] NULL,
 CONSTRAINT [PK_AssetManagementStartupPrograms] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementUSBDevice]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementUSBDevice](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Caption] [nvarchar](256) NULL,
	[Status] [nvarchar](256) NULL,
	[Manufacturer] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[SystemName] [nvarchar](256) NULL,
	[TimeOfLastReset] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVendors]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVendors](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceI3D] [int] NULL,
	[ApplicationI3D] [int] NULL,
	[Company] [nvarchar](255) NULL,
	[Street] [nvarchar](255) NULL,
	[City] [nvarchar](255) NULL,
	[ZipCode] [nvarchar](255) NULL,
	[Country] [nvarchar](255) NULL,
	[Firstname] [nvarchar](255) NULL,
	[Lastname] [nvarchar](255) NULL,
	[Phone] [nvarchar](255) NULL,
	[Fax] [nvarchar](255) NULL,
	[Email] [nvarchar](255) NULL,
	[Description] [nvarchar](1000) NULL,
	[WebURL] [nvarchar](255) NULL,
	[Status] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVendorWarrantyChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVendorWarrantyChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VendorName] [nvarchar](500) NOT NULL,
	[WarrantyStartDate] [datetime] NULL,
	[WarrantyEndDate] [datetime] NULL,
	[WarrantyDaysRemaining] [int] NULL,
	[DeviceI3D] [int] NOT NULL,
 CONSTRAINT [PK_CSI_AssetManagementVendorWarrantyChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVideoController]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVideoController](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[Name] [nvarchar](256) NULL,
	[Description] [nvarchar](256) NULL,
	[AdapterRam] [nvarchar](256) NULL,
	[VideoControllerId] [nvarchar](256) NULL,
	[SystemName] [nvarchar](256) NULL,
	[StatusInfo] [int] NULL,
	[Status] [nvarchar](256) NULL,
	[DeviceID] [nvarchar](256) NULL,
	[DriverDate] [datetime] NULL,
	[DriverVersion] [nvarchar](256) NULL,
	[InstallDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVisioConnections]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVisioConnections](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ParentNode] [int] NOT NULL,
	[ChildNode] [int] NOT NULL,
	[WorkflowI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVisioDataShapes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVisioDataShapes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ShapeI3D] [int] NOT NULL,
	[ShapeData] [ntext] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVisioShapes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVisioShapes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WorkflowI3D] [int] NOT NULL,
	[VisioShapecategoryI3D] [int] NOT NULL,
	[DeviceI3D] [int] NULL,
	[XPosition] [float] NOT NULL,
	[YPosition] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVisioShapesCategories]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVisioShapesCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CategoryName] [nvarchar](256) NULL,
	[CategoryIcon] [image] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVisioWorkflows]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVisioWorkflows](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Caption] [nvarchar](256) NULL,
	[CreatedDateTime] [datetime] NULL,
	[ModifiedDateTime] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVMHardwareDevices]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVMHardwareDevices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VirtualMachineHardwareI3D] [int] NOT NULL,
	[Label] [nvarchar](256) NULL,
	[AllowGuestControl] [bit] NULL,
	[Connected] [bit] NULL,
	[StartConnected] [bit] NULL,
	[DataStoreID] [nvarchar](256) NULL,
	[UseAutoDetect] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVMHardwares]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVMHardwares](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VirtualMachineI3D] [int] NOT NULL,
	[CPUCount] [int] NULL,
	[Memory] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVMHosts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVMHosts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[HostName] [nvarchar](256) NULL,
	[IPAddress] [nvarchar](256) NULL,
	[Identifier] [nvarchar](256) NULL,
	[OverallStatus] [nvarchar](256) NULL,
	[CPUModel] [nvarchar](256) NULL,
	[Model] [nvarchar](256) NULL,
	[NumCPUCores] [int] NULL,
	[CPUMhz] [int] NULL,
	[NumCPUPkgs] [int] NULL,
	[MemorySize] [bigint] NULL,
	[UUID] [nvarchar](256) NULL,
	[Vendor] [nvarchar](256) NULL,
	[PowerState] [nvarchar](256) NULL,
	[ConnectionState] [nvarchar](256) NULL,
	[ManagementServerIP] [nvarchar](256) NULL,
	[CPUUsage] [int] NULL,
	[MOBPath] [nvarchar](256) NULL,
	[ProductName] [nvarchar](256) NULL,
	[MemUsage] [bigint] NULL,
	[AdminDisabled] [bit] NULL,
	[BiosVersion] [nvarchar](256) NULL,
	[BiosReleaseDate] [datetime] NULL,
	[LocalDatastoreSupported] [bit] NULL,
	[NfsMountCreationRequired] [bit] NULL,
	[NfsMountCreationSupported] [bit] NULL,
	[VmfsExtentExpansionSupported] [bit] NULL,
	[SSLThumbPrint] [nvarchar](256) NULL,
	[VMotionEnabled] [bit] NULL,
	[ManagementPort] [int] NULL,
	[UpTime] [int] NULL,
	[DistributedCpuFairness] [int] NULL,
	[DistributedMemoryFairness] [int] NULL,
	[BootDate] [datetime] NULL,
	[MaintenanceMode] [bit] NULL,
	[TimeZone] [int] NULL,
	[RebootRequired] [bit] NULL,
	[CurrentEVCModeKey] [nvarchar](256) NULL,
	[MaxEVCModeKey] [nvarchar](256) NULL,
	[CsumOffload] [bit] NULL,
	[TcpSegmentation] [bit] NULL,
	[ZeroCopyXmit] [bit] NULL,
	[NumHBAs] [int] NULL,
	[NumNics] [int] NULL,
	[NumCpuThreads] [int] NULL,
	[WakeOnLanCapable] [bit] NULL,
	[LicenseKey] [nvarchar](256) NULL,
	[SerialNumber] [nvarchar](256) NULL,
	[TotalStorage] [float] NULL,
	[UsedStorage] [float] NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVMMachines]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVMMachines](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VirtualMachineHostI3D] [int] NOT NULL,
	[VMName] [nvarchar](256) NULL,
	[OverallStatus] [int] NULL,
	[HostIdentifier] [nvarchar](256) NULL,
	[Identifier] [nvarchar](256) NULL,
	[GuestFullName] [nvarchar](256) NULL,
	[MOBPath] [nvarchar](256) NULL,
	[ConnectionState] [int] NULL,
	[PowerState] [int] NULL,
	[ToolsStatus] [int] NULL,
	[ResourcePoolIdentifier] [nvarchar](256) NULL,
	[ConfigAlternateGuestName] [nvarchar](256) NULL,
	[ConfigGuestFullName] [nvarchar](256) NULL,
	[ConfigChangeVersion] [datetime] NULL,
	[ConfigGuestID] [nvarchar](256) NULL,
	[ConfigVersion] [nvarchar](256) NULL,
	[Template] [bit] NULL,
	[UsedStorage] [bigint] NULL,
	[AvailableStorage] [bigint] NULL,
	[LastUpdate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVMSnapshots]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVMSnapshots](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VirtualMachineI3D] [int] NOT NULL,
	[SnapShotName] [nvarchar](256) NULL,
	[SnapShotCreation] [datetime] NULL,
	[MOBPath] [nvarchar](256) NULL,
	[ParentSnapShot] [int] NULL,
	[SnapShotDescription] [nvarchar](256) NULL,
	[SnapShotState] [int] NULL,
	[SnapshotStringID] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementVmWareChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementVmWareChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VmMachineI3D] [int] NULL,
	[CategoryTypeI3D] [int] NOT NULL,
	[LunsDisplayName] [nvarchar](256) NULL,
	[Error] [float] NULL,
	[Warning] [float] NULL,
	[Criteria] [nvarchar](10) NULL,
	[AlarmCheckEnabled] [bit] NOT NULL,
	[VmHostI3D] [int] NULL,
	[VCenterIpOrHost] [nvarchar](20) NULL,
	[Username] [nvarchar](100) NOT NULL,
	[Password] [nvarchar](400) NOT NULL,
 CONSTRAINT [PK_AssetManagementVmWareChecks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementWindowsServiceChecks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementWindowsServiceChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NameOfServices] [nvarchar](max) NOT NULL,
	[ThresholdValue] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementWindowsUpdateCategories]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementWindowsUpdateCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CategoryGUID] [nvarchar](128) NOT NULL,
	[Name] [nvarchar](512) NOT NULL,
	[Description] [varchar](max) NULL,
	[MsrcSeverity] [int] NOT NULL,
	[DelayUpdateCategoriesPerDay] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementWindowsUpdateCategoriesToUpdates]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementWindowsUpdateCategoriesToUpdates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WindowsUpdateI3D] [int] NOT NULL,
	[WindowsUpdateCategoryI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementWindowsUpdateKBArticleI3Ds]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementWindowsUpdateKBArticleI3Ds](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WindowsUpdateI3D] [int] NOT NULL,
	[KBArticleGUID] [nvarchar](128) NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagementWindowsUpdates]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagementWindowsUpdates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](512) NOT NULL,
	[Type] [int] NOT NULL,
	[RevisionNumber] [int] NULL,
	[UpdateGUID] [nvarchar](128) NOT NULL,
	[Description] [nvarchar](max) NULL,
	[IsOptional] [bit] NOT NULL,
	[IsBeta] [bit] NOT NULL,
	[IsHidden] [bit] NOT NULL,
	[IsInstalled] [bit] NOT NULL,
	[IsMandatory] [bit] NOT NULL,
	[MsrcSeverity] [nvarchar](128) NULL,
	[IsEulaAccepted] [bit] NOT NULL,
	[EulaText] [nvarchar](max) NULL,
	[ReleaseNotes] [nvarchar](max) NULL,
	[MaxDownloadSize] [int] NULL,
	[MinDownloadSize] [int] NULL,
	[RecommendedCpuSpeed] [int] NULL,
	[RecommendedHardDiskSpace] [int] NULL,
	[RecommendedMemory] [int] NULL,
	[DeploymentChanged] [datetime] NULL,
	[Deadline] [datetime] NULL,
	[InstallOptionsRequiresNetworkConnectivity] [bit] NULL,
	[InstallOptionsCanRequestUserInput] [bit] NULL,
	[InstallOptionsImpact] [int] NULL,
	[InstallOptionsRebootBehavior] [int] NULL,
	[IsUninstallable] [bit] NOT NULL,
	[UninstallOptionsRequiresNetworkConnectivity] [bit] NULL,
	[UninstallOptionsCanRequestUserInput] [bit] NULL,
	[UninstallOptionsImpact] [int] NULL,
	[UninstallOptionsRebootBehavior] [int] NULL,
	[UninstallationNotes] [nvarchar](max) NULL,
	[ParentUpdateI3D] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AssetManagmentDeviceWindowsUpdatePolicy]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AssetManagmentDeviceWindowsUpdatePolicy](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NULL,
	[IsActive] [bit] NOT NULL,
	[AutoUpdateApproval] [nvarchar](max) NULL,
	[UpdateInstallationKind] [int] NOT NULL,
	[TimedSettings] [nvarchar](max) NULL,
	[Reboot] [int] NOT NULL,
	[ChangeDate] [datetime] NULL,
	[Editor] [int] NULL,
	[CustomerI3D] [int] NOT NULL,
	[CustomerSiteI3D] [int] NULL,
	[DeviceCategory] [int] NULL,
	[ShutDownAfterInstallation] [bit] NOT NULL,
	[WakeOnLan] [bit] NOT NULL,
	[LogoutUsers] [bit] NULL,
	[MaxRestartRequests] [int] NULL,
	[RestartDelayOptions] [int] NULL,
	[IntelligentUpdateActive] [bit] NULL,
	[IntelligentUpdateTimerSeconds] [int] NULL,
	[RestartAfterInstallation] [bit] NOT NULL,
	[CriticalMinAgeDays] [int] NULL,
	[ImportantMinAgeDays] [int] NULL,
	[ModerateMinAgeDays] [int] NULL,
	[LowMinAgeDays] [int] NULL,
	[OtherMinAgeDays] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AufBarcodes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufBarcodes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AufPosI3D] [int] NULL,
	[LiefPosI3D] [int] NULL,
	[RechPosI3D] [int] NULL,
	[GutPosI3D] [int] NULL,
	[AbholPosI3D] [int] NULL,
	[BarcodeI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_AufBarcodes] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AufKopfBackupf]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufKopfBackupf](
	[I3D] [int] NOT NULL,
	[Nummer] [int] NOT NULL,
	[ErstellungsArt] [varchar](50) NULL,
	[Version] [int] NOT NULL,
	[Datum] [datetime] NOT NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NOT NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](50) NULL,
	[Ansprech] [varchar](60) NULL,
	[KurzZeich] [varchar](5) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlkondID] [int] NULL,
	[LieferbedID] [int] NULL,
	[Status] [int] NULL,
	[Lockuser] [varchar](30) NULL,
	[AusAng] [int] NULL,
	[BestNr] [varchar](50) NULL,
	[Zusatztext] [varchar](50) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[Service] [int] NULL,
	[Kommisioniert] [int] NULL,
	[Produziert] [int] NULL,
	[WorkFlowI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[ProjNr] [varchar](50) NULL,
	[AufScanDocI3D] [int] NULL,
	[BestScanDocI3D] [int] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[KommisioniertAm] [datetime] NULL,
	[ProduziertAm] [datetime] NULL,
	[ToDoI3D] [int] NULL,
	[ToDoKomI3D] [int] NULL,
	[ToDoMonI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[RechKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[ZahlKondRechI3D] [int] NULL,
	[Direktlieferung] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[hlpdsk_requestsI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](255) NULL,
	[RechnungskonditionsText] [varchar](255) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
 CONSTRAINT [PK_AufKopfBackupf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AufKopfErweitert]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufKopfErweitert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AufkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
	[ServiceArt] [int] NULL,
	[ServicePrioritaet] [int] NULL,
	[ServiceOrt] [int] NULL,
	[ServiceSatz] [float] NULL,
	[LeasingSatz] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AufKopfErweitertVersions]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufKopfErweitertVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AufkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[OriginalI3D] [int] NULL,
	[Version] [int] NULL,
	[Status] [int] NULL,
	[ServiceArt] [int] NULL,
	[ServicePrioritaet] [int] NULL,
	[ServiceOrt] [int] NULL,
	[ServiceSatz] [float] NULL,
	[LeasingSatz] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[AufProv]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AufProv](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AufKopfI3D] [int] NULL,
	[AufNummer] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Provision] [float] NULL,
	[Status] [int] NULL,
	[Standard] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Auswertung]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Auswertung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NULL,
	[ObjektI3D] [int] NULL,
	[BearbeiterI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[InnenDienstID] [int] NULL,
	[AussenDienstId] [int] NULL,
	[Umsatz] [float] NULL,
	[DBUmsatz] [float] NULL,
	[DLUmsatz] [float] NULL,
	[Anzahl] [int] NULL,
	[Datum] [datetime] NULL,
	[warengruppe] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BackgroundServices]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BackgroundServices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServiceName] [nvarchar](255) NOT NULL,
	[IsEnabled] [bit] NOT NULL,
	[LastRunTime] [datetime2](2) NULL,
	[StartTime] [datetime2](2) NULL,
 CONSTRAINT [PK_BackgroundServices] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BackupDeviceInformation]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BackupDeviceInformation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[BackupDeviceGuid] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_BackupDeviceInformation] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BarcodeHistory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BarcodeHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BarcodeI3D] [int] NOT NULL,
	[Datum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[Art] [int] NULL,
	[Text] [varchar](200) NULL,
	[ArtI3D] [int] NULL,
	[ArtNummer] [int] NULL,
	[Version] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_BarcodeHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BelegArten]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BelegArten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](120) NULL,
	[Sachkonto] [varchar](50) NULL,
	[Sachkontobezeichnung] [varchar](120) NULL,
	[WaehrungLandI3D] [int] NULL,
	[SollHaben] [int] NULL,
	[Steuerschluessel] [varchar](10) NULL,
	[MWStSatzI3D] [int] NULL,
	[IsRechnungsArt] [int] NULL,
	[Status] [int] NULL,
	[FlagBarrechnung] [int] NULL,
	[FilialI3D] [int] NULL,
	[SachkontoGleichKdNr] [int] NULL,
	[Zahlungsart] [int] NULL,
	[Gegenkonto] [varchar](50) NULL,
	[UstArt] [int] NULL,
	[GegenkontoGleichKassenkonto] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BestKopf]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BestKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[ErstellDatum] [datetime] NULL,
	[BestellDatum] [datetime] NULL,
	[LieferDatum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[Lieferanschrift] [varchar](500) NULL,
	[Lieferkunde] [int] NULL,
	[KreditorID] [int] NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Ansprech] [varchar](60) NULL,
	[KurzZeich] [varchar](5) NULL,
	[Ersteller] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NOT NULL,
	[Mail] [varchar](50) NULL,
	[Status] [int] NULL,
	[LockUser] [varchar](50) NULL,
	[Import] [int] NULL,
	[Fracht] [float] NULL,
	[MwstArt] [int] NULL,
	[ABErhalten] [int] NULL,
	[ScanDocI3D] [int] NULL,
	[ToDoAuftrI3D] [int] NULL,
	[ToDoBestI3D] [int] NULL,
	[AufKopfI3D] [int] NULL,
 CONSTRAINT [PK_BestKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BestPos]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BestPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Version] [int] NULL,
	[BestKopfI3D] [int] NULL,
	[RepEingangPosI3D] [int] NULL,
	[Pos] [int] NULL,
	[Kreditorcode] [varchar](20) NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[Text] [varchar](240) NULL,
	[KreditorI3D] [int] NULL,
	[Hersteller] [varchar](80) NULL,
	[HerstellerCode] [varchar](20) NULL,
	[Bestellmenge] [float] NULL,
	[LieferscheinMenge] [float] NULL,
	[Liefermenge] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Preis] [float] NULL,
	[Fracht] [float] NULL,
	[BarcodeStatus] [int] NULL,
	[NumBarcodes] [int] NULL,
	[Eingangsdatum] [datetime] NULL,
	[Import] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[AufwandKTO] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_BestPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Besuchsberichte]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Besuchsberichte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenID] [int] NULL,
	[Datum] [datetime] NULL,
	[Grund] [varchar](255) NULL,
	[Text] [text] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Besuchsberichte] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BMEcatAufschlaege]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BMEcatAufschlaege](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BMEcatI3D] [int] NULL,
	[ueberEK] [float] NULL,
	[Prozent] [float] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BMEcatEinstellungen]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BMEcatEinstellungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundeI3D] [int] NULL,
	[Quelle] [int] NULL,
	[DistributorI3D] [int] NULL,
	[Kennziffer] [varchar](20) NULL,
	[KatalogName] [varchar](100) NULL,
	[Beschreibung] [varchar](250) NULL,
	[Version] [varchar](7) NULL,
	[Waehrung] [varchar](3) NULL,
	[Land] [varchar](6) NULL,
	[Rahmenvertrag] [varchar](50) NULL,
	[Bemerkungen] [varchar](250) NULL,
	[Fracht] [int] NULL,
	[Verpackung] [int] NULL,
	[Versicherung] [int] NULL,
	[Verzollung] [int] NULL,
	[PreisAusVKs] [int] NULL,
	[PreisAusVKsIndex] [int] NULL,
	[XMLSpeichern] [int] NULL,
	[XMLPfad] [varchar](150) NULL,
	[ZIPspeichern] [int] NULL,
	[ZIPPfad] [varchar](150) NULL,
	[Status] [int] NULL,
	[Sprache] [varchar](3) NULL,
	[BMEErstelltDatum] [datetime] NULL,
	[StartDatum] [datetime] NULL,
	[EndDatum] [datetime] NULL,
	[UseCheckedArticles] [int] NULL,
	[VarArtikel] [int] NULL,
	[BezeichnungStk] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BookKeepingAccounts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BookKeepingAccounts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Number] [int] NOT NULL,
	[Caption] [nvarchar](200) NULL,
	[Description] [nvarchar](4000) NULL,
	[AccountSystemI3D] [int] NULL,
	[NeedsCustomClearanceVatI3D] [int] NULL,
	[WithoutCustomClearanceVatI3D] [int] NULL,
 CONSTRAINT [PK_BookKeepingAccounts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BookKeepingAccountSystems]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BookKeepingAccountSystems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_BookKeepingAccountSystems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BookKeepingExport]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BookKeepingExport](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](64) NOT NULL,
	[ExportPathCustomerData] [varchar](256) NULL,
	[BookKeepingType] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedVersion] [varchar](24) NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedVersion] [varchar](24) NOT NULL,
	[State] [int] NOT NULL,
	[DefaultExport] [int] NOT NULL,
	[ExportPathCustomerBookingData] [varchar](256) NULL,
	[ExportPathSupplierData] [varchar](256) NULL,
	[ExportPathSupplierBookingData] [varchar](256) NULL,
	[ExportPathCashBook] [varchar](256) NULL,
	[CustomerBookingAdjustmentCostCenterI3D] [int] NULL,
	[CustomerBookingAdjustmentRevenueAccount] [int] NULL,
	[CustomerBookingAdjustmentVATI3D] [int] NULL,
	[SupplierBookingAdjustmentCostCenterI3D] [int] NULL,
	[SupplierBookingAdjustmentExpenseAccount] [int] NULL,
	[SupplierBookingAdjustmentVATI3D] [int] NULL,
	[CompanyNumber] [nvarchar](32) NULL,
	[ExportOnlyCustomersWithSalesInTheSelectedPeriod] [bit] NULL,
	[ExportCentronReceiptNumberAtSupplierReceiptExport] [bit] NULL,
	[CreateStorageBooking] [bit] NULL,
	[AdviserNumber] [nvarchar](32) NULL,
	[ProfitAndLossAccountLength] [int] NULL,
	[UseIndividualBookingTextForCustomerReceipts] [bit] NOT NULL,
	[IndividualBookingTextForCustomerReceipts] [nvarchar](500) NULL,
	[UseIndividualBookingTextForSupplierReceipts] [bit] NOT NULL,
	[IndividualBookingTextForSupplierReceipts] [nvarchar](500) NULL,
	[ShowExportPathDialog] [bit] NOT NULL,
	[ExportOnlyFixedInvoices] [bit] NOT NULL,
	[ExportWithoutFixedInvoiceFlag] [bit] NOT NULL,
	[ExportSepaMandateReference] [bit] NOT NULL,
	[UseAccountFromDifferentInvoiceAddress] [bit] NOT NULL,
	[Export0Invoices] [bit] NOT NULL,
	[IsOldCashbookExportActive] [bit] NOT NULL,
	[ExportPerformanceDate] [bit] NULL,
	[ReceiptsExportAllPositions] [bit] NOT NULL,
	[ExportTaxThroughAccountSystems] [bit] NOT NULL,
	[PaymentOrderProcedure] [int] NOT NULL,
	[FillAddressNumber] [bit] NOT NULL,
	[FileEncoding] [int] NULL,
	[CustomFieldValue1] [nvarchar](250) NULL,
	[CustomFieldValue2] [nvarchar](250) NULL,
	[CustomFieldValue3] [nvarchar](250) NULL,
	[CustomFieldValue4] [nvarchar](250) NULL,
	[DebitorVersion] [nvarchar](50) NOT NULL,
	[KreditorVersion] [nvarchar](50) NOT NULL,
	[DebitorReceiptVersion] [nvarchar](50) NOT NULL,
	[KreditorReceiptVersion] [nvarchar](50) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BookKeepingExportCustomInterfaceColumns]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BookKeepingExportCustomInterfaceColumns](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExportInterfaceI3D] [int] NOT NULL,
	[ColumnKind] [int] NOT NULL,
	[ColumnIndex] [int] NOT NULL,
	[FileColumnName] [nvarchar](128) NULL,
	[CentronColumn] [int] NULL,
	[ColumnValue] [nvarchar](128) NULL,
	[ColumnValueFormat] [int] NULL,
	[ColumnAlignment] [int] NULL,
	[FileColumnLength] [int] NULL,
	[FileColumnFillUpChar] [nvarchar](1) NULL,
 CONSTRAINT [PK_BookKeepingExportCustomInterfaceColumns] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BookKeepingExportCustomInterfaceSettings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BookKeepingExportCustomInterfaceSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExportInterfaceI3D] [int] NOT NULL,
	[ExportKind] [int] NOT NULL,
	[Separator] [int] NULL,
	[UmlautsAllowed] [bit] NULL,
	[RevenueDependent] [bit] NULL,
	[ExportDefaultAddressOnly] [bit] NULL,
	[InsertFileHeader] [bit] NULL,
	[ExportAlreadyExportedData] [bit] NULL,
	[SignPlusMinus] [bit] NULL,
	[SignMinus] [bit] NULL,
	[SignSH] [bit] NULL,
	[ReceiptNumberWithoutSpecialChar] [bit] NULL,
	[FillCreditAndDebitAccountWithZero] [bit] NULL,
	[LeadingDks] [bit] NULL,
	[DecimalSeparator] [int] NULL,
	[DateFormat] [nvarchar](50) NULL,
 CONSTRAINT [PK_BookKeepingExportCustomInterfaceSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BookKeepingImportInterfaceColumns]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BookKeepingImportInterfaceColumns](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BookKeepingImportInterfaceI3D] [int] NOT NULL,
	[ColumnIndex] [int] NOT NULL,
	[FileColumnName] [nvarchar](64) NULL,
	[FileColumnLength] [int] NULL,
	[CentronColumn] [int] NULL,
 CONSTRAINT [PK_BookKeepingImportInterfaceColumns] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BookKeepingImportInterfaces]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BookKeepingImportInterfaces](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](32) NOT NULL,
	[FileFormat] [int] NOT NULL,
	[ColumnSeparator] [int] NOT NULL,
	[DecimalSymbol] [nvarchar](4) NOT NULL,
	[ColumnIdentification] [int] NOT NULL,
	[WriteCreditVoucherAmountsInInvoicePayedField] [bit] NOT NULL,
	[NegativAmountsReduceInvoicePayedAmount] [bit] NOT NULL,
	[ColumnDateFormat] [varchar](20) NULL,
 CONSTRAINT [PK_BookKeepingImportInterfaces] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Branch]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Branch](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MandatoryI3D] [int] NULL,
	[CountryI3D] [int] NULL,
	[StreetName] [varchar](255) NULL,
	[PostalCode] [varchar](10) NULL,
	[City] [varchar](100) NULL,
	[Comment] [varchar](5000) NULL,
	[TelephoneNumber] [varchar](30) NULL,
	[FaxNumber] [varchar](30) NULL,
	[EMail] [varchar](255) NULL,
	[WWW] [varchar](255) NULL,
	[LanguageI3D] [int] NULL,
	[BranchName] [varchar](255) NULL,
	[IsDefault] [int] NULL,
	[BranchStatus] [int] NULL,
	[BranchID] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BranchToStock]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BranchToStock](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BranchI3D] [int] NULL,
	[StockI3D] [int] NULL,
	[IsDefault] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BuchhaltungsExpDebPerson]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BuchhaltungsExpDebPerson](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExportName] [varchar](50) NULL,
	[LetzteAenderung] [varchar](50) NULL,
	[LetzteAenderung_Am] [datetime] NULL,
	[QuellDaten] [varchar](5000) NULL,
	[TrennZeichen] [varchar](50) NULL,
	[FileName] [varchar](50) NULL,
	[FileExtension] [varchar](50) NULL,
	[IgnorZeichenLaenge] [int] NULL,
	[FuehrendesDKS] [int] NULL,
	[ColumnPersonKTONr] [int] NULL,
	[ColumnKundenNr] [int] NULL,
	[ColumnAnrede] [int] NULL,
	[ColumnName1] [int] NULL,
	[ColumnKommentar] [int] NULL,
	[ColumnKuerzel] [int] NULL,
	[ColumnStrasse] [int] NULL,
	[ColumnPostfach] [int] NULL,
	[ColumnOrt] [int] NULL,
	[ColumnLand] [int] NULL,
	[ColumnNationalKN] [int] NULL,
	[ColumnTel] [int] NULL,
	[ColumnFax] [int] NULL,
	[ColumnTelex] [int] NULL,
	[ColumnMobilfon] [int] NULL,
	[ColumnUstID] [int] NULL,
	[ColumnSteuerNr] [int] NULL,
	[ColumnBank] [int] NULL,
	[ColumnBankBLZ] [int] NULL,
	[ColumnBankKTO] [int] NULL,
	[ColumnBankLand] [int] NULL,
	[ColumnBankIBAN] [int] NULL,
	[ColumnBankSWIFT] [int] NULL,
	[ColumnEMail] [int] NULL,
	[ColumnInternetUrl] [int] NULL,
	[ColumnBankOrt] [int] NULL,
	[ColumnBankStrasse] [int] NULL,
	[ColumnBank02] [int] NULL,
	[ColumnBankBLZ02] [int] NULL,
	[ColumnBankKtoNr02] [int] NULL,
	[ColumnBankLand02] [int] NULL,
	[ColumnBankOrt02] [int] NULL,
	[ColumnBankStrasse02] [int] NULL,
	[ColumnBankIBAN02] [int] NULL,
	[ColumnBankSWIFT02] [int] NULL,
	[ColumnPostleitzahl] [int] NULL,
	[ColumnLeerFeld01] [int] NULL,
	[ColumnLeerFeld02] [int] NULL,
	[ColumnLeerFeld03] [int] NULL,
	[ColumnLeerFeld04] [int] NULL,
	[ColumnLeerFeld05] [int] NULL,
	[LaengePersonKTONr] [int] NULL,
	[LaengeKundenNr] [int] NULL,
	[LaengeAnrede] [int] NULL,
	[LaengeName1] [int] NULL,
	[LaengeKommentar] [int] NULL,
	[LaengeKuerzel] [int] NULL,
	[LaengeStrasse] [int] NULL,
	[LaengePostfach] [int] NULL,
	[LaengeOrt] [int] NULL,
	[LaengeLand] [int] NULL,
	[LaengeNationalKN] [int] NULL,
	[LaengeTel] [int] NULL,
	[LaengeFax] [int] NULL,
	[LaengeTelex] [int] NULL,
	[LaengeMobilfon] [int] NULL,
	[LaengeUstID] [int] NULL,
	[LaengeSteuerNr] [int] NULL,
	[LaengeBank] [int] NULL,
	[LaengeBankBLZ] [int] NULL,
	[LaengeBankKTO] [int] NULL,
	[LaengeBankLand] [int] NULL,
	[LaengeBankIBAN] [int] NULL,
	[LaengeBankSWIFT] [int] NULL,
	[LaengeEMail] [int] NULL,
	[LaengeInternetUrl] [int] NULL,
	[LaengeBankOrt] [int] NULL,
	[LaengeBankStrasse] [int] NULL,
	[LaengeBank02] [int] NULL,
	[LaengeBankBLZ02] [int] NULL,
	[LaengeBankKtoNr02] [int] NULL,
	[LaengeBankLand02] [int] NULL,
	[LaengeBankOrt02] [int] NULL,
	[LaengeBankStrasse02] [int] NULL,
	[LaengeBankIBAN02] [int] NULL,
	[LaengeBankSWIFT02] [int] NULL,
	[LaengePostleitzahl] [int] NULL,
	[LaengeLeerFeld01] [int] NULL,
	[LaengeLeerFeld02] [int] NULL,
	[LaengeLeerFeld03] [int] NULL,
	[LaengeLeerFeld04] [int] NULL,
	[LaengeLeerFeld05] [int] NULL,
	[DestPath] [varchar](100) NULL,
	[ColumnBuchungsArt] [int] NULL,
	[LaengeBuchungsArt] [int] NULL,
	[BuchungsArtText] [varchar](50) NULL,
	[Umlaute] [int] NULL,
	[ColumnName2] [int] NULL,
	[ColumnKurzbezeichnung] [int] NULL,
	[LaengeName2] [int] NULL,
	[LaengeKurzbezeichnung] [int] NULL,
	[ColumnLeerFeld06] [int] NULL,
	[ColumnLeerFeld07] [int] NULL,
	[ColumnLeerFeld08] [int] NULL,
	[ColumnLeerFeld09] [int] NULL,
	[ColumnLeerFeld10] [int] NULL,
	[ColumnLeerFeld11] [int] NULL,
	[ColumnLeerFeld12] [int] NULL,
	[ColumnLeerFeld13] [int] NULL,
	[ColumnLeerFeld14] [int] NULL,
	[ColumnLeerFeld15] [int] NULL,
	[LaengeLeerFeld06] [int] NULL,
	[LaengeLeerFeld07] [int] NULL,
	[LaengeLeerFeld08] [int] NULL,
	[LaengeLeerFeld09] [int] NULL,
	[LaengeLeerFeld10] [int] NULL,
	[LaengeLeerFeld11] [int] NULL,
	[LaengeLeerFeld12] [int] NULL,
	[LaengeLeerFeld13] [int] NULL,
	[LaengeLeerFeld14] [int] NULL,
	[LaengeLeerFeld15] [int] NULL,
	[DatumVon] [datetime] NULL,
	[DatumBis] [datetime] NULL,
	[Umsatz] [int] NULL,
	[Status] [int] NULL,
	[DateiHeader] [varchar](255) NULL,
	[ColumnPLZOrt] [int] NULL,
	[LaengePLZOrt] [int] NULL,
	[ColumnKonstantesFeld01] [int] NULL,
	[LaengeKonstantesFeld01] [int] NULL,
	[ColumnKonstantesFeld02] [int] NULL,
	[LaengeKonstantesFeld02] [int] NULL,
	[ColumnKonstantesFeld03] [int] NULL,
	[LaengeKonstantesFeld03] [int] NULL,
	[SonderKonstantesFeld01] [varchar](50) NULL,
	[SonderKonstantesFeld02] [varchar](50) NULL,
	[SonderKonstantesFeld03] [varchar](50) NULL,
	[ColumnRechnungZahlungstyp] [int] NULL,
	[LaengeRechnungZahlungstyp] [int] NULL,
	[SonderRechnungZahlungstyp] [varchar](50) NULL,
	[ColumnKonstantesFeld04] [int] NULL,
	[ColumnKonstantesFeld05] [int] NULL,
	[LaengeKonstantesFeld05] [int] NULL,
	[SonderKonstantesFeld05] [varchar](50) NULL,
	[ColumnKonstantesFeld06] [int] NULL,
	[LaengeKonstantesFeld06] [int] NULL,
	[SonderKonstantesFeld06] [varchar](50) NULL,
	[ColumnKonstantesFeld07] [int] NULL,
	[LaengeKonstantesFeld07] [int] NULL,
	[SonderKonstantesFeld07] [varchar](50) NULL,
	[ColumnKonstantesFeld08] [int] NULL,
	[LaengeKonstantesFeld08] [int] NULL,
	[SonderKonstantesFeld08] [varchar](50) NULL,
	[ColumnKonstantesFeld09] [int] NULL,
	[LaengeKonstantesFeld09] [int] NULL,
	[SonderKonstantesFeld09] [varchar](50) NULL,
	[ColumnKonstantesFeld10] [int] NULL,
	[LaengeKonstantesFeld10] [int] NULL,
	[SonderKonstantesFeld10] [varchar](50) NULL,
	[LaengeKonstantesFeld04] [int] NULL,
	[SonderKonstantesFeld04] [varchar](50) NULL,
	[ColumnKuerzelName] [int] NULL,
	[LaengeKuerzelName] [int] NULL,
	[SonderKuerzelName] [varchar](50) NULL,
	[ConvertToASCII] [int] NULL,
	[OnlyStandardAnschrift] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BuchhaltungsExpKredPerson]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BuchhaltungsExpKredPerson](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExportName] [varchar](50) NULL,
	[LetzteAenderung] [varchar](50) NULL,
	[LetzteAenderung_Am] [datetime] NULL,
	[QuellDaten] [varchar](5000) NULL,
	[TrennZeichen] [varchar](50) NULL,
	[FileName] [varchar](50) NULL,
	[FileExtension] [varchar](50) NULL,
	[IgnorZeichenLaenge] [int] NULL,
	[FuehrendesDKS] [int] NULL,
	[ColumnPersonKTONr] [int] NULL,
	[ColumnKreditorenNr] [int] NULL,
	[ColumnAnrede] [int] NULL,
	[ColumnName1] [int] NULL,
	[ColumnKommentar] [int] NULL,
	[ColumnKuerzel] [int] NULL,
	[ColumnStrasse] [int] NULL,
	[ColumnPostfach] [int] NULL,
	[ColumnOrt] [int] NULL,
	[ColumnLand] [int] NULL,
	[ColumnNationalKN] [int] NULL,
	[ColumnTel] [int] NULL,
	[ColumnFax] [int] NULL,
	[ColumnTelex] [int] NULL,
	[ColumnMobilfon] [int] NULL,
	[ColumnUstID] [int] NULL,
	[ColumnSteuerNr] [int] NULL,
	[ColumnBank] [int] NULL,
	[ColumnBankBLZ] [int] NULL,
	[ColumnBankKTO] [int] NULL,
	[ColumnBankLand] [int] NULL,
	[ColumnBankIBAN] [int] NULL,
	[ColumnBankSWIFT] [int] NULL,
	[ColumnEMail] [int] NULL,
	[ColumnInternetUrl] [int] NULL,
	[ColumnBankOrt] [int] NULL,
	[ColumnBankStrasse] [int] NULL,
	[ColumnBank02] [int] NULL,
	[ColumnBankBLZ02] [int] NULL,
	[ColumnBankKtoNr02] [int] NULL,
	[ColumnBankLand02] [int] NULL,
	[ColumnBankOrt02] [int] NULL,
	[ColumnBankStrasse02] [int] NULL,
	[ColumnBankIBAN02] [int] NULL,
	[ColumnBankSWIFT02] [int] NULL,
	[ColumnPostleitzahl] [int] NULL,
	[ColumnLeerFeld01] [int] NULL,
	[ColumnLeerFeld02] [int] NULL,
	[ColumnLeerFeld03] [int] NULL,
	[ColumnLeerFeld04] [int] NULL,
	[ColumnLeerFeld05] [int] NULL,
	[LaengePersonKTONr] [int] NULL,
	[LaengeKreditorenNr] [int] NULL,
	[LaengeAnrede] [int] NULL,
	[LaengeName1] [int] NULL,
	[LaengeKommentar] [int] NULL,
	[LaengeKuerzel] [int] NULL,
	[LaengeStrasse] [int] NULL,
	[LaengePostfach] [int] NULL,
	[LaengeOrt] [int] NULL,
	[LaengeLand] [int] NULL,
	[LaengeNationalKN] [int] NULL,
	[LaengeTel] [int] NULL,
	[LaengeFax] [int] NULL,
	[LaengeTelex] [int] NULL,
	[LaengeMobilfon] [int] NULL,
	[LaengeUstID] [int] NULL,
	[LaengeSteuerNr] [int] NULL,
	[LaengeBank] [int] NULL,
	[LaengeBankBLZ] [int] NULL,
	[LaengeBankKTO] [int] NULL,
	[LaengeBankLand] [int] NULL,
	[LaengeBankIBAN] [int] NULL,
	[LaengeBankSWIFT] [int] NULL,
	[LaengeEMail] [int] NULL,
	[LaengeInternetUrl] [int] NULL,
	[LaengeBankOrt] [int] NULL,
	[LaengeBankStrasse] [int] NULL,
	[LaengeBank02] [int] NULL,
	[LaengeBankBLZ02] [int] NULL,
	[LaengeBankKtoNr02] [int] NULL,
	[LaengeBankLand02] [int] NULL,
	[LaengeBankOrt02] [int] NULL,
	[LaengeBankStrasse02] [int] NULL,
	[LaengeBankIBAN02] [int] NULL,
	[LaengeBankSWIFT02] [int] NULL,
	[LaengePostleitzahl] [int] NULL,
	[LaengeLeerFeld01] [int] NULL,
	[LaengeLeerFeld02] [int] NULL,
	[LaengeLeerFeld03] [int] NULL,
	[LaengeLeerFeld04] [int] NULL,
	[LaengeLeerFeld05] [int] NULL,
	[DestPath] [varchar](100) NULL,
	[ColumnBuchungsArt] [int] NULL,
	[LaengeBuchungsArt] [int] NULL,
	[BuchungsArtText] [varchar](50) NULL,
	[Umlaute] [int] NULL,
	[ColumnKundenNr] [int] NULL,
	[ColumnName2] [int] NULL,
	[ColumnKurzbezeichnung] [int] NULL,
	[LaengeKundenNr] [int] NULL,
	[LaengeName2] [int] NULL,
	[LaengeKurzbezeichnung] [int] NULL,
	[ColumnLeerFeld06] [int] NULL,
	[ColumnLeerFeld07] [int] NULL,
	[ColumnLeerFeld08] [int] NULL,
	[ColumnLeerFeld09] [int] NULL,
	[ColumnLeerFeld10] [int] NULL,
	[ColumnLeerFeld11] [int] NULL,
	[ColumnLeerFeld12] [int] NULL,
	[ColumnLeerFeld13] [int] NULL,
	[ColumnLeerFeld14] [int] NULL,
	[ColumnLeerFeld15] [int] NULL,
	[LaengeLeerFeld06] [int] NULL,
	[LaengeLeerFeld07] [int] NULL,
	[LaengeLeerFeld08] [int] NULL,
	[LaengeLeerFeld09] [int] NULL,
	[LaengeLeerFeld10] [int] NULL,
	[LaengeLeerFeld11] [int] NULL,
	[LaengeLeerFeld12] [int] NULL,
	[LaengeLeerFeld13] [int] NULL,
	[LaengeLeerFeld14] [int] NULL,
	[LaengeLeerFeld15] [int] NULL,
	[DatumVon] [datetime] NULL,
	[DatumBis] [datetime] NULL,
	[Umsatz] [int] NULL,
	[Status] [int] NULL,
	[DateiHeader] [varchar](255) NULL,
	[ColumnPLZOrt] [int] NULL,
	[LaengePLZOrt] [int] NULL,
	[ColumnKonstantesFeld01] [int] NULL,
	[LaengeKonstantesFeld01] [int] NULL,
	[ColumnKonstantesFeld02] [int] NULL,
	[LaengeKonstantesFeld02] [int] NULL,
	[ColumnKonstantesFeld03] [int] NULL,
	[LaengeKonstantesFeld03] [int] NULL,
	[SonderKonstantesFeld01] [varchar](50) NULL,
	[SonderKonstantesFeld02] [varchar](50) NULL,
	[SonderKonstantesFeld03] [varchar](50) NULL,
	[ColumnKonstantesFeld04] [int] NULL,
	[LaengeKonstantesFeld04] [int] NULL,
	[SonderKonstantesFeld04] [varchar](50) NULL,
	[ColumnKonstantesFeld05] [int] NULL,
	[LaengeKonstantesFeld05] [int] NULL,
	[SonderKonstantesFeld05] [varchar](50) NULL,
	[ColumnKonstantesFeld06] [int] NULL,
	[LaengeKonstantesFeld06] [int] NULL,
	[SonderKonstantesFeld06] [varchar](50) NULL,
	[ColumnKonstantesFeld07] [int] NULL,
	[LaengeKonstantesFeld07] [int] NULL,
	[SonderKonstantesFeld07] [varchar](50) NULL,
	[ColumnKonstantesFeld08] [int] NULL,
	[LaengeKonstantesFeld08] [int] NULL,
	[SonderKonstantesFeld08] [varchar](50) NULL,
	[ColumnKonstantesFeld09] [int] NULL,
	[LaengeKonstantesFeld09] [int] NULL,
	[SonderKonstantesFeld09] [varchar](50) NULL,
	[ColumnKonstantesFeld10] [int] NULL,
	[LaengeKonstantesFeld10] [int] NULL,
	[SonderKonstantesFeld10] [varchar](50) NULL,
	[ColumnKuerzelName] [int] NULL,
	[LaengeKuerzelName] [int] NULL,
	[SonderKuerzelName] [varchar](50) NULL,
	[ConvertToASCII] [int] NULL,
	[OnlyStandardAnschrift] [int] NULL,
	[ColumnLeeresFeld06] [int] NULL,
	[LaengeLeeresFeld06] [int] NULL,
	[SonderLeeresFeld06] [varchar](50) NULL,
	[ColumnLeeresFeld07] [int] NULL,
	[LaengeLeeresFeld07] [int] NULL,
	[SonderLeeresFeld07] [varchar](50) NULL,
	[ColumnLeeresFeld08] [int] NULL,
	[LaengeLeeresFeld08] [int] NULL,
	[SonderLeeresFeld08] [varchar](50) NULL,
	[ColumnLeeresFeld09] [int] NULL,
	[LaengeLeeresFeld09] [int] NULL,
	[SonderLeeresFeld09] [varchar](50) NULL,
	[ColumnLeeresFeld10] [int] NULL,
	[LaengeLeeresFeld10] [int] NULL,
	[SonderLeeresFeld10] [varchar](50) NULL,
	[ColumnLeeresFeld11] [int] NULL,
	[LaengeLeeresFeld11] [int] NULL,
	[SonderLeeresFeld11] [varchar](50) NULL,
	[ColumnLeeresFeld12] [int] NULL,
	[LaengeLeeresFeld12] [int] NULL,
	[SonderLeeresFeld12] [varchar](50) NULL,
	[ColumnLeeresFeld13] [int] NULL,
	[LaengeLeeresFeld13] [int] NULL,
	[SonderLeeresFeld13] [varchar](50) NULL,
	[ColumnLeeresFeld14] [int] NULL,
	[LaengeLeeresFeld14] [int] NULL,
	[SonderLeeresFeld14] [varchar](50) NULL,
	[ColumnLeeresFeld15] [int] NULL,
	[LaengeLeeresFeld15] [int] NULL,
	[SonderLeeresFeld15] [varchar](50) NULL,
	[ColumnRechnungZahlungstyp] [int] NULL,
	[LaengeRechnungZahlungstyp] [int] NULL,
	[SonderRechnungZahlungstyp] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BuchhaltungsExport]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BuchhaltungsExport](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExportName] [varchar](50) NULL,
	[ColumnKonto] [int] NULL,
	[ColumnGegenKonto] [int] NULL,
	[ColumnDebitorenname] [int] NULL,
	[ColumnBetrag] [int] NULL,
	[ColumnBelegdatum] [int] NULL,
	[ColumnBelegnummer] [int] NULL,
	[ColumnBuchungstext] [int] NULL,
	[ColumnWaehrungsKN] [int] NULL,
	[ColumnKostenstelle] [int] NULL,
	[ColumnKostentraeger] [int] NULL,
	[ColumnFaelligBis] [int] NULL,
	[ColumnSkonto1] [int] NULL,
	[ColumnSkontofrist1] [int] NULL,
	[ColumnSkonto2] [int] NULL,
	[ColumnSkontofrist2] [int] NULL,
	[ColumnLeerFeld01] [int] NULL,
	[ColumnLeerFeld02] [int] NULL,
	[ColumnLeerFeld03] [int] NULL,
	[ColumnLeerFeld04] [int] NULL,
	[ColumnLeerFeld05] [int] NULL,
	[ColumnSteuerkennziffer] [int] NULL,
	[LaengeKonto] [int] NULL,
	[LaengeGegenKonto] [int] NULL,
	[LaengeDebitorenname] [int] NULL,
	[LaengeBetrag] [int] NULL,
	[LaengeBelegdatum] [int] NULL,
	[LaengeBelegnummer] [int] NULL,
	[LaengeBuchungstext] [int] NULL,
	[LaengeWaehrungsKN] [int] NULL,
	[LaengeKostenstelle] [int] NULL,
	[LaengeKostentraeger] [int] NULL,
	[LaengeFaelligBis] [int] NULL,
	[LaengeSkonto1] [int] NULL,
	[LaengeSkontofrist1] [int] NULL,
	[LaengeSkonto2] [int] NULL,
	[LaengeSkontofrist2] [int] NULL,
	[LaengeLeerFeld01] [int] NULL,
	[LaengeLeerFeld02] [int] NULL,
	[LaengeLeerFeld03] [int] NULL,
	[LaengeLeerFeld04] [int] NULL,
	[LaengeLeerFeld05] [int] NULL,
	[LaengeSteuerkennziffer] [int] NULL,
	[SonderKonto] [varchar](50) NULL,
	[SonderGegenKonto] [varchar](50) NULL,
	[SonderDebitorenname] [varchar](50) NULL,
	[SonderBetrag] [varchar](50) NULL,
	[SonderBelegdatum] [varchar](50) NULL,
	[SonderBelegnummer] [varchar](50) NULL,
	[SonderBuchungstext] [varchar](50) NULL,
	[SonderWaehrungsKN] [varchar](50) NULL,
	[SonderKostenstelle] [varchar](50) NULL,
	[SonderKostentraeger] [varchar](50) NULL,
	[SonderFaelligBis] [varchar](50) NULL,
	[SonderSkonto1] [varchar](50) NULL,
	[SonderSkontofrist1] [varchar](50) NULL,
	[SonderSkonto2] [varchar](50) NULL,
	[SonderSkontofrist2] [varchar](50) NULL,
	[SonderLeerFeld01] [varchar](50) NULL,
	[SonderLeerFeld02] [varchar](50) NULL,
	[SonderLeerFeld03] [varchar](50) NULL,
	[SonderLeerFeld04] [varchar](50) NULL,
	[SonderLeerFeld05] [varchar](50) NULL,
	[SonderSteuerkennziffer] [varchar](50) NULL,
	[LetzteAenderung] [varchar](50) NULL,
	[LetzteAenderung_Am] [datetime] NULL,
	[QuellDaten] [varchar](5000) NULL,
	[Trennzeichen] [varchar](50) NULL,
	[Betrag] [varchar](50) NULL,
	[VorzeichenSH] [int] NULL,
	[VorzeichenPM] [int] NULL,
	[DatumsFormat] [int] NULL,
	[FileName] [varchar](50) NULL,
	[FileExtension] [varchar](50) NULL,
	[IgnorZeichenLaenge] [int] NULL,
	[ColumnNettobetrag] [int] NULL,
	[ColumnBruttobetrag] [int] NULL,
	[ColumnVorzeichen] [int] NULL,
	[ColumnSoll_HabenKN] [int] NULL,
	[LaengeNettobetrag] [int] NULL,
	[LaengeBruttobetrag] [int] NULL,
	[LaengeVorzeichen] [int] NULL,
	[LaengeSoll_HabenKN] [int] NULL,
	[SonderNettobetrag] [varchar](10) NULL,
	[SonderBruttobetrag] [varchar](10) NULL,
	[SonderVorzeichen] [varchar](10) NULL,
	[SonderSoll_HabenKN] [varchar](10) NULL,
	[NurNetto] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BuchhaltungsExportDeb]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BuchhaltungsExportDeb](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExportName] [varchar](50) NULL,
	[ColumnKonto] [int] NULL,
	[ColumnGegenKonto] [int] NULL,
	[ColumnDebitorenname] [int] NULL,
	[ColumnBetrag] [int] NULL,
	[ColumnBelegdatum] [int] NULL,
	[ColumnBelegnummer] [int] NULL,
	[ColumnBuchungstext] [int] NULL,
	[ColumnWaehrungsKN] [int] NULL,
	[ColumnKostenstelle] [int] NULL,
	[ColumnKostentraeger] [int] NULL,
	[ColumnFaelligBis] [int] NULL,
	[ColumnSkonto1] [int] NULL,
	[ColumnSkontofrist1] [int] NULL,
	[ColumnSkonto2] [int] NULL,
	[ColumnSkontofrist2] [int] NULL,
	[ColumnLeerFeld01] [int] NULL,
	[ColumnLeerFeld02] [int] NULL,
	[ColumnLeerFeld03] [int] NULL,
	[ColumnLeerFeld04] [int] NULL,
	[ColumnLeerFeld05] [int] NULL,
	[ColumnSteuerkennziffer] [int] NULL,
	[ColumnSollHabenKN] [int] NULL,
	[ColumnBuchungsart] [int] NULL,
	[LaengeKonto] [int] NULL,
	[LaengeGegenkonto] [int] NULL,
	[LaengeDebitorenname] [int] NULL,
	[LaengeBetrag] [int] NULL,
	[LaengeBelegdatum] [int] NULL,
	[LaengeBelegnummer] [int] NULL,
	[LaengeBuchungstext] [int] NULL,
	[LaengeWaehrungsKN] [int] NULL,
	[LaengeKostenstelle] [int] NULL,
	[LaengeKostentraeger] [int] NULL,
	[LaengeFaelligBis] [int] NULL,
	[LaengeSkonto1] [int] NULL,
	[LaengeSkontofrist1] [int] NULL,
	[LaengeSkonto2] [int] NULL,
	[LaengeSkontofrist2] [int] NULL,
	[LaengeLeerFeld01] [int] NULL,
	[LaengeLeerFeld02] [int] NULL,
	[LaengeLeerFeld03] [int] NULL,
	[LaengeLeerFeld04] [int] NULL,
	[LaengeLeerFeld05] [int] NULL,
	[LaengeSteuerkennziffer] [int] NULL,
	[LaengeSollHabenKN] [int] NULL,
	[LaengeBuchungsArt] [int] NULL,
	[SonderKonto] [varchar](50) NULL,
	[SonderGegenKonto] [varchar](50) NULL,
	[SonderDebitorenname] [varchar](50) NULL,
	[SonderBetrag] [varchar](50) NULL,
	[SonderBelegdatum] [varchar](50) NULL,
	[SonderBelegnummer] [varchar](50) NULL,
	[SonderBuchungstext] [varchar](50) NULL,
	[SonderWaehrungsKN] [varchar](50) NULL,
	[SonderKostenstelle] [varchar](50) NULL,
	[SonderKostentraeger] [varchar](50) NULL,
	[SonderFaelligBis] [varchar](50) NULL,
	[SonderSkonto1] [varchar](50) NULL,
	[SonderSkontofrist1] [varchar](50) NULL,
	[SonderSkonto2] [varchar](50) NULL,
	[SonderSkontofrist2] [varchar](50) NULL,
	[SonderLeerFeld01] [varchar](50) NULL,
	[SonderLeerFeld02] [varchar](50) NULL,
	[SonderLeerFeld03] [varchar](50) NULL,
	[SonderLeerFeld04] [varchar](50) NULL,
	[SonderLeerFeld05] [varchar](50) NULL,
	[SonderSteuerkennziffer] [varchar](50) NULL,
	[SonderSollHabenKN] [varchar](50) NULL,
	[SonderBuchungsArt] [varchar](50) NULL,
	[LiBKonto] [int] NULL,
	[LiBGegenKonto] [int] NULL,
	[LiBDebitorenname] [int] NULL,
	[LiBBetrag] [int] NULL,
	[LiBBelegdatum] [int] NULL,
	[LiBBelegnummer] [int] NULL,
	[LiBBuchungstext] [int] NULL,
	[LiBWaehrungsKN] [int] NULL,
	[LiBKostenstelle] [int] NULL,
	[LiBKostentraeger] [int] NULL,
	[LiBFaelligBis] [int] NULL,
	[LiBSkonto1] [int] NULL,
	[LiBSkontofrist1] [int] NULL,
	[LiBSkonto2] [int] NULL,
	[LiBSkontofrist2] [int] NULL,
	[LiBLeerFeld01] [int] NULL,
	[LiBLeerFeld02] [int] NULL,
	[LiBLeerFeld03] [int] NULL,
	[LiBLeerFeld04] [int] NULL,
	[LiBLeerFeld05] [int] NULL,
	[LiBSteuerkennziffer] [int] NULL,
	[LiBBuchungsArt] [int] NULL,
	[LetzteAenderung] [varchar](50) NULL,
	[LetzteAenderung_Am] [datetime] NULL,
	[QuellDaten] [varchar](5000) NULL,
	[Trennzeichen] [varchar](50) NULL,
	[Betrag] [varchar](50) NULL,
	[VorzeichenSH] [int] NULL,
	[VorzeichenPM] [int] NULL,
	[DatumsFormat] [int] NULL,
	[FileName] [varchar](50) NULL,
	[FileExtension] [varchar](50) NULL,
	[DestPath] [varchar](100) NULL,
	[IgnorZeichenLaenge] [int] NULL,
	[FuehrendesDKS] [int] NULL,
	[BuchungsArtText] [varchar](50) NULL,
	[Splittung] [int] NULL,
	[Umlaute] [int] NULL,
	[BelegNrSonderZ] [int] NULL,
	[ColumnBetragNetto] [int] NULL,
	[LaengeBetragNetto] [int] NULL,
	[SonderBetragNetto] [varchar](50) NULL,
	[LiBBetragNetto] [int] NULL,
	[SonderLeeFeld02] [varchar](50) NULL,
	[ColumnZahlungstyp] [int] NULL,
	[LaengeZahlungstyp] [int] NULL,
	[SonderZahlungstyp] [varchar](50) NULL,
	[LiBZahlungstyp] [int] NULL,
	[RadKennung] [int] NULL,
	[FaelligAmTagDatum] [int] NULL,
	[ColumnEK] [int] NULL,
	[ColumnProjektnummer] [int] NULL,
	[ColumnBuchhaltungsnummer] [int] NULL,
	[LaengeEK] [int] NULL,
	[LaengeProjektnummer] [int] NULL,
	[LaengeBuchhaltungsnummer] [int] NULL,
	[SonderEK] [varchar](50) NULL,
	[SonderProjektnummer] [varchar](50) NULL,
	[SonderBuchhaltungsnummer] [varchar](50) NULL,
	[LiBEK] [int] NULL,
	[LiBProjektnummer] [int] NULL,
	[LiBBuchhaltungsnummer] [int] NULL,
	[FuehrendeNullen] [int] NULL,
	[Status] [int] NULL,
	[DateiHeader] [varchar](255) NULL,
	[ColumnKonstantesFeld01] [int] NULL,
	[LaengeKonstantesFeld01] [int] NULL,
	[SonderKonstantesFeld01] [varchar](50) NULL,
	[LiBKonstantesFeld01] [int] NULL,
	[ColumnMwstSatz] [int] NULL,
	[LaengeMwstSatz] [int] NULL,
	[SonderMwstSatz] [varchar](50) NULL,
	[LiBMwstSatz] [int] NULL,
	[ColumnMwstBetrag] [int] NULL,
	[LaengeMwstBetrag] [int] NULL,
	[SonderMwstBetrag] [varchar](50) NULL,
	[LiBMwstBetrag] [int] NULL,
	[ColumnBuchungsperiode] [int] NULL,
	[LaengeBuchungsperiode] [int] NULL,
	[SonderBuchungsperiode] [varchar](50) NULL,
	[LiBBuchungsperiode] [int] NULL,
	[ColumnBuchungsjahr] [int] NULL,
	[LaengeBuchungsjahr] [int] NULL,
	[SonderBuchungsjahr] [varchar](50) NULL,
	[LiBBuchungsjahr] [int] NULL,
	[ColumnKonstantesFeld02] [int] NULL,
	[LaengeKonstantesFeld02] [int] NULL,
	[SonderKonstantesFeld02] [varchar](50) NULL,
	[LiBKonstantesFeld02] [int] NULL,
	[ColumnKonstantesFeld03] [int] NULL,
	[LaengeKonstantesFeld03] [int] NULL,
	[SonderKonstantesFeld03] [varchar](50) NULL,
	[LiBKonstantesFeld03] [int] NULL,
	[ColumnRechnungsnummer] [int] NULL,
	[LaengeRechnungsnummer] [int] NULL,
	[SonderRechnungsnummer] [varchar](50) NULL,
	[LiBRechnungsnummer] [int] NULL,
	[ExportNullRechnungen] [int] NULL,
	[ExportAbwEmpfaenger] [int] NULL,
	[Dezimaltrennzeichen] [varchar](5) NULL,
	[ColumnSollHabenKennzeichen] [int] NULL,
	[LaengeSollHabenKennzeichen] [int] NULL,
	[SonderSollHabenKennzeichen] [varchar](50) NULL,
	[LiBSollHabenKennzeichen] [int] NULL,
	[ColumnBuchungsdatum] [int] NULL,
	[LaengeBuchungsdatum] [int] NULL,
	[SonderBuchungsdatum] [varchar](50) NULL,
	[LiBBuchungsdatum] [int] NULL,
	[ColumnKonstantesFeld04] [int] NULL,
	[LaengeKonstantesFeld04] [int] NULL,
	[SonderKonstantesFeld04] [varchar](50) NULL,
	[LiBKonstantesFeld04] [int] NULL,
	[ColumnKonstantesFeld05] [int] NULL,
	[LaengeKonstantesFeld05] [int] NULL,
	[SonderKonstantesFeld05] [varchar](50) NULL,
	[LiBKonstantesFeld05] [int] NULL,
	[ColumnKonstantesFeld06] [int] NULL,
	[LaengeKonstantesFeld06] [int] NULL,
	[SonderKonstantesFeld06] [varchar](50) NULL,
	[LiBKonstantesFeld06] [int] NULL,
	[ColumnKonstantesFeld07] [int] NULL,
	[LaengeKonstantesFeld07] [int] NULL,
	[SonderKonstantesFeld07] [varchar](50) NULL,
	[LiBKonstantesFeld07] [int] NULL,
	[ColumnKonstantesFeld08] [int] NULL,
	[LaengeKonstantesFeld08] [int] NULL,
	[SonderKonstantesFeld08] [varchar](50) NULL,
	[LiBKonstantesFeld08] [int] NULL,
	[ColumnKonstantesFeld09] [int] NULL,
	[LaengeKonstantesFeld09] [int] NULL,
	[SonderKonstantesFeld09] [varchar](50) NULL,
	[LiBKonstantesFeld09] [int] NULL,
	[ColumnKonstantesFeld10] [int] NULL,
	[LaengeKonstantesFeld10] [int] NULL,
	[SonderKonstantesFeld10] [varchar](50) NULL,
	[LiBKonstantesFeld10] [int] NULL,
	[ColumnKonstantesFeld11] [int] NULL,
	[LaengeKonstantesFeld11] [int] NULL,
	[SonderKonstantesFeld11] [varchar](50) NULL,
	[LiBKonstantesFeld11] [int] NULL,
	[ColumnKonstantesFeld12] [int] NULL,
	[LaengeKonstantesFeld12] [int] NULL,
	[SonderKonstantesFeld12] [varchar](50) NULL,
	[LiBKonstantesFeld12] [int] NULL,
	[ColumnKonstantesFeld13] [int] NULL,
	[LaengeKonstantesFeld13] [int] NULL,
	[SonderKonstantesFeld13] [varchar](50) NULL,
	[LiBKonstantesFeld13] [int] NULL,
	[ColumnKonstantesFeld14] [int] NULL,
	[LaengeKonstantesFeld14] [int] NULL,
	[SonderKonstantesFeld14] [varchar](50) NULL,
	[LiBKonstantesFeld14] [int] NULL,
	[ColumnKonstantesFeld15] [int] NULL,
	[LaengeKonstantesFeld15] [int] NULL,
	[SonderKonstantesFeld15] [varchar](50) NULL,
	[LiBKonstantesFeld15] [int] NULL,
	[ColumnKonstantesFeld16] [int] NULL,
	[LaengeKonstantesFeld16] [int] NULL,
	[SonderKonstantesFeld16] [varchar](50) NULL,
	[LiBKonstantesFeld16] [int] NULL,
	[ColumnKonstantesFeld17] [int] NULL,
	[LaengeKonstantesFeld17] [int] NULL,
	[SonderKonstantesFeld17] [varchar](50) NULL,
	[LiBKonstantesFeld17] [int] NULL,
	[ColumnKonstantesFeld18] [int] NULL,
	[LaengeKonstantesFeld18] [int] NULL,
	[SonderKonstantesFeld18] [varchar](50) NULL,
	[LiBKonstantesFeld18] [int] NULL,
	[ColumnKonstantesFeld19] [int] NULL,
	[LaengeKonstantesFeld19] [int] NULL,
	[SonderKonstantesFeld19] [varchar](50) NULL,
	[LiBKonstantesFeld19] [int] NULL,
	[ColumnKonstantesFeld20] [int] NULL,
	[LaengeKonstantesFeld20] [int] NULL,
	[SonderKonstantesFeld20] [varchar](50) NULL,
	[LiBKonstantesFeld20] [int] NULL,
	[ColumnKonstantesFeld21] [int] NULL,
	[LaengeKonstantesFeld21] [int] NULL,
	[SonderKonstantesFeld21] [varchar](50) NULL,
	[LiBKonstantesFeld21] [int] NULL,
	[ColumnKonstantesFeld22] [int] NULL,
	[LaengeKonstantesFeld22] [int] NULL,
	[SonderKonstantesFeld22] [varchar](50) NULL,
	[LiBKonstantesFeld22] [int] NULL,
	[ColumnKonstantesFeld23] [int] NULL,
	[LaengeKonstantesFeld23] [int] NULL,
	[SonderKonstantesFeld23] [varchar](50) NULL,
	[LiBKonstantesFeld23] [int] NULL,
	[ColumnKonstantesFeld24] [int] NULL,
	[LaengeKonstantesFeld24] [int] NULL,
	[SonderKonstantesFeld24] [varchar](50) NULL,
	[LiBKonstantesFeld24] [int] NULL,
	[ColumnKonstantesFeld25] [int] NULL,
	[LaengeKonstantesFeld25] [int] NULL,
	[SonderKonstantesFeld25] [varchar](50) NULL,
	[LiBKonstantesFeld25] [int] NULL,
	[ColumnKonstantesFeld26] [int] NULL,
	[LaengeKonstantesFeld26] [int] NULL,
	[SonderKonstantesFeld26] [varchar](50) NULL,
	[LiBKonstantesFeld26] [int] NULL,
	[ColumnKonstantesFeld27] [int] NULL,
	[LaengeKonstantesFeld27] [int] NULL,
	[SonderKonstantesFeld27] [varchar](50) NULL,
	[LiBKonstantesFeld27] [int] NULL,
	[ColumnKonstantesFeld28] [int] NULL,
	[LaengeKonstantesFeld28] [int] NULL,
	[SonderKonstantesFeld28] [varchar](50) NULL,
	[LiBKonstantesFeld28] [int] NULL,
	[ColumnKonstantesFeld29] [int] NULL,
	[LaengeKonstantesFeld29] [int] NULL,
	[SonderKonstantesFeld29] [varchar](50) NULL,
	[LiBKonstantesFeld29] [int] NULL,
	[ColumnKonstantesFeld30] [int] NULL,
	[LaengeKonstantesFeld30] [int] NULL,
	[SonderKonstantesFeld30] [varchar](50) NULL,
	[LiBKonstantesFeld30] [int] NULL,
	[ColumnKonstantesFeld31] [int] NULL,
	[LaengeKonstantesFeld31] [int] NULL,
	[SonderKonstantesFeld31] [varchar](50) NULL,
	[LiBKonstantesFeld31] [int] NULL,
	[ColumnKonstantesFeld32] [int] NULL,
	[LaengeKonstantesFeld32] [int] NULL,
	[SonderKonstantesFeld32] [varchar](50) NULL,
	[LiBKonstantesFeld32] [int] NULL,
	[ColumnKonstantesFeld33] [int] NULL,
	[LaengeKonstantesFeld33] [int] NULL,
	[SonderKonstantesFeld33] [varchar](50) NULL,
	[LiBKonstantesFeld33] [int] NULL,
	[ColumnKonstantesFeld34] [int] NULL,
	[LaengeKonstantesFeld34] [int] NULL,
	[SonderKonstantesFeld34] [varchar](50) NULL,
	[LiBKonstantesFeld34] [int] NULL,
	[ColumnKonstantesFeld35] [int] NULL,
	[LaengeKonstantesFeld35] [int] NULL,
	[SonderKonstantesFeld35] [varchar](50) NULL,
	[LiBKonstantesFeld35] [int] NULL,
	[ColumnKonstantesFeld36] [int] NULL,
	[LaengeKonstantesFeld36] [int] NULL,
	[SonderKonstantesFeld36] [varchar](50) NULL,
	[LiBKonstantesFeld36] [int] NULL,
	[ColumnKonstantesFeld37] [int] NULL,
	[LaengeKonstantesFeld37] [int] NULL,
	[SonderKonstantesFeld37] [varchar](50) NULL,
	[LiBKonstantesFeld37] [int] NULL,
	[ColumnKonstantesFeld38] [int] NULL,
	[LaengeKonstantesFeld38] [int] NULL,
	[SonderKonstantesFeld38] [varchar](50) NULL,
	[LiBKonstantesFeld38] [int] NULL,
	[ColumnKonstantesFeld39] [int] NULL,
	[LaengeKonstantesFeld39] [int] NULL,
	[SonderKonstantesFeld39] [varchar](50) NULL,
	[LiBKonstantesFeld39] [int] NULL,
	[ColumnKonstantesFeld40] [int] NULL,
	[LaengeKonstantesFeld40] [int] NULL,
	[SonderKonstantesFeld40] [varchar](50) NULL,
	[LiBKonstantesFeld40] [int] NULL,
	[KopfDatensatzEinfuegen] [int] NULL,
	[ColumnBetrag2] [int] NULL,
	[LaengeBetrag2] [int] NULL,
	[SonderBetrag2] [varchar](50) NULL,
	[LiBBetrag2] [int] NULL,
	[VorzeichenPMMinus] [int] NULL,
	[BetraegeInFremdwaehrung] [int] NULL,
	[ColumnCurrencyFactor] [int] NULL,
	[LaengeCurrencyFactor] [int] NULL,
	[SonderCurrencyFactor] [varchar](50) NULL,
	[LiBCurrencyFactor] [int] NULL,
 CONSTRAINT [PK_BuchhaltungsExportDeb] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BuchhaltungsExportKasse]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BuchhaltungsExportKasse](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExportName] [varchar](50) NULL,
	[ColumnKonto] [int] NULL,
	[ColumnGegenKonto] [int] NULL,
	[ColumnDebitorenname] [int] NULL,
	[ColumnBetrag] [int] NULL,
	[ColumnBelegdatum] [int] NULL,
	[ColumnBelegnummer] [int] NULL,
	[ColumnBuchungstext] [int] NULL,
	[ColumnWaehrungsKN] [int] NULL,
	[ColumnKostenstelle] [int] NULL,
	[ColumnKostentraeger] [int] NULL,
	[ColumnFaelligBis] [int] NULL,
	[ColumnSkonto1] [int] NULL,
	[ColumnSkontofrist1] [int] NULL,
	[ColumnSkonto2] [int] NULL,
	[ColumnSkontofrist2] [int] NULL,
	[ColumnLeerFeld01] [int] NULL,
	[ColumnLeerFeld02] [int] NULL,
	[ColumnLeerFeld03] [int] NULL,
	[ColumnLeerFeld04] [int] NULL,
	[ColumnLeerFeld05] [int] NULL,
	[ColumnSteuerkennziffer] [int] NULL,
	[ColumnSollHabenKN] [int] NULL,
	[ColumnZahlungstyp] [int] NULL,
	[LaengeKonto] [int] NULL,
	[LaengeGegenKonto] [int] NULL,
	[LaengeDebitorenname] [int] NULL,
	[LaengeBetrag] [int] NULL,
	[LaengeBelegdatum] [int] NULL,
	[LaengeBelegnummer] [int] NULL,
	[LaengeBuchungstext] [int] NULL,
	[LaengeWaehrungsKN] [int] NULL,
	[LaengeKostenstelle] [int] NULL,
	[LaengeKostentraeger] [int] NULL,
	[LaengeFaelligBis] [int] NULL,
	[LaengeSkonto1] [int] NULL,
	[LaengeSkontofrist1] [int] NULL,
	[LaengeSkonto2] [int] NULL,
	[LaengeSkontofrist2] [int] NULL,
	[LaengeLeerFeld01] [int] NULL,
	[LaengeLeerFeld02] [int] NULL,
	[LaengeLeerFeld03] [int] NULL,
	[LaengeLeerFeld04] [int] NULL,
	[LaengeLeerFeld05] [int] NULL,
	[LaengeSteuerkennziffer] [int] NULL,
	[LaengeSollHabenKN] [int] NULL,
	[LaengeZahlungstyp] [int] NULL,
	[SonderKonto] [varchar](50) NULL,
	[SonderGegenkonto] [varchar](50) NULL,
	[SonderDebitorenname] [varchar](50) NULL,
	[SonderBetrag] [varchar](50) NULL,
	[SonderBelegdatum] [varchar](50) NULL,
	[SonderBelegnummer] [varchar](50) NULL,
	[SonderBuchungstext] [varchar](50) NULL,
	[SonderWaehrungsKN] [varchar](50) NULL,
	[SonderKostenstelle] [varchar](50) NULL,
	[SonderKostentraeger] [varchar](50) NULL,
	[SonderFaelligBis] [varchar](50) NULL,
	[SonderSkonto1] [varchar](50) NULL,
	[SonderSkontofrist1] [varchar](50) NULL,
	[SonderSkonto2] [varchar](50) NULL,
	[SonderSkontofrist2] [varchar](50) NULL,
	[SonderLeerFeld01] [varchar](50) NULL,
	[SonderLeeFeld02] [varchar](50) NULL,
	[SonderLeerFeld03] [varchar](50) NULL,
	[SonderLeerFeld04] [varchar](50) NULL,
	[SonderLeerFeld05] [varchar](50) NULL,
	[SonderSteuerkennziffer] [varchar](50) NULL,
	[SonderSollHabenKN] [varchar](50) NULL,
	[SonderZahlungstyp] [varchar](50) NULL,
	[LetzteAenderung] [varchar](50) NULL,
	[LetzteAenderung_Am] [datetime] NULL,
	[QuellDaten] [varchar](5000) NULL,
	[Trennzeichen] [varchar](50) NULL,
	[Betrag] [varchar](50) NULL,
	[VorzeichenSH] [int] NULL,
	[VorzeichenPM] [int] NULL,
	[DatumsFormat] [int] NULL,
	[FileName] [varchar](50) NULL,
	[FileExtension] [varchar](50) NULL,
	[IgnorZeichenLaenge] [int] NULL,
	[SonderLeerFeld02] [varchar](50) NULL,
	[FuehrendesDKS] [int] NULL,
	[ColumnBuchungsart] [int] NULL,
	[LaengeBuchungsArt] [int] NULL,
	[SonderBuchungsArt] [varchar](50) NULL,
	[BuchungsArtText] [varchar](50) NULL,
	[LiBKonto] [int] NULL,
	[LiBGegenKonto] [int] NULL,
	[LiBDebitorenname] [int] NULL,
	[LiBBetrag] [int] NULL,
	[LiBBelegdatum] [int] NULL,
	[LiBBelegnummer] [int] NULL,
	[LiBBuchungstext] [int] NULL,
	[LiBWaehrungsKN] [int] NULL,
	[LiBKostenstelle] [int] NULL,
	[LiBKostentraeger] [int] NULL,
	[LiBFaelligBis] [int] NULL,
	[LiBSkonto1] [int] NULL,
	[LiBSkontofrist1] [int] NULL,
	[LiBSkonto2] [int] NULL,
	[LiBSkontofrist2] [int] NULL,
	[LiBLeerFeld01] [int] NULL,
	[LiBLeerFeld02] [int] NULL,
	[LiBLeerFeld03] [int] NULL,
	[LiBLeerFeld04] [int] NULL,
	[LiBLeerFeld05] [int] NULL,
	[LiBSteuerkennziffer] [int] NULL,
	[LiBBuchungsArt] [int] NULL,
	[LiBZahlungstyp] [int] NULL,
	[DestPath] [varchar](100) NULL,
	[Splittung] [int] NULL,
	[Umlaute] [int] NULL,
	[BelegNrSonderZ] [int] NULL,
	[ColumnBetragNetto] [int] NULL,
	[LaengeBetragNetto] [int] NULL,
	[SonderBetragNetto] [varchar](50) NULL,
	[LiBBetragNetto] [int] NULL,
	[RadKennung] [int] NULL,
	[FaelligAmTagDatum] [int] NULL,
	[ColumnEK] [int] NULL,
	[ColumnProjektnummer] [int] NULL,
	[ColumnBuchhaltungsnummer] [int] NULL,
	[LaengeEK] [int] NULL,
	[LaengeProjektnummer] [int] NULL,
	[LaengeBuchhaltungsnummer] [int] NULL,
	[SonderEK] [varchar](50) NULL,
	[SonderProjektnummer] [varchar](50) NULL,
	[SonderBuchhaltungsnummer] [varchar](50) NULL,
	[LiBEK] [int] NULL,
	[LiBProjektnummer] [int] NULL,
	[LiBBuchhaltungsnummer] [int] NULL,
	[FuehrendeNullen] [int] NULL,
	[Status] [int] NULL,
	[DateiHeader] [varchar](255) NULL,
	[ColumnKonstantesFeld01] [int] NULL,
	[LaengeKonstantesFeld01] [int] NULL,
	[SonderKonstantesFeld01] [varchar](50) NULL,
	[LiBKonstantesFeld01] [int] NULL,
	[ColumnMwstSatz] [int] NULL,
	[LaengeMwstSatz] [int] NULL,
	[SonderMwstSatz] [varchar](50) NULL,
	[LiBMwstSatz] [int] NULL,
	[ColumnMwstBetrag] [int] NULL,
	[LaengeMwstBetrag] [int] NULL,
	[SonderMwstBetrag] [varchar](50) NULL,
	[LiBMwstBetrag] [int] NULL,
	[ColumnBuchungsperiode] [int] NULL,
	[LaengeBuchungsperiode] [int] NULL,
	[SonderBuchungsperiode] [varchar](50) NULL,
	[LiBBuchungsperiode] [int] NULL,
	[ColumnBuchungsjahr] [int] NULL,
	[LaengeBuchungsjahr] [int] NULL,
	[SonderBuchungsjahr] [varchar](50) NULL,
	[LiBBuchungsjahr] [int] NULL,
	[ColumnKonstantesFeld02] [int] NULL,
	[LaengeKonstantesFeld02] [int] NULL,
	[SonderKonstantesFeld02] [varchar](50) NULL,
	[LiBKonstantesFeld02] [int] NULL,
	[ColumnKonstantesFeld03] [int] NULL,
	[LaengeKonstantesFeld03] [int] NULL,
	[SonderKonstantesFeld03] [varchar](50) NULL,
	[LiBKonstantesFeld03] [int] NULL,
	[ColumnRechnungsnummer] [int] NULL,
	[LaengeRechnungsnummer] [int] NULL,
	[SonderRechnungsnummer] [varchar](50) NULL,
	[LiBRechnungsnummer] [int] NULL,
	[ExportNullRechnungen] [int] NULL,
	[ExportAbwEmpfaenger] [int] NULL,
	[Dezimaltrennzeichen] [varchar](5) NULL,
	[ColumnSollHabenKennzeichen] [int] NULL,
	[LaengeSollHabenKennzeichen] [int] NULL,
	[SonderSollHabenKennzeichen] [varchar](50) NULL,
	[LiBSollHabenKennzeichen] [int] NULL,
	[ColumnBuchungsdatum] [int] NULL,
	[LaengeBuchungsdatum] [int] NULL,
	[SonderBuchungsdatum] [varchar](50) NULL,
	[LiBBuchungsdatum] [int] NULL,
	[ColumnKonstantesFeld04] [int] NULL,
	[LaengeKonstantesFeld04] [int] NULL,
	[SonderKonstantesFeld04] [varchar](50) NULL,
	[LiBKonstantesFeld04] [int] NULL,
	[ColumnKonstantesFeld05] [int] NULL,
	[LaengeKonstantesFeld05] [int] NULL,
	[SonderKonstantesFeld05] [varchar](50) NULL,
	[LiBKonstantesFeld05] [int] NULL,
	[ColumnKonstantesFeld06] [int] NULL,
	[LaengeKonstantesFeld06] [int] NULL,
	[SonderKonstantesFeld06] [varchar](50) NULL,
	[LiBKonstantesFeld06] [int] NULL,
	[ColumnKonstantesFeld07] [int] NULL,
	[LaengeKonstantesFeld07] [int] NULL,
	[SonderKonstantesFeld07] [varchar](50) NULL,
	[LiBKonstantesFeld07] [int] NULL,
	[ColumnKonstantesFeld08] [int] NULL,
	[LaengeKonstantesFeld08] [int] NULL,
	[SonderKonstantesFeld08] [varchar](50) NULL,
	[LiBKonstantesFeld08] [int] NULL,
	[ColumnKonstantesFeld09] [int] NULL,
	[LaengeKonstantesFeld09] [int] NULL,
	[SonderKonstantesFeld09] [varchar](50) NULL,
	[LiBKonstantesFeld09] [int] NULL,
	[ColumnKonstantesFeld10] [int] NULL,
	[LaengeKonstantesFeld10] [int] NULL,
	[SonderKonstantesFeld10] [varchar](50) NULL,
	[LiBKonstantesFeld10] [int] NULL,
	[ColumnKonstantesFeld11] [int] NULL,
	[LaengeKonstantesFeld11] [int] NULL,
	[SonderKonstantesFeld11] [varchar](50) NULL,
	[LiBKonstantesFeld11] [int] NULL,
	[ColumnKonstantesFeld12] [int] NULL,
	[LaengeKonstantesFeld12] [int] NULL,
	[SonderKonstantesFeld12] [varchar](50) NULL,
	[LiBKonstantesFeld12] [int] NULL,
	[ColumnKonstantesFeld13] [int] NULL,
	[LaengeKonstantesFeld13] [int] NULL,
	[SonderKonstantesFeld13] [varchar](50) NULL,
	[LiBKonstantesFeld13] [int] NULL,
	[ColumnKonstantesFeld14] [int] NULL,
	[LaengeKonstantesFeld14] [int] NULL,
	[SonderKonstantesFeld14] [varchar](50) NULL,
	[LiBKonstantesFeld14] [int] NULL,
	[ColumnKonstantesFeld15] [int] NULL,
	[LaengeKonstantesFeld15] [int] NULL,
	[SonderKonstantesFeld15] [varchar](50) NULL,
	[LiBKonstantesFeld15] [int] NULL,
	[ColumnKonstantesFeld16] [int] NULL,
	[LaengeKonstantesFeld16] [int] NULL,
	[SonderKonstantesFeld16] [varchar](50) NULL,
	[LiBKonstantesFeld16] [int] NULL,
	[ColumnKonstantesFeld17] [int] NULL,
	[LaengeKonstantesFeld17] [int] NULL,
	[SonderKonstantesFeld17] [varchar](50) NULL,
	[LiBKonstantesFeld17] [int] NULL,
	[ColumnKonstantesFeld18] [int] NULL,
	[LaengeKonstantesFeld18] [int] NULL,
	[SonderKonstantesFeld18] [varchar](50) NULL,
	[LiBKonstantesFeld18] [int] NULL,
	[ColumnKonstantesFeld19] [int] NULL,
	[LaengeKonstantesFeld19] [int] NULL,
	[SonderKonstantesFeld19] [varchar](50) NULL,
	[LiBKonstantesFeld19] [int] NULL,
	[ColumnKonstantesFeld20] [int] NULL,
	[LaengeKonstantesFeld20] [int] NULL,
	[SonderKonstantesFeld20] [varchar](50) NULL,
	[LiBKonstantesFeld20] [int] NULL,
	[ColumnKonstantesFeld21] [int] NULL,
	[LaengeKonstantesFeld21] [int] NULL,
	[SonderKonstantesFeld21] [varchar](50) NULL,
	[LiBKonstantesFeld21] [int] NULL,
	[ColumnKonstantesFeld22] [int] NULL,
	[LaengeKonstantesFeld22] [int] NULL,
	[SonderKonstantesFeld22] [varchar](50) NULL,
	[LiBKonstantesFeld22] [int] NULL,
	[ColumnKonstantesFeld23] [int] NULL,
	[LaengeKonstantesFeld23] [int] NULL,
	[SonderKonstantesFeld23] [varchar](50) NULL,
	[LiBKonstantesFeld23] [int] NULL,
	[ColumnKonstantesFeld24] [int] NULL,
	[LaengeKonstantesFeld24] [int] NULL,
	[SonderKonstantesFeld24] [varchar](50) NULL,
	[LiBKonstantesFeld24] [int] NULL,
	[ColumnKonstantesFeld25] [int] NULL,
	[LaengeKonstantesFeld25] [int] NULL,
	[SonderKonstantesFeld25] [varchar](50) NULL,
	[LiBKonstantesFeld25] [int] NULL,
	[ColumnKonstantesFeld26] [int] NULL,
	[LaengeKonstantesFeld26] [int] NULL,
	[SonderKonstantesFeld26] [varchar](50) NULL,
	[LiBKonstantesFeld26] [int] NULL,
	[ColumnKonstantesFeld27] [int] NULL,
	[LaengeKonstantesFeld27] [int] NULL,
	[SonderKonstantesFeld27] [varchar](50) NULL,
	[LiBKonstantesFeld27] [int] NULL,
	[ColumnKonstantesFeld28] [int] NULL,
	[LaengeKonstantesFeld28] [int] NULL,
	[SonderKonstantesFeld28] [varchar](50) NULL,
	[LiBKonstantesFeld28] [int] NULL,
	[ColumnKonstantesFeld29] [int] NULL,
	[LaengeKonstantesFeld29] [int] NULL,
	[SonderKonstantesFeld29] [varchar](50) NULL,
	[LiBKonstantesFeld29] [int] NULL,
	[ColumnKonstantesFeld30] [int] NULL,
	[LaengeKonstantesFeld30] [int] NULL,
	[SonderKonstantesFeld30] [varchar](50) NULL,
	[LiBKonstantesFeld30] [int] NULL,
	[ColumnKonstantesFeld31] [int] NULL,
	[LaengeKonstantesFeld31] [int] NULL,
	[SonderKonstantesFeld31] [varchar](50) NULL,
	[LiBKonstantesFeld31] [int] NULL,
	[ColumnKonstantesFeld32] [int] NULL,
	[LaengeKonstantesFeld32] [int] NULL,
	[SonderKonstantesFeld32] [varchar](50) NULL,
	[LiBKonstantesFeld32] [int] NULL,
	[ColumnKonstantesFeld33] [int] NULL,
	[LaengeKonstantesFeld33] [int] NULL,
	[SonderKonstantesFeld33] [varchar](50) NULL,
	[LiBKonstantesFeld33] [int] NULL,
	[ColumnKonstantesFeld34] [int] NULL,
	[LaengeKonstantesFeld34] [int] NULL,
	[SonderKonstantesFeld34] [varchar](50) NULL,
	[LiBKonstantesFeld34] [int] NULL,
	[ColumnKonstantesFeld35] [int] NULL,
	[LaengeKonstantesFeld35] [int] NULL,
	[SonderKonstantesFeld35] [varchar](50) NULL,
	[LiBKonstantesFeld35] [int] NULL,
	[ColumnKonstantesFeld36] [int] NULL,
	[LaengeKonstantesFeld36] [int] NULL,
	[SonderKonstantesFeld36] [varchar](50) NULL,
	[LiBKonstantesFeld36] [int] NULL,
	[ColumnKonstantesFeld37] [int] NULL,
	[LaengeKonstantesFeld37] [int] NULL,
	[SonderKonstantesFeld37] [varchar](50) NULL,
	[LiBKonstantesFeld37] [int] NULL,
	[ColumnKonstantesFeld38] [int] NULL,
	[LaengeKonstantesFeld38] [int] NULL,
	[SonderKonstantesFeld38] [varchar](50) NULL,
	[LiBKonstantesFeld38] [int] NULL,
	[ColumnKonstantesFeld39] [int] NULL,
	[LaengeKonstantesFeld39] [int] NULL,
	[SonderKonstantesFeld39] [varchar](50) NULL,
	[LiBKonstantesFeld39] [int] NULL,
	[ColumnKonstantesFeld40] [int] NULL,
	[LaengeKonstantesFeld40] [int] NULL,
	[SonderKonstantesFeld40] [varchar](50) NULL,
	[LiBKonstantesFeld40] [int] NULL,
	[KopfDatensatzEinfuegen] [int] NULL,
	[ColumnBetrag2] [int] NULL,
	[LaengeBetrag2] [int] NULL,
	[SonderBetrag2] [varchar](50) NULL,
	[LiBBetrag2] [int] NULL,
	[VorzeichenPMMinus] [int] NULL,
	[BetraegeInFremdwaehrung] [int] NULL,
	[ColumnCurrencyFactor] [int] NULL,
	[LaengeCurrencyFactor] [int] NULL,
	[SonderCurrencyFactor] [varchar](50) NULL,
	[LiBCurrencyFactor] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BuchhaltungsExportKred]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BuchhaltungsExportKred](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExportName] [varchar](50) NULL,
	[ColumnKonto] [int] NULL,
	[ColumnGegenKonto] [int] NULL,
	[ColumnKreditorenname] [int] NULL,
	[ColumnBetrag] [int] NULL,
	[ColumnBelegdatum] [int] NULL,
	[ColumnBelegnummer] [int] NULL,
	[ColumnBuchungstext] [int] NULL,
	[ColumnWaehrungsKN] [int] NULL,
	[ColumnKostenstelle] [int] NULL,
	[ColumnKostentraeger] [int] NULL,
	[ColumnFaelligBis] [int] NULL,
	[ColumnSkonto1] [int] NULL,
	[ColumnSkontofrist1] [int] NULL,
	[ColumnSkonto2] [int] NULL,
	[ColumnSkontofrist2] [int] NULL,
	[ColumnLeerFeld01] [int] NULL,
	[ColumnLeerFeld02] [int] NULL,
	[ColumnLeerFeld03] [int] NULL,
	[ColumnLeerFeld04] [int] NULL,
	[ColumnLeerFeld05] [int] NULL,
	[ColumnSteuerkennziffer] [int] NULL,
	[ColumnBuchungsArt] [int] NULL,
	[LaengeKonto] [int] NULL,
	[LaengeGegenKonto] [int] NULL,
	[LaengeKreditorenname] [int] NULL,
	[LaengeBetrag] [int] NULL,
	[LaengeBelegdatum] [int] NULL,
	[LaengeBelegnummer] [int] NULL,
	[LaengeBuchungstext] [int] NULL,
	[LaengeWaehrungsKN] [int] NULL,
	[LaengeKostenstelle] [int] NULL,
	[LaengeKostentraeger] [int] NULL,
	[LaengeFaelligBis] [int] NULL,
	[LaengeSkonto1] [int] NULL,
	[LaengeSkontofrist1] [int] NULL,
	[LaengeSkonto2] [int] NULL,
	[LaengeSkontofrist2] [int] NULL,
	[LaengeLeerFeld01] [int] NULL,
	[LaengeLeerFeld02] [int] NULL,
	[LaengeLeerFeld03] [int] NULL,
	[LaengeLeerFeld04] [int] NULL,
	[LaengeLeerFeld05] [int] NULL,
	[LaengeSteuerkennziffer] [int] NULL,
	[LaengeBuchungsArt] [int] NULL,
	[SonderKonto] [varchar](50) NULL,
	[SonderGegenkonto] [varchar](50) NULL,
	[SonderKreditorenname] [varchar](50) NULL,
	[SonderBetrag] [varchar](50) NULL,
	[SonderBelegdatum] [varchar](50) NULL,
	[SonderBelegnummer] [varchar](50) NULL,
	[SonderBuchungstext] [varchar](50) NULL,
	[SonderWaehrungsKN] [varchar](50) NULL,
	[SonderKostenstelle] [varchar](50) NULL,
	[SonderKostentraeger] [varchar](50) NULL,
	[SonderFaelligBis] [varchar](50) NULL,
	[SonderSkonto1] [varchar](50) NULL,
	[SonderSkontofrist1] [varchar](50) NULL,
	[SonderSkonto2] [varchar](50) NULL,
	[SonderSkontofrist2] [varchar](50) NULL,
	[SonderLeerFeld01] [varchar](50) NULL,
	[SonderLeerFeld02] [varchar](50) NULL,
	[SonderLeerFeld03] [varchar](50) NULL,
	[SonderLeerFeld04] [varchar](50) NULL,
	[SonderLeerFeld05] [varchar](50) NULL,
	[SonderSteuerkennziffer] [varchar](50) NULL,
	[SonderBuchungsArt] [varchar](50) NULL,
	[LiBKonto] [int] NULL,
	[LiBGegenKonto] [int] NULL,
	[LiBKreditorenname] [int] NULL,
	[LiBBetrag] [int] NULL,
	[LiBBelegdatum] [int] NULL,
	[LiBBelegnummer] [int] NULL,
	[LiBBuchungstext] [int] NULL,
	[LiBWaehrungsKN] [int] NULL,
	[LiBKostenstelle] [int] NULL,
	[LiBKostentraeger] [int] NULL,
	[LiBFaelligBis] [int] NULL,
	[LiBSkonto1] [int] NULL,
	[LiBSkontofrist1] [int] NULL,
	[LiBSkonto2] [int] NULL,
	[LiBSkontofrist2] [int] NULL,
	[LiBLeerFeld01] [int] NULL,
	[LiBLeerFeld02] [int] NULL,
	[LiBLeerFeld03] [int] NULL,
	[LiBLeerFeld04] [int] NULL,
	[LiBLeerFeld05] [int] NULL,
	[LiBSteuerkennziffer] [int] NULL,
	[LiBBuchungsArt] [int] NULL,
	[LetzteAenderung] [varchar](50) NULL,
	[LetzteAenderung_Am] [datetime] NULL,
	[QuellDaten] [varchar](5000) NULL,
	[Trennzeichen] [varchar](50) NULL,
	[Betrag] [varchar](50) NULL,
	[VorzeichenSH] [int] NULL,
	[VorzeichenPM] [int] NULL,
	[DatumsFormat] [int] NULL,
	[FileName] [varchar](50) NULL,
	[FileExtension] [varchar](50) NULL,
	[DestPath] [varchar](100) NULL,
	[IgnorZeichenLaenge] [int] NULL,
	[FuehrendesDKS] [int] NULL,
	[BuchungsArtText] [varchar](50) NULL,
	[Splittung] [int] NULL,
	[Umlaute] [int] NULL,
	[BelegNrSonderZ] [int] NULL,
	[ColumnBetragNetto] [int] NULL,
	[LaengeBetragNetto] [int] NULL,
	[SonderBetragNetto] [varchar](50) NULL,
	[LiBBetragNetto] [int] NULL,
	[SteuerSep] [int] NULL,
	[ColumnDebitorenname] [int] NULL,
	[ColumnSollHabenKN] [int] NULL,
	[LaengeDebitorenname] [int] NULL,
	[LaengeSkotnofrist2] [int] NULL,
	[LaengeSollHabenKN] [int] NULL,
	[SonderDebitorenname] [varchar](50) NULL,
	[SonderSollHabenKN] [varchar](50) NULL,
	[ColumnZahlungstyp] [int] NULL,
	[LaengeZahlungstyp] [int] NULL,
	[SonderZahlungstyp] [varchar](50) NULL,
	[LiBZahlungstyp] [int] NULL,
	[RadKennung] [int] NULL,
	[FaelligAmTagDatum] [int] NULL,
	[FuehrendeNullen] [int] NULL,
	[DateiHeader] [varchar](255) NULL,
	[ColumnKonstantesFeld01] [int] NULL,
	[LaengeKonstantesFeld01] [int] NULL,
	[SonderKonstantesFeld01] [varchar](50) NULL,
	[LiBKonstantesFeld01] [int] NULL,
	[ColumnMwstSatz] [int] NULL,
	[LaengeMwstSatz] [int] NULL,
	[SonderMwstSatz] [varchar](50) NULL,
	[LiBMwstSatz] [int] NULL,
	[ColumnMwstBetrag] [int] NULL,
	[LaengeMwstBetrag] [int] NULL,
	[SonderMwstBetrag] [varchar](50) NULL,
	[LiBMwstBetrag] [int] NULL,
	[ColumnBuchungsperiode] [int] NULL,
	[LaengeBuchungsperiode] [int] NULL,
	[SonderBuchungsperiode] [varchar](50) NULL,
	[LiBBuchungsperiode] [int] NULL,
	[ColumnBuchungsjahr] [int] NULL,
	[LaengeBuchungsjahr] [int] NULL,
	[SonderBuchungsjahr] [varchar](50) NULL,
	[LiBBuchungsjahr] [int] NULL,
	[ColumnKonstantesFeld02] [int] NULL,
	[LaengeKonstantesFeld02] [int] NULL,
	[SonderKonstantesFeld02] [varchar](50) NULL,
	[LiBKonstantesFeld02] [int] NULL,
	[ColumnKonstantesFeld03] [int] NULL,
	[LaengeKonstantesFeld03] [int] NULL,
	[SonderKonstantesFeld03] [varchar](50) NULL,
	[LiBKonstantesFeld03] [int] NULL,
	[ColumnRechnungsnummer] [int] NULL,
	[LaengeRechnungsnummer] [int] NULL,
	[SonderRechnungsnummer] [varchar](50) NULL,
	[LiBRechnungsnummer] [int] NULL,
	[ColumnWEKalkNummer] [int] NULL,
	[LaengeWEKalkNummer] [int] NULL,
	[SonderWEKalkNummer] [varchar](50) NULL,
	[LiBWEKalkNummer] [int] NULL,
	[Dezimaltrennzeichen] [varchar](5) NULL,
	[ColumnSollHabenKennzeichen] [int] NULL,
	[LaengeSollHabenKennzeichen] [int] NULL,
	[SonderSollHabenKennzeichen] [varchar](50) NULL,
	[LiBSollHabenKennzeichen] [int] NULL,
	[ColumnBuchungsdatum] [int] NULL,
	[LaengeBuchungsdatum] [int] NULL,
	[SonderBuchungsdatum] [varchar](50) NULL,
	[LiBBuchungsdatum] [int] NULL,
	[ColumnKonstantesFeld04] [int] NULL,
	[LaengeKonstantesFeld04] [int] NULL,
	[SonderKonstantesFeld04] [varchar](50) NULL,
	[LiBKonstantesFeld04] [int] NULL,
	[ColumnKonstantesFeld05] [int] NULL,
	[LaengeKonstantesFeld05] [int] NULL,
	[SonderKonstantesFeld05] [varchar](50) NULL,
	[LiBKonstantesFeld05] [int] NULL,
	[ColumnKonstantesFeld06] [int] NULL,
	[LaengeKonstantesFeld06] [int] NULL,
	[SonderKonstantesFeld06] [varchar](50) NULL,
	[LiBKonstantesFeld06] [int] NULL,
	[ColumnKonstantesFeld07] [int] NULL,
	[LaengeKonstantesFeld07] [int] NULL,
	[SonderKonstantesFeld07] [varchar](50) NULL,
	[LiBKonstantesFeld07] [int] NULL,
	[ColumnKonstantesFeld08] [int] NULL,
	[LaengeKonstantesFeld08] [int] NULL,
	[SonderKonstantesFeld08] [varchar](50) NULL,
	[LiBKonstantesFeld08] [int] NULL,
	[ColumnKonstantesFeld09] [int] NULL,
	[LaengeKonstantesFeld09] [int] NULL,
	[SonderKonstantesFeld09] [varchar](50) NULL,
	[LiBKonstantesFeld09] [int] NULL,
	[ColumnKonstantesFeld10] [int] NULL,
	[LaengeKonstantesFeld10] [int] NULL,
	[SonderKonstantesFeld10] [varchar](50) NULL,
	[LiBKonstantesFeld10] [int] NULL,
	[ColumnKonstantesFeld11] [int] NULL,
	[LaengeKonstantesFeld11] [int] NULL,
	[SonderKonstantesFeld11] [varchar](50) NULL,
	[LiBKonstantesFeld11] [int] NULL,
	[ColumnKonstantesFeld12] [int] NULL,
	[LaengeKonstantesFeld12] [int] NULL,
	[SonderKonstantesFeld12] [varchar](50) NULL,
	[LiBKonstantesFeld12] [int] NULL,
	[ColumnKonstantesFeld13] [int] NULL,
	[LaengeKonstantesFeld13] [int] NULL,
	[SonderKonstantesFeld13] [varchar](50) NULL,
	[LiBKonstantesFeld13] [int] NULL,
	[ColumnKonstantesFeld14] [int] NULL,
	[LaengeKonstantesFeld14] [int] NULL,
	[SonderKonstantesFeld14] [varchar](50) NULL,
	[LiBKonstantesFeld14] [int] NULL,
	[ColumnKonstantesFeld15] [int] NULL,
	[LaengeKonstantesFeld15] [int] NULL,
	[SonderKonstantesFeld15] [varchar](50) NULL,
	[LiBKonstantesFeld15] [int] NULL,
	[ColumnKonstantesFeld16] [int] NULL,
	[LaengeKonstantesFeld16] [int] NULL,
	[SonderKonstantesFeld16] [varchar](50) NULL,
	[LiBKonstantesFeld16] [int] NULL,
	[ColumnKonstantesFeld17] [int] NULL,
	[LaengeKonstantesFeld17] [int] NULL,
	[SonderKonstantesFeld17] [varchar](50) NULL,
	[LiBKonstantesFeld17] [int] NULL,
	[ColumnKonstantesFeld18] [int] NULL,
	[LaengeKonstantesFeld18] [int] NULL,
	[SonderKonstantesFeld18] [varchar](50) NULL,
	[LiBKonstantesFeld18] [int] NULL,
	[ColumnKonstantesFeld19] [int] NULL,
	[LaengeKonstantesFeld19] [int] NULL,
	[SonderKonstantesFeld19] [varchar](50) NULL,
	[LiBKonstantesFeld19] [int] NULL,
	[ColumnKonstantesFeld20] [int] NULL,
	[LaengeKonstantesFeld20] [int] NULL,
	[SonderKonstantesFeld20] [varchar](50) NULL,
	[LiBKonstantesFeld20] [int] NULL,
	[ColumnKonstantesFeld21] [int] NULL,
	[LaengeKonstantesFeld21] [int] NULL,
	[SonderKonstantesFeld21] [varchar](50) NULL,
	[LiBKonstantesFeld21] [int] NULL,
	[ColumnKonstantesFeld22] [int] NULL,
	[LaengeKonstantesFeld22] [int] NULL,
	[SonderKonstantesFeld22] [varchar](50) NULL,
	[LiBKonstantesFeld22] [int] NULL,
	[ColumnKonstantesFeld23] [int] NULL,
	[LaengeKonstantesFeld23] [int] NULL,
	[SonderKonstantesFeld23] [varchar](50) NULL,
	[LiBKonstantesFeld23] [int] NULL,
	[ColumnKonstantesFeld24] [int] NULL,
	[LaengeKonstantesFeld24] [int] NULL,
	[SonderKonstantesFeld24] [varchar](50) NULL,
	[LiBKonstantesFeld24] [int] NULL,
	[ColumnKonstantesFeld25] [int] NULL,
	[LaengeKonstantesFeld25] [int] NULL,
	[SonderKonstantesFeld25] [varchar](50) NULL,
	[LiBKonstantesFeld25] [int] NULL,
	[ColumnKonstantesFeld26] [int] NULL,
	[LaengeKonstantesFeld26] [int] NULL,
	[SonderKonstantesFeld26] [varchar](50) NULL,
	[LiBKonstantesFeld26] [int] NULL,
	[ColumnKonstantesFeld27] [int] NULL,
	[LaengeKonstantesFeld27] [int] NULL,
	[SonderKonstantesFeld27] [varchar](50) NULL,
	[LiBKonstantesFeld27] [int] NULL,
	[ColumnKonstantesFeld28] [int] NULL,
	[LaengeKonstantesFeld28] [int] NULL,
	[SonderKonstantesFeld28] [varchar](50) NULL,
	[LiBKonstantesFeld28] [int] NULL,
	[ColumnKonstantesFeld29] [int] NULL,
	[LaengeKonstantesFeld29] [int] NULL,
	[SonderKonstantesFeld29] [varchar](50) NULL,
	[LiBKonstantesFeld29] [int] NULL,
	[ColumnKonstantesFeld30] [int] NULL,
	[LaengeKonstantesFeld30] [int] NULL,
	[SonderKonstantesFeld30] [varchar](50) NULL,
	[LiBKonstantesFeld30] [int] NULL,
	[ColumnKonstantesFeld31] [int] NULL,
	[LaengeKonstantesFeld31] [int] NULL,
	[SonderKonstantesFeld31] [varchar](50) NULL,
	[LiBKonstantesFeld31] [int] NULL,
	[ColumnKonstantesFeld32] [int] NULL,
	[LaengeKonstantesFeld32] [int] NULL,
	[SonderKonstantesFeld32] [varchar](50) NULL,
	[LiBKonstantesFeld32] [int] NULL,
	[ColumnKonstantesFeld33] [int] NULL,
	[LaengeKonstantesFeld33] [int] NULL,
	[SonderKonstantesFeld33] [varchar](50) NULL,
	[LiBKonstantesFeld33] [int] NULL,
	[ColumnKonstantesFeld34] [int] NULL,
	[LaengeKonstantesFeld34] [int] NULL,
	[SonderKonstantesFeld34] [varchar](50) NULL,
	[LiBKonstantesFeld34] [int] NULL,
	[ColumnKonstantesFeld35] [int] NULL,
	[LaengeKonstantesFeld35] [int] NULL,
	[SonderKonstantesFeld35] [varchar](50) NULL,
	[LiBKonstantesFeld35] [int] NULL,
	[ColumnKonstantesFeld36] [int] NULL,
	[LaengeKonstantesFeld36] [int] NULL,
	[SonderKonstantesFeld36] [varchar](50) NULL,
	[LiBKonstantesFeld36] [int] NULL,
	[ColumnKonstantesFeld37] [int] NULL,
	[LaengeKonstantesFeld37] [int] NULL,
	[SonderKonstantesFeld37] [varchar](50) NULL,
	[LiBKonstantesFeld37] [int] NULL,
	[ColumnKonstantesFeld38] [int] NULL,
	[LaengeKonstantesFeld38] [int] NULL,
	[SonderKonstantesFeld38] [varchar](50) NULL,
	[LiBKonstantesFeld38] [int] NULL,
	[ColumnKonstantesFeld39] [int] NULL,
	[LaengeKonstantesFeld39] [int] NULL,
	[SonderKonstantesFeld39] [varchar](50) NULL,
	[LiBKonstantesFeld39] [int] NULL,
	[ColumnKonstantesFeld40] [int] NULL,
	[LaengeKonstantesFeld40] [int] NULL,
	[SonderKonstantesFeld40] [varchar](50) NULL,
	[LiBKonstantesFeld40] [int] NULL,
	[ColumnBetrag2] [int] NULL,
	[LaengeBetrag2] [int] NULL,
	[SonderBetrag2] [varchar](50) NULL,
	[LiBBetrag2] [int] NULL,
	[KopfDatensatzEinfuegen] [int] NULL,
	[VorzeichenPMMinus] [int] NULL,
	[ColumnCurrencyFactor] [int] NULL,
	[LaengeCurrencyFactor] [int] NULL,
	[SonderCurrencyFactor] [varchar](50) NULL,
	[LiBCurrencyFactor] [int] NULL,
	[BetraegeInFremdwaehrung] [int] NULL,
	[ColumnVarFeld1] [int] NULL,
	[LaengeVarFeld1] [int] NULL,
	[SonderVarFeld1] [varchar](50) NULL,
	[LiBVarFeld1] [int] NULL,
 CONSTRAINT [PK__BuchhaltungsExpo__1C5D1EBA] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BuchhaltungsExportSageKHK]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BuchhaltungsExportSageKHK](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KredLetzteAenderung] [varchar](50) NULL,
	[KredLetzteAenderung_Am] [datetime] NULL,
	[KredQuellDaten] [varchar](600) NULL,
	[KredTrennzeichen] [varchar](50) NULL,
	[KredBetrag] [varchar](50) NULL,
	[KredVorzeichenSH] [int] NULL,
	[KredVorzeichenPM] [int] NULL,
	[KredDatumsFormat] [int] NULL,
	[KredFileName] [varchar](50) NULL,
	[KredFileExtension] [varchar](50) NULL,
	[KredDestPath] [varchar](100) NULL,
	[KredFuehrendesDKS] [int] NULL,
	[KredBuchungsArtText] [varchar](50) NULL,
	[KredSplittung] [int] NULL,
	[KredUmlaute] [int] NULL,
	[KredBelegNrSonderZ] [int] NULL,
	[KredSteuerSep] [int] NULL,
	[DebLetzteAenderung] [varchar](50) NULL,
	[DebLetzteAenderung_Am] [datetime] NULL,
	[DebQuellDaten] [varchar](600) NULL,
	[DebTrennzeichen] [varchar](50) NULL,
	[DebBetrag] [varchar](50) NULL,
	[DebVorzeichenSH] [int] NULL,
	[DebVorzeichenPM] [int] NULL,
	[DebDatumsFormat] [int] NULL,
	[DebFileName] [varchar](50) NULL,
	[DebFileExtension] [varchar](50) NULL,
	[DebDestPath] [varchar](100) NULL,
	[DebFuehrendesDKS] [int] NULL,
	[DebBuchungsArtText] [varchar](50) NULL,
	[DebSplittung] [int] NULL,
	[DebUmlaute] [int] NULL,
	[DebBelegNrSonderZ] [int] NULL,
	[RadKennzDeb] [int] NULL,
	[RadKennzKred] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Budget]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Budget](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KostenstelleI3D] [int] NOT NULL,
	[KostenartI3D] [int] NOT NULL,
	[GiltVon] [datetime] NULL,
	[GiltBis] [datetime] NULL,
	[Budget1] [int] NULL,
	[Forecast1] [int] NULL,
	[Budget2] [int] NULL,
	[Forecast2] [int] NULL,
	[Budget3] [int] NULL,
	[Forecast3] [int] NULL,
	[Budget4] [int] NULL,
	[Forecast4] [int] NULL,
	[Budget5] [int] NULL,
	[Forecast5] [int] NULL,
	[Budget6] [int] NULL,
	[Forecast6] [int] NULL,
	[Budget7] [int] NULL,
	[Forecast7] [int] NULL,
	[Budget8] [int] NULL,
	[Forecast8] [int] NULL,
	[Budget9] [int] NULL,
	[Forecast9] [int] NULL,
	[Budget10] [int] NULL,
	[Forecast10] [int] NULL,
	[Budget11] [int] NULL,
	[Forecast11] [int] NULL,
	[Budget12] [int] NULL,
	[Forcast12] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BundeslandFeiertage]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BundeslandFeiertage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BundeslandI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Text] [varchar](500) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CachedTableStatistics]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CachedTableStatistics](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TableName] [nvarchar](500) NOT NULL,
	[LastUpdated] [datetime2](2) NULL,
	[IsUpdateRequested] [bit] NOT NULL,
	[IsUpdating] [bit] NOT NULL,
	[UpdateStartetAt] [datetime2](2) NULL,
	[LastUpdateDurationInMilliseconds] [int] NULL,
 CONSTRAINT [PK_CachedTableStatistics] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CacheMspArticleStatistics]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CacheMspArticleStatistics](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InvoiceI3D] [int] NOT NULL,
	[InvoiceNumber] [int] NOT NULL,
	[InvoiceDate] [datetime2](0) NOT NULL,
	[Kind] [int] NOT NULL,
	[ArticleI3D] [int] NOT NULL,
	[ArticleCode] [nvarchar](60) NOT NULL,
	[ArticleCaption] [nvarchar](150) NOT NULL,
	[RevenueAmount] [numeric](18, 2) NOT NULL,
	[EarningAmount] [numeric](18, 2) NOT NULL,
	[ContractI3D] [int] NULL,
	[ContractNumber] [int] NULL,
	[ContractDate] [datetime2](0) NULL,
	[CustomerNumber] [int] NOT NULL,
	[CustomerName] [nvarchar](255) NOT NULL,
	[Adviser1ShortSign] [nvarchar](50) NULL,
	[Adviser2ShortSign] [nvarchar](5) NULL,
	[BranchName] [nvarchar](255) NOT NULL,
	[Street] [nvarchar](300) NOT NULL,
	[Zip] [nvarchar](50) NOT NULL,
	[City] [nvarchar](50) NOT NULL,
	[Country] [nvarchar](255) NOT NULL,
	[TicketI3D] [int] NULL,
	[TicketNumber] [int] NULL,
	[TicketCaption] [nvarchar](1000) NULL,
	[TargetServiceDurationInSeconds] [int] NULL,
	[ActualServiceDurationInSeconds] [int] NULL,
	[TargetServiceCost] [numeric](18, 2) NULL,
	[ActualServiceCost] [numeric](18, 2) NULL,
	[ServiceExecutedFromEmployeeShortSign] [nvarchar](50) NULL,
	[WorkItemI3D] [int] NULL,
	[DeviceWorkItemCaption] [nvarchar](1000) NULL,
	[DeviceWorkItemCategory] [nvarchar](255) NULL,
	[ContractCaption] [nvarchar](256) NULL,
	[InvoiceQuantity] [decimal](19, 7) NOT NULL,
	[MaterialGroupI3D] [int] NOT NULL,
	[SubMaterialGroupI3D] [int] NULL,
	[MaterialGroupCaption] [nvarchar](250) NOT NULL,
	[SubMaterialGroupCaption] [nvarchar](250) NULL,
	[ArticleCodeGrouped] [nvarchar](60) NOT NULL,
	[ArticleCaptionGrouped] [nvarchar](150) NOT NULL,
 CONSTRAINT [PK_CacheMspArticleStatistics] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CacheOrderStatistic]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CacheOrderStatistic](
	[I3D] [int] NOT NULL,
	[ReceiptI3D] [int] NOT NULL,
	[ReceiptNumber] [int] NOT NULL,
	[ReceiptKind] [nvarchar](50) NOT NULL,
	[CustomerNumber] [int] NOT NULL,
	[AccountName] [nvarchar](4000) NULL,
	[AccountDefaultAddressStreet] [nvarchar](255) NULL,
	[AccountDefaultAddressZip] [nvarchar](10) NULL,
	[AccountDefaultAddressCity] [nvarchar](30) NULL,
	[AccountDefaultAddressCountry] [nvarchar](255) NULL,
	[AccountDefaultContactName] [nvarchar](255) NULL,
	[AccountDefaultContactEmail] [nvarchar](255) NULL,
	[AccountDefaultContactPhone] [nvarchar](30) NULL,
	[Date] [datetime2](0) NOT NULL,
	[Articlecode] [nvarchar](255) NOT NULL,
	[MaterialGroup] [nvarchar](255) NULL,
	[SecondaryMaterialGroup] [nvarchar](255) NULL,
	[OriginalQuantity] [decimal](19, 7) NOT NULL,
	[Quantity] [decimal](19, 7) NOT NULL,
	[OriginalQuantityInHours] [decimal](19, 7) NOT NULL,
	[QuantityInHours] [decimal](19, 7) NOT NULL,
	[OriginalPriceRevenue] [decimal](24, 7) NOT NULL,
	[PriceRevenue] [decimal](24, 7) NOT NULL,
	[OriginalPriceEarning] [decimal](24, 7) NOT NULL,
	[PriceEarning] [decimal](24, 7) NOT NULL,
	[OriginalPriceEarningInProcent] [decimal](19, 4) NOT NULL,
	[PriceEarningInProcent] [decimal](19, 4) NOT NULL,
	[SalesRepresentative] [nvarchar](255) NULL,
	[ArticleManufacturer] [nvarchar](4000) NULL,
	[SalesRepresentativeDepartments] [nvarchar](4000) NULL,
	[ServiceArticleEmployee] [nvarchar](255) NULL,
	[BranchI3D] [int] NOT NULL,
	[BranchName] [nvarchar](255) NOT NULL,
	[AccountAdviser1FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser2FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser3FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser4FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser5FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser6FullName] [nvarchar](255) NOT NULL,
	[OriginalPricePurchasing] [decimal](24, 7) NOT NULL,
	[PricePurchasing] [decimal](24, 7) NOT NULL,
	[CostCentreNumber] [nvarchar](255) NULL,
	[IsAlternativeDeliveryAddress] [bit] NOT NULL,
	[DeliveryAddressZip] [nvarchar](10) NULL,
	[DeliveryAddressCity] [nvarchar](30) NULL,
	[DeliveryAddressCountry] [nvarchar](255) NULL,
	[InvoiceAddressStreet] [nvarchar](255) NULL,
	[InvoiceAddressZip] [nvarchar](10) NULL,
	[InvoiceAddressCity] [nvarchar](30) NULL,
	[InvoiceAddressCountry] [nvarchar](255) NULL,
	[InvoiceContactFirstname] [nvarchar](60) NULL,
	[InvoiceContactLastname] [nvarchar](60) NULL,
	[ContractI3D] [int] NULL,
	[ContractNumber] [int] NULL,
	[ContractCaption] [nvarchar](300) NULL,
	[ContractKindCaption] [nvarchar](300) NULL,
	[ArticleKind] [nvarchar](30) NOT NULL,
	[ArticleNumber] [nvarchar](50) NULL,
	[ArticleI3D] [int] NOT NULL,
	[ReceiptAdviser1ShortSign] [nvarchar](50) NOT NULL,
	[ReceiptAdviser1Departments] [nvarchar](4000) NOT NULL,
	[CompanyGroupI3D] [int] NULL,
	[CompanyGroupName] [nvarchar](255) NULL,
	[SalesAreaCaption] [nvarchar](30) NULL,
	[CustomerOriginCaption] [nvarchar](50) NULL,
	[ProductLine] [nvarchar](50) NOT NULL,
	[PaymentConditionCaption] [nvarchar](255) NULL,
	[UpdatesCashbook] [bit] NOT NULL,
	[ArticleManufacturerCode] [nvarchar](60) NULL,
	[AccountTypes] [nvarchar](4000) NULL,
	[ArticleVariableBoolField1] [bit] NOT NULL,
	[ArticleVariableBoolField2] [bit] NOT NULL,
	[ArticleVariableBoolField3] [bit] NOT NULL,
	[ProductFamily] [nvarchar](255) NULL,
	[ProductFamilyManufacturer] [nvarchar](255) NULL,
	[IsContractArticle] [bit] NOT NULL,
	[BillingIntervalText] [nvarchar](50) NULL,
	[ReceiptUserStateI3D] [int] NULL,
	[ReceiptUserStateCaption] [nvarchar](50) NULL,
	[ReceiptAdviser1FullName] [nvarchar](255) NULL,
	[ReceiptEditorFullName] [nvarchar](255) NULL,
	[RevenueAccount] [int] NULL,
	[CustomerClassification] [nvarchar](50) NULL,
	[IsClosed] [bit] NULL,
 CONSTRAINT [PK_CacheOrderStatistic] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CacheSalesStatistic]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CacheSalesStatistic](
	[I3D] [int] NOT NULL,
	[ReceiptI3D] [int] NOT NULL,
	[ReceiptNumber] [int] NOT NULL,
	[ReceiptKind] [nvarchar](50) NOT NULL,
	[CustomerNumber] [int] NOT NULL,
	[AccountName] [nvarchar](4000) NULL,
	[AccountDefaultAddressStreet] [nvarchar](255) NULL,
	[AccountDefaultAddressZip] [nvarchar](10) NULL,
	[AccountDefaultAddressCity] [nvarchar](30) NULL,
	[AccountDefaultAddressCountry] [nvarchar](255) NULL,
	[AccountDefaultContactName] [nvarchar](255) NULL,
	[AccountDefaultContactEmail] [nvarchar](255) NULL,
	[AccountDefaultContactPhone] [nvarchar](30) NULL,
	[Date] [datetime2](0) NOT NULL,
	[Articlecode] [nvarchar](255) NOT NULL,
	[MaterialGroup] [nvarchar](255) NULL,
	[SecondaryMaterialGroup] [nvarchar](255) NULL,
	[Quantity] [decimal](19, 7) NOT NULL,
	[QuantityInHours] [decimal](19, 7) NOT NULL,
	[PriceRevenue] [decimal](24, 7) NOT NULL,
	[PriceEarning] [decimal](24, 7) NOT NULL,
	[PriceEarningInProcent] [decimal](19, 4) NULL,
	[SalesRepresentative] [nvarchar](255) NULL,
	[ArticleManufacturer] [nvarchar](4000) NULL,
	[SalesRepresentativeDepartments] [nvarchar](4000) NULL,
	[ServiceArticleEmployee] [nvarchar](255) NULL,
	[ServiceClassificationLevel0] [nvarchar](255) NULL,
	[ServiceClassificationLevel1] [nvarchar](255) NULL,
	[ServiceClassificationLevel2] [nvarchar](255) NULL,
	[BranchI3D] [int] NOT NULL,
	[BranchName] [nvarchar](255) NOT NULL,
	[AccountAdviser1FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser2FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser3FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser4FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser5FullName] [nvarchar](255) NOT NULL,
	[AccountAdviser6FullName] [nvarchar](255) NOT NULL,
	[PricePurchasing] [decimal](24, 7) NOT NULL,
	[CostCentreNumber] [nvarchar](255) NULL,
	[IsAlternativeDeliveryAddress] [bit] NOT NULL,
	[DeliveryAddressZip] [nvarchar](10) NULL,
	[DeliveryAddressCity] [nvarchar](30) NULL,
	[DeliveryAddressCountry] [nvarchar](255) NULL,
	[InvoiceAddressStreet] [nvarchar](255) NULL,
	[InvoiceAddressZip] [nvarchar](10) NULL,
	[InvoiceAddressCity] [nvarchar](30) NULL,
	[InvoiceAddressCountry] [nvarchar](255) NULL,
	[InvoiceContactFirstname] [nvarchar](60) NULL,
	[InvoiceContactLastname] [nvarchar](60) NULL,
	[ContractI3D] [int] NULL,
	[ContractNumber] [int] NULL,
	[ContractCaption] [nvarchar](300) NULL,
	[ContractKindCaption] [nvarchar](300) NULL,
	[ArticleKind] [nvarchar](30) NOT NULL,
	[IsContractInvoice] [bit] NOT NULL,
	[ArticleNumber] [nvarchar](50) NULL,
	[ArticleI3D] [int] NOT NULL,
	[ReceiptAdviser1ShortSign] [nvarchar](50) NOT NULL,
	[ReceiptAdviser1Departments] [nvarchar](4000) NOT NULL,
	[CompanyGroupI3D] [int] NULL,
	[CompanyGroupName] [nvarchar](255) NULL,
	[SalesAreaCaption] [nvarchar](30) NULL,
	[CustomerOriginCaption] [nvarchar](50) NULL,
	[ProductLine] [nvarchar](50) NOT NULL,
	[PaymentConditionCaption] [nvarchar](255) NULL,
	[UpdatesCashbook] [bit] NOT NULL,
	[ArticleManufacturerCode] [nvarchar](60) NULL,
	[AccountTypes] [nvarchar](4000) NULL,
	[ArticleVariableBoolField1] [bit] NOT NULL,
	[ArticleVariableBoolField2] [bit] NOT NULL,
	[ArticleVariableBoolField3] [bit] NOT NULL,
	[ProductFamily] [nvarchar](255) NULL,
	[ProductFamilyManufacturer] [nvarchar](255) NULL,
	[IsContractArticle] [bit] NOT NULL,
	[BillingIntervalText] [nvarchar](50) NULL,
	[ReceiptAdviser1FullName] [nvarchar](255) NULL,
	[ReceiptEditorFullName] [nvarchar](255) NULL,
	[RevenueAccount] [int] NULL,
	[CustomerClassification] [nvarchar](50) NULL,
	[BillingPeriodFrom] [datetime2](0) NULL,
	[BillingPeriodTo] [datetime2](0) NULL,
	[BillingPeriodMonthInterval] [int] NULL,
	[AccountCustomTextField01] [nvarchar](255) NULL,
	[AccountCustomDateField01] [datetime2](0) NULL,
	[AccountCustomDateField02] [datetime2](0) NULL,
	[InvoiceContactCustomTextField01] [nvarchar](255) NULL,
	[InvoiceContactCustomTextField02] [nvarchar](255) NULL,
	[MaterialGroupI3D] [int] NULL,
	[SecondaryMaterialGroupI3D] [int] NULL,
 CONSTRAINT [PK_CacheSalesStatistic] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CallTrackingHelpdeskKategorieVorlagen]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CallTrackingHelpdeskKategorieVorlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](255) NULL,
	[HauptkategorieI3D] [int] NULL,
	[Unterkategorie1I3D] [int] NULL,
	[Unterkategorie2I3D] [int] NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignDecisionTemplateTexts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignDecisionTemplateTexts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CampaignI3D] [int] NULL,
	[Text] [nvarchar](1000) NOT NULL,
	[CampaignDecisionKind] [int] NOT NULL,
 CONSTRAINT [PK_CampaignDecisionTemplateTexts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignEmployees]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignEmployees](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CampaignI3D] [int] NOT NULL,
	[CampaignParticipantI3D] [int] NULL,
	[EmployeeI3D] [int] NOT NULL,
	[IsAdmin] [bit] NOT NULL,
	[CanOnlySeeOwn] [bit] NOT NULL,
 CONSTRAINT [PK_CampaignEmployees] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignMarkers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignMarkers](
	[EmployeeI3D] [int] NOT NULL,
	[CampaignI3D] [int] NOT NULL,
	[CampaignParticipantI3D] [int] NOT NULL,
	[Color] [nvarchar](20) NOT NULL,
	[Hint] [nvarchar](200) NULL,
 CONSTRAINT [PK_CampaignMarkers] PRIMARY KEY CLUSTERED 
(
	[EmployeeI3D] ASC,
	[CampaignI3D] ASC,
	[CampaignParticipantI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignParticipantContactPerson]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignParticipantContactPerson](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CampaignParticipantI3D] [int] NOT NULL,
	[AccountAddressContactI3D] [int] NOT NULL,
	[DecisionKind] [int] NULL,
	[DecisionText] [nvarchar](2000) NULL,
	[CampaignI3D] [int] NOT NULL,
 CONSTRAINT [PK_CampaignParticipantContactPerson] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignParticipants]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignParticipants](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CampaignI3D] [int] NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[AccountAddressI3D] [int] NOT NULL,
	[AccountAddressContactI3D] [int] NOT NULL,
	[DecisionKind] [int] NULL,
	[DecisionText] [nvarchar](1000) NULL,
	[AccountName] [nvarchar](500) NULL,
	[AccountAddressContactName] [nchar](300) NULL,
	[CampaignPhaseI3D] [int] NULL,
 CONSTRAINT [PK_CampaignParticipants] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignPhaseActionExecutes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignPhaseActionExecutes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CampaignPhaseActionI3D] [int] NOT NULL,
	[CampaignParticipantI3D] [int] NOT NULL,
	[AccountAddressContactI3D] [int] NULL,
	[IsExecuted] [bit] NOT NULL,
 CONSTRAINT [PK_CampaignPhaseActionExecutes] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignPhaseActions]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignPhaseActions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CampaignPhaseI3D] [int] NOT NULL,
	[ActionType] [int] NOT NULL,
	[Position] [int] NULL,
	[Name] [nvarchar](255) NULL,
	[Description] [nvarchar](max) NULL,
	[ObjectI3D] [int] NULL,
	[SendReceiptByMail] [bit] NOT NULL,
 CONSTRAINT [PK_CampaignPhaseActions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignPhases]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignPhases](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CampaignI3D] [int] NOT NULL,
	[Position] [int] NULL,
	[Icon] [varbinary](max) NULL,
	[Name] [nvarchar](255) NULL,
	[Description] [nvarchar](max) NULL,
	[AutomaticExecution] [bit] NOT NULL,
 CONSTRAINT [PK_CampaignPhases] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CampaignProcessProperties]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CampaignProcessProperties](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReleaseDate] [datetime] NULL,
	[ParticipantI3D] [int] NOT NULL,
	[CampaignProcessI3D] [int] NOT NULL,
 CONSTRAINT [PK_CampaignProcessProperties] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Campaigns]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Campaigns](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](200) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[StartDate] [datetime2](7) NOT NULL,
	[EndDate] [datetime2](7) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedVersion] [varchar](20) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[ChangedVersion] [varchar](20) NOT NULL,
	[State] [int] NOT NULL,
	[PotentialRevenue] [decimal](18, 2) NOT NULL,
 CONSTRAINT [PK_Campaigns] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronChecklistCustomerMappings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronChecklistCustomerMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChecklistI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[AddressI3D] [int] NULL,
	[AddressContactI3D] [int] NULL,
	[AccountCustomFilterI3D] [int] NULL,
	[RuleType] [int] NOT NULL,
	[DisplayText] [nvarchar](600) NULL,
 CONSTRAINT [PK_CentronChecklistCustomerMappings] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CL_CentronChecklistCustomerMappings]    Script Date: 11.11.2025 11:20:27 ******/
CREATE UNIQUE CLUSTERED INDEX [CL_CentronChecklistCustomerMappings] ON [dbo].[CentronChecklistCustomerMappings]
(
	[ChecklistI3D] ASC,
	[CustomerI3D] ASC,
	[AddressContactI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronChecklistItemLogs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronChecklistItemLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChecklistItemI3D] [int] NULL,
	[Version] [int] NOT NULL,
	[Property] [nvarchar](max) NULL,
	[OldValue] [nvarchar](max) NULL,
	[NewValue] [nvarchar](max) NULL,
	[ChangedByI3D] [int] NULL,
	[ChangedDate] [datetime] NULL,
 CONSTRAINT [PK_CentronChecklistItemLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronChecklistItems]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronChecklistItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](255) NOT NULL,
	[ChecklistI3D] [int] NULL,
	[ParentChecklistItemI3D] [int] NULL,
	[OrderNumber] [int] NOT NULL,
	[Description] [nvarchar](max) NULL,
	[InternalNote] [nvarchar](max) NULL,
	[EditorI3D] [int] NULL,
	[State] [int] NOT NULL,
	[CheckedByI3D] [int] NULL,
	[CheckedDate] [datetime] NULL,
	[DurationTime] [int] NOT NULL,
	[AdHocCreatedBy] [int] NULL,
 CONSTRAINT [PK_CentronChecklistItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronChecklistLogs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronChecklistLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChecklistI3D] [int] NULL,
	[Version] [int] NOT NULL,
	[Property] [nvarchar](max) NULL,
	[OldValue] [nvarchar](max) NULL,
	[NewValue] [nvarchar](max) NULL,
	[ChangedByI3D] [int] NULL,
	[ChangedDate] [datetime] NULL,
 CONSTRAINT [PK_CentronChecklistLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronChecklists]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronChecklists](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](255) NOT NULL,
	[CategoryI3D] [int] NULL,
	[IsTemplate] [bit] NOT NULL,
	[ObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[Description] [nvarchar](max) NULL,
	[IsActive] [bit] NOT NULL,
	[CustomerSearchOption] [int] NOT NULL,
	[ExtendedSearchI3D] [int] NULL,
	[CanCloseHelpdesk] [bit] NOT NULL,
	[OldReferenceChecklistI3D] [int] NULL,
 CONSTRAINT [PK_CentronChecklists] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronConstant]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronConstant](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ConstantTypeI3D] [int] NOT NULL,
	[Caption] [varchar](128) NOT NULL,
	[Value] [int] NOT NULL,
	[Description] [text] NULL,
	[ConstantName] [varchar](256) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronConstantTypen]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronConstantTypen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [varchar](128) NOT NULL,
	[Description] [text] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronDMSDirectory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronDMSDirectory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DirectoryI3D] [int] NOT NULL,
 CONSTRAINT [PK_CentronDMSDirectory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronDMSDirectoryLog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronDMSDirectoryLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [nvarchar](500) NOT NULL,
	[Kind] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ShareEmail] [nvarchar](100) NULL,
	[ShareName] [nvarchar](100) NULL,
	[DocumentKind] [int] NOT NULL,
	[CentronDMSDocumentI3D] [int] NOT NULL,
 CONSTRAINT [PK_CentronDMSDirectoryLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronDMSDirectoryRight]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronDMSDirectoryRight](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CentronDMSDirectoryI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Kind] [int] NOT NULL,
	[IsActive] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
 CONSTRAINT [PK_CentronDMSDirectoryRight] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronDMSDocument]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronDMSDocument](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentI3D] [int] NOT NULL,
	[IsEncrypted] [bit] NOT NULL,
	[PasswordKey] [nvarchar](500) NULL,
 CONSTRAINT [PK_CentronDMSDocument] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronDMSDocumentLog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronDMSDocumentLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [nvarchar](500) NOT NULL,
	[Kind] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ShareEmail] [nvarchar](100) NULL,
	[ShareName] [nvarchar](100) NULL,
	[DocumentKind] [int] NOT NULL,
	[CentronDMSDocumentI3D] [int] NOT NULL,
 CONSTRAINT [PK_CentronDMSDocumentLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronErinnerung]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronErinnerung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Erinnerungstext] [text] NULL,
	[NurAdmin] [int] NULL,
	[Status] [int] NULL,
	[MeldungsTyp] [int] NULL,
	[LogTyp] [int] NULL,
	[Version] [varchar](20) NULL,
	[Datum] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronIcons]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronIcons](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NULL,
	[Description] [nvarchar](500) NULL,
	[Image] [varbinary](max) NOT NULL,
	[CategoryI3D] [int] NULL,
 CONSTRAINT [PK_Icons] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronLog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LogTyp] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Version] [varchar](20) NULL,
	[Status] [int] NULL,
	[Wert] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronNews]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronNews](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FileName] [varchar](100) NULL,
	[FileDatum] [datetime] NULL,
	[FileInhalt] [image] NULL,
	[ErstelltAm] [datetime] NULL,
	[Status] [int] NULL,
	[AutoAnzeigen] [int] NULL,
	[KurzBeschreibung] [varchar](150) NULL,
	[AdminAnzeigen] [int] NULL,
	[FileID] [int] NULL,
	[FileVersion] [varchar](20) NULL,
	[DatumVon] [datetime] NULL,
	[DatumBis] [datetime] NULL,
	[CentronVersionAb] [varchar](20) NULL,
	[CentronVersionBis] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronNewsGelesen]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronNewsGelesen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NewsI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Gelesen] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronNotifications]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronNotifications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[ShortSign] [nvarchar](20) NOT NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NOT NULL,
	[Text] [nvarchar](4000) NOT NULL,
	[LogKind] [int] NOT NULL,
 CONSTRAINT [PK_CentronNotifications] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CU_CentronNotifications_CreatedDate_ObjectKind]    Script Date: 11.11.2025 11:20:27 ******/
CREATE CLUSTERED INDEX [CU_CentronNotifications_CreatedDate_ObjectKind] ON [dbo].[CentronNotifications]
(
	[CreatedDate] DESC,
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronUiProfiles]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronUiProfiles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](200) NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[IsGlobal] [bit] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedVersion] [varchar](16) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[ChangedVersion] [varchar](16) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[UiProfileType] [int] NOT NULL,
 CONSTRAINT [PK_CentronUiProfiles] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CentronWebLog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CentronWebLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SichBenuI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Url] [varchar](255) NULL,
	[Ip] [varchar](255) NULL,
	[Text] [varchar](255) NULL,
	[Typ] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_CentronWebLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChangeLog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChangeLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[DisplayName] [nvarchar](4000) NULL,
	[Date] [datetime] NOT NULL,
	[OldValue] [nvarchar](4000) NULL,
	[NewValue] [nvarchar](4000) NULL,
	[Property] [nvarchar](4000) NULL,
	[AppUserI3D] [int] NOT NULL,
 CONSTRAINT [IX_ChangeLog_UniqueI3D] UNIQUE NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [IX_ChangeLog]    Script Date: 11.11.2025 11:20:27 ******/
CREATE CLUSTERED INDEX [IX_ChangeLog] ON [dbo].[ChangeLog]
(
	[ObjectKind] ASC,
	[ObjectI3D] ASC,
	[Date] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChatLastSentEmailInfo]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChatLastSentEmailInfo](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[EmailSentDate] [datetime2](3) NOT NULL,
 CONSTRAINT [PK_ChatLastSentEmailInfo] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChatMemberLastViewedHistory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChatMemberLastViewedHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChatMemberI3D] [int] NOT NULL,
	[LastViewed] [datetime2](3) NOT NULL,
 CONSTRAINT [PK_ChatMemberLastViewedHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChatMembers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChatMembers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChatI3D] [int] NOT NULL,
	[DisplayName] [nvarchar](50) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Notes] [nvarchar](max) NULL,
 CONSTRAINT [PK_ChatMembers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChatMessages]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChatMessages](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChatI3D] [int] NOT NULL,
	[MemberI3D] [int] NOT NULL,
	[Message] [nvarchar](250) NOT NULL,
	[UpdateCount] [int] NOT NULL,
	[CreatedAt] [datetime2](3) NOT NULL,
	[ChangedAt] [datetime2](3) NOT NULL,
	[IsDeleted] [bit] NOT NULL,
	[MessageKind] [int] NULL,
	[DocumentI3D] [int] NULL,
 CONSTRAINT [PK_ChatMessages] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Chats]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Chats](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[Name] [nvarchar](50) NULL,
 CONSTRAINT [PK_Chats] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChecklistDetails]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChecklistDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChecklistI3D] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[Note] [nvarchar](1000) NULL,
	[Checked] [bit] NOT NULL,
	[SortOrder] [int] NULL,
	[DurationInMinutes] [int] NOT NULL,
	[CheckedDateTime] [datetime] NULL,
 CONSTRAINT [PK_ChecklistDetail] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChecklistDetailTemplates]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChecklistDetailTemplates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChecklistTemplateHeadI3D] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[SortOrder] [int] NULL,
	[ExpectedDurationInMinutes] [int] NOT NULL,
 CONSTRAINT [PK_ChecklistDetailTemplates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChecklistRecurrence]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChecklistRecurrence](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[StartTime] [time](7) NOT NULL,
	[BufferInMinutes] [int] NOT NULL,
	[StartDate] [date] NOT NULL,
	[EndDateOption] [int] NOT NULL,
	[EndAfterAmountCreatedChecklist] [int] NULL,
	[EndDate] [date] NULL,
	[CycleOption] [int] NOT NULL,
	[DailyOption] [int] NULL,
	[DailySeed] [int] NULL,
	[WeeklySeed] [int] NULL,
	[MonthlyOption] [int] NULL,
	[MonthlyDayFromMonth] [int] NULL,
	[MonthlySeed] [int] NULL,
	[MonthlyDaySeedOption] [int] NULL,
	[MonthlyDayOption] [int] NULL,
	[YearlySeed] [int] NULL,
	[YearlyDayFromMonth] [int] NULL,
	[YearlyMonth] [int] NULL,
	[YearlyDaySeedOption] [int] NULL,
	[YearlyDayOption] [int] NULL,
	[YearlyOption] [int] NULL,
	[Status] [int] NOT NULL,
	[DefaultChecklistI3D] [int] NULL,
 CONSTRAINT [PK_ChecklistRecurrence] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChecklistRecurrenceWeekDays]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChecklistRecurrenceWeekDays](
	[ChecklistRecurrenceI3D] [int] NOT NULL,
	[Monday] [bit] NOT NULL,
	[Tuesday] [bit] NOT NULL,
	[Wednesday] [bit] NOT NULL,
	[Thursday] [bit] NOT NULL,
	[Friday] [bit] NOT NULL,
	[Saturday] [bit] NOT NULL,
	[Sunday] [bit] NOT NULL,
 CONSTRAINT [PK_ChecklistRecurrenceWeekDays] PRIMARY KEY CLUSTERED 
(
	[ChecklistRecurrenceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Checklists]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Checklists](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Status] [int] NOT NULL,
	[WorkerKind] [int] NOT NULL,
	[Executor] [int] NOT NULL,
	[IsRecurrence] [bit] NOT NULL,
	[KeyValue] [nvarchar](510) NULL,
	[RecurrenceI3D] [int] NULL,
	[CreatedBy_PersonalI3D] [int] NULL,
	[ExecutorObjectI3D] [int] NULL,
	[ChecklistTemplateI3D] [int] NULL,
	[StartDateTime] [datetime] NULL,
	[EndDateTime] [datetime] NULL,
	[IsRecurrenceDefault] [bit] NULL,
 CONSTRAINT [PK_Checklist] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChecklistTemplateDetail]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChecklistTemplateDetail](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ChecklistTemplateHeadI3D] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [nvarchar](4000) NULL,
 CONSTRAINT [PK_ChecklistTemplateDetail] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ChecklistTemplates]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ChecklistTemplates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[ObjectKind] [int] NULL,
	[KeyValue] [nvarchar](510) NULL,
	[Executor] [int] NOT NULL,
	[CreatedBy_PersonalI3D] [int] NULL,
	[ExecutorObjectI3D] [int] NULL,
	[Status] [int] NOT NULL,
 CONSTRAINT [PK_ChecklistTemplateHead] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CITNachnamen]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CITNachnamen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nachname] [varchar](60) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CITTagName]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CITTagName](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[TagType] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CITTagText]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CITTagText](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CITTagnameI3D] [int] NULL,
	[Text] [varchar](100) NULL,
	[Number] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CITVornamen]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CITVornamen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Vorname] [varchar](60) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ClickKopf]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ClickKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Status] [int] NULL,
	[Name] [varchar](100) NULL,
	[KundenI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[AnsprechpartnerI3D] [int] NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[ZahlungsartVorNachPausch] [int] NULL,
	[ZahlungsartVorNachClick] [int] NULL,
	[ZahlungskonditionI3D] [int] NULL,
	[AbrechnungsZeitClick] [int] NULL,
	[AbrechnungsZeitPausch] [int] NULL,
	[AutoVerlaengerung] [int] NULL,
	[GekuendigtAm] [datetime] NULL,
	[GekuendigtKunde] [int] NULL,
	[Kuendigungsgrund] [varchar](255) NULL,
	[Kuendigungsfrist] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[GeaendertAm] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[AbgerechnetBisPausch] [datetime] NULL,
	[AbgerechnetBisClick] [datetime] NULL,
	[Pauschalvertrag] [int] NULL,
	[PauschalbetragSeiten] [float] NULL,
	[PauschalbetragFix] [float] NULL,
	[SummeFreikopien] [int] NULL,
	[Anrede] [text] NULL,
	[Abrede] [text] NULL,
	[ArtikelI3D] [int] NULL,
	[Info] [varchar](8000) NULL,
	[WVWartungsvertragBesteht] [int] NULL,
	[WVMaterialkosten] [float] NULL,
	[WVVerbrauchsmaterial] [float] NULL,
	[WVServiceZeit] [float] NULL,
	[WVStundensatz] [float] NULL,
	[WVAnfahrt] [float] NULL,
	[WVFahrtkosten] [float] NULL,
	[WVAnfahrtArtikelI3D] [int] NULL,
	[Pool] [int] NULL,
	[PoolFreiclicks] [int] NULL,
	[PoolPauschal] [float] NULL,
 CONSTRAINT [PK_ClickKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ClickPos]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ClickPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ClickKopfI3D] [int] NULL,
	[Pos] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[GeraeteClickZaehlerI3D] [int] NULL,
	[ClickPreis] [float] NULL,
	[FreiClick] [int] NULL,
	[ZaehlerStandAngelegt] [int] NULL,
	[ZaehlerStandAbgerechnet] [int] NULL,
	[ZaehlerStandAbgerechnetDatum] [datetime] NULL,
	[PoolFreiClick] [int] NULL,
	[PoolClickPreis] [float] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ClickPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ClickRechnung]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ClickRechnung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RechnungsI3D] [int] NULL,
	[ClickKopfI3D] [int] NULL,
	[ErstellDatum] [datetime] NULL,
	[AbrechnungDatum] [datetime] NULL,
	[Pauschal] [int] NULL,
	[Click] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CloseCrmProjectReasons]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CloseCrmProjectReasons](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [nvarchar](50) NOT NULL,
	[Status] [bit] NOT NULL,
 CONSTRAINT [PK_CloseCrmProjectReasons] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManCPU]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManCPU](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[CPUDeviceID] [varchar](255) NULL,
	[CPUCaption] [varchar](255) NULL,
	[CPUFamily] [int] NULL,
	[CPUManufacturer] [varchar](255) NULL,
	[CPUCurrentClockRate] [int] NULL,
	[CPUMaxClockRate] [int] NULL,
	[CPUType] [int] NULL,
	[CPURole] [varchar](50) NULL,
	[CPUVersion] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManEventLog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManEventLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[LogArt] [varchar](255) NULL,
	[LogCode] [int] NULL,
	[LogIdentifier] [int] NULL,
	[LogType] [int] NULL,
	[LogMessage] [varchar](255) NULL,
	[LogSource] [varchar](255) NULL,
	[LogAppearanceDateTime] [datetime] NULL,
	[LogUser] [varchar](255) NULL,
	[Recognized] [int] NULL,
	[VisibilityFlag] [int] NULL,
	[LogCategory] [int] NULL,
	[LogDescription] [varchar](1000) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManEventLogHiding]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManEventLogHiding](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NOT NULL,
	[RegExp] [varchar](500) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManExternalServices]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManExternalServices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[DateFound] [datetime] NULL,
	[Address] [varchar](255) NULL,
	[CHECKTYPE] [varchar](50) NULL,
	[OnLine] [int] NULL,
	[ServiceInfo] [varchar](255) NULL,
	[HTTPRoot] [varchar](255) NULL,
	[Checksum] [int] NULL,
	[FileSize] [int] NULL,
	[Recognized] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManHarddrive]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManHarddrive](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[HDDName] [varchar](255) NULL,
	[TotalMem] [int] NULL,
	[UsedMem] [int] NULL,
	[FreeMem] [int] NULL,
	[__PATH] [varchar](500) NULL,
	[InsertDate] [datetime] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManIntegrityDirectory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManIntegrityDirectory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IntegrityID] [varchar](40) NULL,
	[DirectoryPath] [varchar](255) NULL,
	[DirectorySize] [int] NULL,
	[CRCName] [int] NULL,
	[CRCSize] [int] NULL,
	[CRCNameAndSize] [int] NULL,
	[CRCFileNames] [int] NULL,
	[CRCFileSizes] [int] NULL,
	[CRCFileNamesAndSizes] [int] NULL,
	[DirectoryID] [int] NULL,
	[DateFound] [datetime] NULL,
	[CheckSum] [int] NULL,
	[ProcCheck] [int] NULL,
	[StatusFlag] [int] NULL,
	[Recognized] [int] NULL,
	[KundenI3D] [int] NULL,
	[ServerAddress] [varchar](255) NULL,
	[IntegrityFlag] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManIntegrityFile]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManIntegrityFile](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IntegrityID] [varchar](40) NULL,
	[FilePath] [varchar](255) NULL,
	[FileName] [varchar](255) NULL,
	[FileSize] [int] NULL,
	[CRCName] [int] NULL,
	[CRCSize] [int] NULL,
	[CRCNameAndSize] [int] NULL,
	[DirectoryID] [int] NULL,
	[DateFound] [datetime] NULL,
	[ProcCheck] [int] NULL,
	[StatusFlag] [int] NULL,
	[Recognized] [int] NULL,
	[KundenI3D] [int] NULL,
	[ServerAddress] [varchar](255) NULL,
	[IntegrityFlag] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManIntegrityServer]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManIntegrityServer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Address] [varchar](255) NULL,
	[CheckSum] [int] NULL,
	[GlobalSize] [int] NULL,
	[IntegrityID] [varchar](40) NULL,
	[DateFound] [datetime] NULL,
	[ProcCheck] [int] NULL,
	[StatusFlag] [int] NULL,
	[Recognized] [int] NULL,
	[KundenI3D] [int] NULL,
	[IntegrityFlag] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManLANResources]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManLANResources](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[DateFound] [datetime] NULL,
	[MachineName] [varchar](255) NULL,
	[MACAddress] [varchar](50) NULL,
	[IP] [varchar](50) NULL,
	[OS] [varchar](50) NULL,
	[OSVersion] [varchar](50) NULL,
	[INFOTYPE] [varchar](50) NULL,
	[OnLine] [int] NULL,
	[PortNumber] [varchar](50) NULL,
	[PortName] [varchar](50) NULL,
	[PortProtocol] [varchar](50) NULL,
	[PortOnLine] [int] NULL,
	[NETMask] [varchar](50) NULL,
	[NETIP] [varchar](50) NULL,
	[Route] [varchar](1024) NULL,
	[MachineRole] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManMachine]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManMachine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[ComputerID] [varchar](38) NULL,
	[ComputerName] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManMachineGroups]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManMachineGroups](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[ParentGroupI3D] [int] NULL,
	[IsCustomerRoot] [int] NULL,
	[GroupName] [varchar](255) NULL,
	[GroupDescription] [varchar](3000) NULL,
	[CheckHDDUsage] [int] NULL,
	[CheckPartitionUsage] [int] NULL,
	[HDDUsage] [int] NULL,
	[PartitionUsage] [int] NULL,
	[GroupColor] [varchar](50) NULL,
	[ThresholdI3D] [int] NULL,
	[VisioID] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManMachineInformation]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManMachineInformation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[ManufacturerI3D] [int] NULL,
	[MachineName] [varchar](255) NULL,
	[Mandator] [varchar](255) NULL,
	[Department] [varchar](255) NULL,
	[Location] [varchar](255) NULL,
	[Description] [varchar](1000) NULL,
	[SerialNumber] [varchar](255) NULL,
	[MachineType] [varchar](50) NULL,
	[Manufacturer] [varchar](255) NULL,
	[IsCustomMachine] [int] NULL,
	[VisioID] [int] NULL,
	[DepartmentI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManMachineToGroup]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManMachineToGroup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GroupI3D] [int] NULL,
	[CManMachineI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManNetInfo]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManNetInfo](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[IPAddress] [varchar](30) NULL,
	[MACAddress] [varchar](30) NULL,
	[Name] [varchar](30) NULL,
	[__PATH] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManNotifications]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManNotifications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NotificationText] [varchar](500) NULL,
	[NotificationStatus] [int] NULL,
	[MachineI3D] [int] NULL,
	[NotificationType] [int] NULL,
	[ObjectI3D] [int] NULL,
	[InsertionDate] [datetime] NULL,
	[NotificationValue] [float] NULL,
	[__PATH] [varchar](500) NULL,
	[Recognized] [int] NULL,
	[ThresholdI3D] [int] NULL,
	[CustomText] [varchar](500) NULL,
	[OverwriteCount] [int] NULL,
	[ObjectArt] [int] NULL,
	[GroupI3D] [int] NULL,
	[IsProportional] [int] NULL,
	[DeviceID] [int] NULL,
	[refDeviceI3D] [int] NULL,
	[___PATH] [varchar](500) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManOS]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManOS](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[OSName] [varchar](255) NULL,
	[OSVersion] [varchar](50) NULL,
	[OSServicePack] [varchar](50) NULL,
	[OSWinDir] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManPartition]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManPartition](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HarddriveI3D] [int] NULL,
	[PartitionID] [int] NULL,
	[PartitionName] [varchar](50) NULL,
	[PartitionLabel] [varchar](50) NULL,
	[PartitionFS] [varchar](50) NULL,
	[TotalMem] [int] NULL,
	[UsedMem] [int] NULL,
	[FreeMem] [int] NULL,
	[__PATH] [varchar](500) NULL,
	[InsertDate] [datetime] NULL,
	[Status] [int] NULL,
	[__HDDPATH] [varchar](500) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManPhysicalMemory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManPhysicalMemory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[BankLabel] [varchar](255) NULL,
	[Capacity] [int] NULL,
	[Caption] [varchar](255) NULL,
	[DataWidth] [int] NULL,
	[Description] [varchar](255) NULL,
	[FormFactor] [int] NULL,
	[InterleaveDataDepth] [int] NULL,
	[InterleavePosition] [int] NULL,
	[Manufacturer] [varchar](255) NULL,
	[Model] [varchar](255) NULL,
	[Name] [varchar](255) NULL,
	[OtherIdentifyingInfo] [varchar](255) NULL,
	[PartNumber] [varchar](255) NULL,
	[PositionInRow] [int] NULL,
	[SerialNumber] [varchar](255) NULL,
	[SKU] [varchar](255) NULL,
	[Speed] [int] NULL,
	[Status] [varchar](255) NULL,
	[TypeDetail] [int] NULL,
	[__Path] [varchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManSerialNumbers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManSerialNumbers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SoftwareI3D] [int] NOT NULL,
	[SerialNumber] [varchar](500) NULL,
	[Remark] [varchar](500) NULL,
	[SNStatus] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManService]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManService](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[Caption] [varchar](255) NULL,
	[Description] [varchar](255) NULL,
	[DesktopInteract] [int] NULL,
	[DisplayName] [varchar](255) NULL,
	[InstallDate] [datetime] NULL,
	[Name] [varchar](255) NULL,
	[PathName] [varchar](255) NULL,
	[ServiceType] [varchar](255) NULL,
	[Started] [int] NULL,
	[StartMode] [varchar](255) NULL,
	[StartName] [varchar](255) NULL,
	[State] [varchar](255) NULL,
	[Status] [varchar](255) NULL,
	[__Path] [varchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManSoftware]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManSoftware](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[SoftwareName] [varchar](255) NULL,
	[SoftwareVersion] [varchar](50) NULL,
	[Manufacturer] [varchar](255) NULL,
	[InstallDate] [datetime] NULL,
	[InstallLocation] [varchar](255) NULL,
	[InfoURL] [varchar](255) NULL,
	[HelpURL] [varchar](255) NULL,
	[UpdateURL] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManThreshold]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManThreshold](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjektI3D] [int] NULL,
	[ObjektArt] [int] NULL,
	[Exceeds] [int] NULL,
	[IsProportional] [int] NULL,
	[ValueChanges] [int] NULL,
	[WarningMessage] [varchar](1000) NULL,
	[ThresholdValue] [float] NULL,
	[IsActive] [int] NULL,
	[ThresholdStatus] [int] NULL,
	[DeviceID] [int] NULL,
	[__PATH] [varchar](500) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManVideoController]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManVideoController](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CManMachineI3D] [int] NULL,
	[AdapterRAM] [int] NULL,
	[Caption] [varchar](255) NULL,
	[CurrentBitsPerPixel] [int] NULL,
	[CurrentHorizontalResolution] [int] NULL,
	[CurrentNumberOfColors] [int] NULL,
	[CurrentRefreshRate] [int] NULL,
	[CurrentVerticalResolution] [int] NULL,
	[DeviceID] [varchar](255) NULL,
	[DriverDate] [datetime] NULL,
	[DriverVersion] [varchar](255) NULL,
	[InstallDate] [datetime] NULL,
	[InstalledDisplayDrivers] [varchar](255) NULL,
	[Name] [varchar](255) NULL,
	[VideoArchitecture] [int] NULL,
	[VideoMemoryType] [int] NULL,
	[VideoMode] [int] NULL,
	[VideoModeDescription] [varchar](255) NULL,
	[__Path] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CManVisioMap]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CManVisioMap](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VisioID] [int] NULL,
	[CustomLabel] [varchar](255) NULL,
	[IsAvailable] [int] NULL,
	[IsDefault] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CollectionInfo]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CollectionInfo](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CollectionI3D] [int] NULL,
	[ChildObjectI3D] [int] NULL,
	[LinkType] [int] NULL,
	[SourceTable] [varchar](30) NULL,
	[SourceField] [varchar](30) NULL,
	[LinkField] [varchar](30) NULL,
	[LinkFieldI3D] [int] NULL,
	[LinkObjectI3D] [int] NULL,
	[LinkObjectFieldI3D] [int] NULL,
	[Kommentar] [varchar](50) NULL,
	[DefaultFieldI3D] [int] NULL,
	[PositionPropertyI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_CollectionInfo] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CometAccount]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CometAccount](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AdminMailAddress] [nvarchar](250) NOT NULL,
	[Password] [nvarchar](100) NOT NULL,
	[RequestedDomain] [nvarchar](400) NULL,
	[CustomerI3D] [int] NOT NULL,
	[CompanyName] [nvarchar](100) NOT NULL,
	[DefaultThemeSet] [bit] NOT NULL,
 CONSTRAINT [PK_CometAccount] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CometBackupSecretKeys]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CometBackupSecretKeys](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BackupAdminI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[CustomerSiteI3D] [int] NULL,
	[SecretKey] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_CometBackupSecretKeys] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CometClients]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CometClients](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](250) NOT NULL,
	[OwnCustomerI3D] [int] NOT NULL,
	[MspCustomerI3D] [int] NOT NULL,
	[MspCustomerSiteI3D] [int] NULL,
	[Username] [nvarchar](100) NOT NULL,
	[Password] [nvarchar](100) NOT NULL,
	[VaultName] [nvarchar](100) NOT NULL,
	[DestinationGuid] [nvarchar](100) NULL,
	[VaultId] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_CometClients] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CometCredentials]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CometCredentials](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CompanyName] [nvarchar](250) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Username] [nvarchar](100) NOT NULL,
	[Password] [nvarchar](100) NOT NULL,
	[ServerAddress] [nvarchar](400) NOT NULL,
	[ServerName] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_CometCredentials] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ConnectionTickets]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ConnectionTickets](
	[TicketID] [nvarchar](64) NOT NULL,
	[ExpireDate] [datetime] NOT NULL,
	[DeviceID] [nvarchar](128) NULL,
	[LicenseGUID] [nvarchar](64) NOT NULL,
	[AppUserI3D] [int] NULL,
	[WebAccountI3D] [int] NULL,
	[MonitoringTokenI3D] [int] NULL,
	[ApplicationID] [bigint] NOT NULL,
 CONSTRAINT [PK_ConnectionTickets] PRIMARY KEY CLUSTERED 
(
	[TicketID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ConsultingUmsatz]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ConsultingUmsatz](
	[Jahr] [int] NULL,
	[Monat] [int] NULL,
	[Name] [varchar](60) NULL,
	[Umsatz] [float] NULL,
	[Gutschriften] [float] NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ContactToMailTemplateRelationshipKinds]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ContactToMailTemplateRelationshipKinds](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[AccountAddressContactI3D] [int] NOT NULL,
	[MailTemplateRelationshipKindI3D] [int] NOT NULL,
 CONSTRAINT [PK_ContactToMailTemplateRelationshipKinds] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CL_ContactToMailTemplateRelationshipKinds]    Script Date: 11.11.2025 11:20:27 ******/
CREATE UNIQUE CLUSTERED INDEX [CL_ContactToMailTemplateRelationshipKinds] ON [dbo].[ContactToMailTemplateRelationshipKinds]
(
	[EmployeeI3D] ASC,
	[AccountAddressContactI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ContractArticleReferenzes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ContractArticleReferenzes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ContractI3D] [int] NOT NULL,
	[Description] [nvarchar](200) NULL,
	[ContractAmount] [int] NULL,
	[ConsiderUnderbooking] [bit] NOT NULL,
	[ConsiderOverbooking] [bit] NOT NULL,
	[OverbookingSecondLine] [bit] NOT NULL,
	[ArticleAssignmentI3D] [int] NULL,
	[VkPrice] [decimal](18, 2) NULL,
	[EkPrice] [decimal](18, 2) NULL,
 CONSTRAINT [PK_ContractArticleReferenzes] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ContractBillingResult]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ContractBillingResult](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ContractI3D] [int] NULL,
	[InvoiceI3D] [int] NULL,
	[Status] [int] NULL,
	[Result] [nvarchar](200) NULL,
	[Comment] [nvarchar](500) NULL,
	[CreatedDate] [datetime] NULL,
	[CreatedBy] [int] NULL,
 CONSTRAINT [PK_ContractBillingResult] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ControllingAuswertung]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ControllingAuswertung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[Jahr] [int] NULL,
	[Monat] [int] NULL,
	[Umsatz] [float] NULL,
	[HandelsDB] [float] NULL,
	[DLUmsatz] [float] NULL,
	[RechKopfI3D] [int] NULL,
	[Warengruppe] [int] NULL,
	[UnterwarenI3D] [int] NULL,
	[Status] [int] NULL,
	[GesamtDB] [float] NULL,
	[DLDB] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CounterToArticle]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CounterToArticle](
	[ArticleI3D] [int] NOT NULL,
	[CounterKindI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CRMProjektart]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CRMProjektart](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
	[Nummer] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](150) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CRMProjektBetrag]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CRMProjektBetrag](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CRMProjektI3D] [int] NULL,
	[BetragArt] [int] NULL,
	[WarengruppenI3D] [int] NULL,
	[BetragGeplant] [float] NULL,
	[BetragErrechnet] [float] NULL,
	[DBProzent] [float] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CRMProjektStatus]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CRMProjektStatus](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
	[Nummer] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](150) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CRMWahrscheinlichkeit]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CRMWahrscheinlichkeit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
	[Nummer] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Prozentangabe] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[csi_InfoMail]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[csi_InfoMail](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InfoMailName] [varchar](50) NULL,
	[Status] [int] NOT NULL,
	[GruppenI3D] [varchar](200) NULL,
	[PersonalI3D] [varchar](200) NULL,
	[Betreff] [varchar](50) NULL,
	[MailBody] [text] NULL,
	[Absender] [varchar](50) NULL,
	[UhrZeit] [datetime] NULL,
	[GesendetAm] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CSI_SocialMediaAction]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CSI_SocialMediaAction](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SocialMediaStreamI3D] [int] NOT NULL,
	[Text] [nvarchar](max) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[EmployeeI3D] [int] NULL,
 CONSTRAINT [PK_CSI_SocialMediaAction] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CSI_SocialMediaComment]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CSI_SocialMediaComment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [nvarchar](max) NOT NULL,
	[SocialMediaStreamI3D] [int] NULL,
	[SocialMediaActionI3D] [int] NULL,
	[EmployeeI3D] [int] NULL,
	[CreatedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_CSI_SocialMediaComment] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CSI_SocialMediaLike]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CSI_SocialMediaLike](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[SocialMediaStreamI3D] [int] NULL,
	[SocialMediaActionI3D] [int] NULL,
 CONSTRAINT [PK_CSI_SocialMediaLike] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CSI_SocialMediaStream]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CSI_SocialMediaStream](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DisplayText] [nvarchar](512) NOT NULL,
	[Description] [nvarchar](max) NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_CSI_SocialMediaStream] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CSI_SocialMediaStreamAccount]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CSI_SocialMediaStreamAccount](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[AccountKind] [int] NOT NULL,
	[SocialMediaStreamI3D] [int] NOT NULL,
 CONSTRAINT [PK_CSI_SocialMediaStreamAccount] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CSI_SocialMediaSubscription]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CSI_SocialMediaSubscription](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[SocialMediaStreamI3D] [int] NOT NULL,
	[SubscriptionDate] [datetime] NOT NULL,
 CONSTRAINT [PK_CSI_SocialMediaSubscription] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CSK_Arbeitsplan]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CSK_Arbeitsplan](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Variante] [int] NULL,
	[Bezeichnung] [varchar](500) NULL,
	[ArtikelI3D] [int] NULL,
	[ErstelltVon] [varchar](50) NULL,
	[ErstelltAm] [datetime] NULL,
	[LetzteAenderungVon] [varchar](50) NULL,
	[LetzteAenderungAm] [datetime] NULL,
	[GueltigVon] [datetime] NULL,
	[GueltigBis] [datetime] NULL,
	[MaterialKosten] [float] NULL,
	[Lohnkosten] [float] NULL,
	[Maschinenkosten] [float] NULL,
	[Gemeinkostenaufschlag] [float] NULL,
	[Art] [int] NULL,
	[ArtI3D] [int] NULL,
	[ArtVersionNr] [int] NULL,
	[AngelegtVonI3D] [int] NULL,
	[AngelegtVonAm] [datetime] NULL,
	[LetzteAenderungVOnI3D] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[Arbeitsplan] [int] NULL,
	[Status] [int] NULL,
	[ArbeitsauftragI3D] [int] NULL,
 CONSTRAINT [PK_Arbeitsplan] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CSK_Arbeitsschritt]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CSK_Arbeitsschritt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](50) NULL,
	[ArbeitsplanI3D] [int] NULL,
	[Pos] [int] NULL,
	[Status] [int] NULL,
	[Position] [int] NULL,
	[KurzBeschreibung] [varchar](256) NULL,
	[Beschreibung] [varchar](2048) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CTRCallRecipientGroups]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CTRCallRecipientGroups](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CTRCallsI3D] [int] NULL,
	[MAAbteilungI3D] [int] NULL,
	[SichgrupI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CTRCallRecipients]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CTRCallRecipients](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CTRCallsI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CTRCalls]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CTRCalls](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Datum] [datetime] NULL,
	[Status] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeschaeftspartnerArt] [int] NULL,
	[GeschaeftspartnerI3D] [int] NULL,
	[GeschaeftspartnerAnschriftI3D] [int] NULL,
	[GeschaeftspartnerAnsprechpartnerI3D] [int] NULL,
	[SeriennummerI3D] [int] NULL,
	[Bezeichnung] [varchar](200) NULL,
	[Beschreibung] [text] NULL,
	[Seriennummer] [varchar](200) NULL,
	[AnlagenTyp] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[ArtikelI3D] [int] NULL,
	[RechnungNummer] [int] NULL,
	[RechnungDatum] [datetime] NULL,
	[RechPosI3D] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[GeraeteDatum] [datetime] NULL,
	[VertragI3D] [int] NULL,
	[VertragNummer] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CTRCallTypes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CTRCallTypes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CTRCallsI3D] [int] NULL,
	[CTRTypesI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CTRGeschaeftspartner]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CTRGeschaeftspartner](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](200) NULL,
	[Firma] [varchar](200) NULL,
	[Strasse] [varchar](200) NULL,
	[PLZ] [varchar](10) NULL,
	[Ort] [varchar](200) NULL,
	[Telefon] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[EMail] [varchar](200) NULL,
	[WWW] [varchar](200) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CTRTypeEditors]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CTRTypeEditors](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CTRTypeI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[NotificationTemplateI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CTRTypes]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CTRTypes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](200) NULL,
	[Eskalationszeitraum] [int] NULL,
	[EskalationszeitraumEinheit] [int] NULL,
	[Status] [int] NULL,
	[KategorieVorlageI3D] [int] NULL,
	[PrioritaetI3D] [int] NULL,
	[AktionID] [int] NULL,
	[VorgangArt] [int] NULL,
	[Art] [int] NULL,
	[ShortDescription] [nvarchar](1000) NULL,
	[Description] [ntext] NULL,
	[TicketStatusI3D] [int] NULL,
	[FreeFlag1] [bit] NULL,
	[TicketTypeI3D] [int] NULL,
	[CustomerI3D] [int] NULL,
	[ResponsibleEmployeeI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerLog]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[OldValue] [nvarchar](512) NOT NULL,
	[NewValue] [nvarchar](512) NOT NULL,
	[Category] [nvarchar](50) NULL,
	[ChangedObjectI3D] [int] NULL,
	[ChangedObjectKind] [int] NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerMonitoringSettings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerMonitoringSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [nvarchar](128) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerProductMatrixCategories]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerProductMatrixCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[SortPosition] [float] NOT NULL,
 CONSTRAINT [PK_CustomerProductMatrixCategories] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerProductMatrixProducts]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerProductMatrixProducts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerProductMatrixCategoryI3D] [int] NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[SortPosition] [float] NOT NULL,
 CONSTRAINT [PK_CustomerProductMatrixProducts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerProductMatrixRating]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerProductMatrixRating](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerNumber] [int] NOT NULL,
	[CustomerProductMatrixProductI3D] [int] NOT NULL,
	[CustomerProductMatrixRatingValue] [int] NOT NULL,
 CONSTRAINT [PK_CustomerProductMatrixRating] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerProductMatrixRatingChangeLogs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerProductMatrixRatingChangeLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerProductMatrixRatingI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Timestamp] [datetime2](3) NOT NULL,
	[CustomerProductMatrixRatingValue] [int] NOT NULL,
	[Reason] [nvarchar](1000) NULL,
 CONSTRAINT [PK_CustomerProductMatrixRatingChangeLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerSettings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Kind] [varchar](64) NOT NULL,
	[IntValue] [int] NULL,
	[StringValue] [nvarchar](4000) NULL,
	[DecValue] [float] NULL,
	[ByteValue] [image] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerSites]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerSites](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Name] [nvarchar](400) NOT NULL,
	[Description] [nvarchar](max) NULL,
	[Phone] [nvarchar](400) NULL,
	[Fax] [nvarchar](400) NULL,
	[Email] [nvarchar](400) NULL,
	[Country] [nvarchar](400) NULL,
	[City] [nvarchar](400) NULL,
	[Street] [nvarchar](400) NULL,
	[Zip] [nvarchar](400) NULL,
	[AddressAddition] [nvarchar](400) NULL,
	[PostOfficeBox] [nvarchar](400) NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedByType] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedByType] [int] NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
	[IsDeleted] [bit] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerSpecialArticles]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerSpecialArticles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[ArticleI3D] [int] NULL,
	[Demand] [int] NULL,
	[SettlementType] [int] NULL,
	[Multiplier] [int] NULL,
	[Price] [float] NULL,
 CONSTRAINT [PK_CustomerSpecialArticles] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomerToMonitoringClient]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomerToMonitoringClient](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[MonitoringID] [int] NOT NULL,
	[MonitoringName] [nvarchar](256) NULL,
	[MonitoringTypeID] [int] NOT NULL,
	[State] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomGatewayDefinitions]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomGatewayDefinitions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ImportType] [int] NOT NULL,
	[GatewayI3D] [int] NULL,
	[CentronColumn] [int] NOT NULL,
	[ColumnName] [nvarchar](800) NULL,
	[ColumnValue] [nvarchar](800) NULL,
	[ColumnFillUpChar] [nvarchar](1) NULL,
	[ColumnLength] [int] NULL,
	[ColumnIndex] [int] NULL,
	[ColumnAlignment] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_CustomGatewayDefinitions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CustomSearchResults]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CustomSearchResults](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](64) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[Type] [int] NOT NULL,
	[ResultSet] [image] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DashboardContainers]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DashboardContainers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AppUserI3D] [int] NOT NULL,
	[ModuleID] [varchar](50) NOT NULL,
	[ContainerKindID] [varchar](50) NOT NULL,
	[IdentityData] [varbinary](max) NULL,
	[SortOrder] [int] NOT NULL,
	[Size] [int] NOT NULL,
	[IsFlowBreak] [bit] NOT NULL,
 CONSTRAINT [PK_DashboardContainers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DatabaseUpdaterDefaultValues]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DatabaseUpdaterDefaultValues](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TableName] [nvarchar](255) NOT NULL,
	[FieldName] [nvarchar](255) NOT NULL,
	[DefaultValue] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DateiLinks]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DateiLinks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Pfad] [varchar](255) NULL,
	[Beschreibung] [varchar](255) NULL,
	[ErstellerI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_DateiLinks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DauerTermin]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DauerTermin](
	[I3D] [int] NOT NULL,
	[ObjektArt] [int] NOT NULL,
	[ObjektI3D] [int] NOT NULL,
	[Gilt_von] [datetime] NOT NULL,
	[Gilt_bis] [datetime] NOT NULL,
	[IntervallArt] [int] NOT NULL,
	[Intervall] [float] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_DauerTermin] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DBUpdate]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DBUpdate](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DBUpdateIndex] [int] NULL,
	[Datum] [datetime] NULL,
	[Status] [int] NULL,
	[BearbeiterI3D] [int] NULL,
	[LastUndoDatum] [datetime] NULL,
	[LastUndoBearbeiterI3D] [int] NULL,
	[ScriptType] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployableJobs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployableJobs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[PackageI3D] [int] NOT NULL,
	[InstallationTime] [datetime] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ModifiedDate] [datetime] NULL,
 CONSTRAINT [PK_DeployableJobs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageInstallError]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageInstallError](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Error] [text] NOT NULL,
	[Solution] [text] NULL,
	[Note] [text] NULL,
	[TestedOperatingSystemID] [int] NOT NULL,
 CONSTRAINT [PK_DeployablePackageInstallError] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageLogs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeployableJobI3D] [int] NOT NULL,
	[LogType] [int] NOT NULL,
	[LogDescription] [nvarchar](max) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_DeployablePackageLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageOperatingSystems]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageOperatingSystems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Version] [nvarchar](50) NOT NULL,
	[Architecture] [nvarchar](50) NOT NULL,
	[PackageVersionID] [int] NOT NULL,
 CONSTRAINT [PK_DeployablePackageOperatingSystems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackages]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackages](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PackageName] [nvarchar](255) NOT NULL,
	[Vendor] [nvarchar](255) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedAt] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedAt] [datetime] NOT NULL,
	[PortalI3D] [int] NULL,
 CONSTRAINT [PK_DeployablePackages] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageSoftwareValidateInformation]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageSoftwareValidateInformation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DisplayName] [nvarchar](256) NULL,
	[DisplayVersion] [nvarchar](256) NULL,
	[VersionID] [int] NOT NULL,
 CONSTRAINT [PK_DeployablePackageSoftwareValidateInformation] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageSources]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageSources](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Path] [nvarchar](256) NOT NULL,
	[Username] [nvarchar](255) NULL,
	[Password] [nvarchar](255) NULL,
	[Kind] [int] NOT NULL,
	[ReadOnly] [bit] NOT NULL,
	[Priority] [int] NOT NULL,
 CONSTRAINT [PK_DeployablePackageSources] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageTags]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageTags](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PackageI3D] [int] NOT NULL,
	[Tag] [varchar](255) NOT NULL,
 CONSTRAINT [PK_DeployablePackageTags] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageToCveNumber]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageToCveNumber](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CveNumber] [nvarchar](255) NOT NULL,
	[PackageI3D] [int] NOT NULL,
	[PackageVersionI3D] [int] NOT NULL,
	[PackagePortalI3D] [int] NULL,
	[PackageVersionPortalI3D] [int] NULL,
 CONSTRAINT [PK_DeployablePackageToCveNumber] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageVersion]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageVersion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Version] [nvarchar](255) NOT NULL,
	[PackageI3D] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedAt] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedAt] [datetime] NOT NULL,
	[PackageID] [varchar](255) NOT NULL,
	[Eula] [text] NULL,
	[EncryptedFileName] [nvarchar](512) NULL,
	[EncryptedFilePassword] [nvarchar](512) NULL,
	[PortalI3D] [int] NULL,
	[Architecture] [int] NOT NULL,
 CONSTRAINT [PK_DeployablePackageVersion] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployablePackageVersionEulaLogs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployablePackageVersionEulaLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PackageName] [nvarchar](255) NULL,
	[TimeStamp] [datetime] NOT NULL,
	[EulaAccepted] [bit] NOT NULL,
	[AcceptFromPersonalI3D] [int] NOT NULL,
	[VersionName] [nchar](255) NULL,
	[VersionNr] [nchar](255) NULL,
	[JobI3D] [int] NULL,
 CONSTRAINT [PK_DeployablePackageVersionEulaLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployableSystemCrawlerNextRestartHistory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployableSystemCrawlerNextRestartHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NextRestartJobI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[Message] [ntext] NOT NULL,
 CONSTRAINT [PK_DeployableSystemCrawlerNextRestartHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeployableSystemCrawlerNextRestartJobs]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeployableSystemCrawlerNextRestartJobs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PackageVersionName] [nvarchar](255) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[DeviceShortName] [nvarchar](255) NOT NULL,
	[CreatedByAppUser] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[PackageVersionPortalI3D] [int] NOT NULL,
	[ExecutionState] [int] NOT NULL,
 CONSTRAINT [PK_DeployableSystemCrawlerNextRestartJobs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeploymentRules]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeploymentRules](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeployablePackagePortalI3D] [int] NOT NULL,
	[PackageName] [nvarchar](512) NOT NULL,
	[VersionPortalI3D] [int] NULL,
	[Version] [nvarchar](512) NOT NULL,
	[Limit] [int] NOT NULL,
	[RuleType] [int] NOT NULL,
	[OuType] [int] NOT NULL,
	[CustomOuI3D] [int] NULL,
	[AdOuGuid] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeviceClickCounterImported]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeviceClickCounterImported](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CounterValue] [int] NOT NULL,
	[CounterType] [nvarchar](32) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[AddressI3D] [int] NULL,
	[DeviceName] [nvarchar](64) NOT NULL,
	[Manufacturer] [nvarchar](64) NULL,
	[Barcode] [nvarchar](32) NULL,
	[ScanDate] [datetime] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[IsMatched] [bit] NOT NULL,
	[SNMPDetailI3D] [int] NOT NULL,
	[CounterID] [nvarchar](64) NULL,
	[DeviceBarcode] [nvarchar](32) NULL,
	[ImportDate] [datetime] NULL,
 CONSTRAINT [PK_DeviceClickCounterImported] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeviceClickCounterImportHistory]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeviceClickCounterImportHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceClickCounterImportedI3D] [int] NULL,
	[MessageType] [int] NOT NULL,
	[MessageParameter] [nvarchar](1024) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DeviceClickCounterTypeMappings]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeviceClickCounterTypeMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceClickCounterI3D] [int] NOT NULL,
	[CounterType] [nvarchar](32) NOT NULL,
	[SNMPDetailI3D] [int] NOT NULL,
	[Code] [nvarchar](64) NULL,
 CONSTRAINT [PK_DeviceClickCounterTypeMappings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DirectoryReference]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DirectoryReference](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DirectoryI3D] [int] NOT NULL,
	[DirectoryKind] [varchar](64) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Directorys]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Directorys](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[OwnerI3D] [int] NULL,
	[ImageIndex] [int] NULL,
	[SelectedIndex] [int] NULL,
	[numChildren] [int] NULL,
	[numDocuments] [int] NULL,
	[KndDirectoryI3D] [int] NULL,
	[imageblob] [image] NULL,
	[selimageblob] [image] NULL,
	[Status] [int] NULL,
	[IsDocSyncActive] [bit] NULL,
	[CreatedBy] [int] NULL,
	[CreatedDate] [datetime2](7) NULL,
	[CreatedVersion] [varchar](20) NULL,
	[ChangedBy] [int] NULL,
	[ChangedDate] [datetime2](7) NULL,
	[ChangedVersion] [varchar](20) NULL,
 CONSTRAINT [Directorys_pk] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocFieldValues]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocFieldValues](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocI3D] [int] NULL,
	[FieldI3D] [int] NULL,
	[Wert] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_DocFieldValues] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocMails]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocMails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentI3D] [int] NULL,
	[Empfangen] [datetime] NULL,
	[Betreff] [varchar](256) NULL,
	[Von] [varchar](256) NULL,
	[An] [varchar](256) NULL,
	[Text] [text] NULL,
	[EntryID] [varchar](256) NULL,
	[Anlagen] [varchar](1000) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocPages]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocPages](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerDoc] [int] NOT NULL,
	[Data] [image] NULL,
	[PageSize] [smallint] NULL,
	[Dpi] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_DocPages] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocTypeFields]    Script Date: 11.11.2025 11:20:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocTypeFields](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocTypeI3D] [int] NULL,
	[Name] [varchar](50) NULL,
	[DataType] [int] NULL,
	[ReadOnly] [int] NULL,
	[DefaultVal] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_DocTypeFields] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocTypes]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocTypes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[ImageIndex] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_DocTypes] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuFormSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuFormSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocuFormCounter] [nvarchar](50) NOT NULL,
	[CentronCounterTypeI3D] [int] NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_DocuFormSetting] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Documentation]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Documentation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentationCategoryI3D] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Caption] [varchar](128) NOT NULL,
	[PublicDocumentation] [text] NULL,
	[InternalDocumentation] [text] NULL,
	[Status] [int] NOT NULL,
	[Version] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedVersion] [varchar](24) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[ChangedVersion] [varchar](24) NOT NULL,
	[DocDirI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationCategory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationCategory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [varchar](128) NOT NULL,
	[ParentI3D] [int] NULL,
	[Status] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedVersion] [varchar](24) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[ChangedVersion] [varchar](24) NOT NULL,
	[Global] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationCategoryToCustomer]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationCategoryToCustomer](
	[DocumentationCategoryI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[Deactiviert] [int] NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationVersion]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationVersion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentationI3D] [int] NOT NULL,
	[DocumentationCategoryI3D] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Caption] [varchar](128) NOT NULL,
	[PublicDocumentation] [text] NULL,
	[InternalDocumentation] [text] NULL,
	[Status] [int] NOT NULL,
	[Version] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedVersion] [varchar](24) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[ChangedVersion] [varchar](24) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizard]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizard](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentationWizardI3D] [int] NOT NULL,
	[Name] [nvarchar](128) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardEntry]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardEntry](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentationWizardEntryI3D] [int] NOT NULL,
	[DocumentationWizardResultI3D] [int] NOT NULL,
	[TemplateType] [nvarchar](56) NOT NULL,
	[TemplateTableI3D] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplate]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplate](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](128) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateActiveDirectory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateActiveDirectory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateType] [int] NOT NULL,
	[Filled] [bit] NOT NULL,
	[FSMORoles] [nvarchar](4000) NULL,
	[AdminAccounts] [nvarchar](4000) NULL,
	[GroupRecommondations] [nvarchar](4000) NULL,
	[Scripts] [nvarchar](4000) NULL,
	[WizardEntryI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateBackupAndRestore]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateBackupAndRestore](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateType] [int] NOT NULL,
	[Filled] [bit] NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[WizardEntryI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateCustomer]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateCustomer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateType] [int] NOT NULL,
	[Filled] [bit] NOT NULL,
	[AddressI3D] [int] NULL,
	[WizardEntryI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateDataBackup]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateDataBackup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](128) NULL,
	[Description] [nvarchar](4000) NULL,
	[Time] [nvarchar](128) NULL,
	[BackupFrequency] [int] NULL,
	[BackupAndRestoreTemplateI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateDataCustomerToContactPerson]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateDataCustomerToContactPerson](
	[CustomerTemplateI3D] [int] NOT NULL,
	[ContactPersonI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateDataExternalContactPerson]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateDataExternalContactPerson](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Company] [nvarchar](256) NULL,
	[Firstname] [nvarchar](128) NULL,
	[Lastname] [nvarchar](128) NULL,
	[Phone] [nvarchar](64) NULL,
	[EMail] [nvarchar](64) NULL,
	[Department] [nvarchar](64) NULL,
	[CustomerTemplateI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateDataMachine]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateDataMachine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](128) NULL,
	[IP] [nvarchar](256) NULL,
	[SubnetMask] [nvarchar](256) NULL,
	[Gateway] [nvarchar](256) NULL,
	[Description] [nvarchar](4000) NULL,
	[Type] [nvarchar](64) NULL,
	[MachineTemplateI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateDataMail]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateDataMail](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DomainName] [nvarchar](128) NULL,
	[NameServer] [nvarchar](128) NULL,
	[IP] [nvarchar](256) NULL,
	[MailServer] [nvarchar](128) NULL,
	[MailTemplateI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateDataNetwork]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateDataNetwork](
	[I3D] [int] NOT NULL,
	[Name] [nvarchar](64) NULL,
	[IP] [nvarchar](256) NULL,
	[Description] [nvarchar](4000) NULL,
	[ServerType] [nvarchar](64) NULL,
	[NetworkStructureTemplateI3D] [int] NOT NULL,
 CONSTRAINT [PK_DocumentationWizardTemplateDataNetwork] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateEntry]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateEntry](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentationWizardI3D] [int] NOT NULL,
	[Name] [nvarchar](128) NOT NULL,
	[Optional] [int] NOT NULL,
	[OrderIndex] [int] NOT NULL,
	[TemplateType] [nvarchar](56) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateMachine]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateMachine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateType] [int] NOT NULL,
	[Filled] [bit] NOT NULL,
	[WizardEntryI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateMail]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateMail](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateType] [int] NOT NULL,
	[Filled] [bit] NOT NULL,
	[WizardEntryI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateNetworkComponent]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateNetworkComponent](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateType] [int] NOT NULL,
	[Filled] [bit] NOT NULL,
	[Switche] [nvarchar](4000) NULL,
	[Router] [nvarchar](4000) NULL,
	[Firewall] [nvarchar](4000) NULL,
	[AccessPoints] [nvarchar](4000) NULL,
	[Wiring] [nvarchar](4000) NULL,
	[WizardEntryI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentationWizardTemplateNetworkStructure]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentationWizardTemplateNetworkStructure](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateType] [int] NOT NULL,
	[Filled] [bit] NOT NULL,
	[WizardEntryI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentFulltextIndex]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentFulltextIndex](
	[I3D] [bigint] IDENTITY(1,1) NOT NULL,
	[DocumentI3D] [int] NOT NULL,
	[TextValue] [nvarchar](1000) NOT NULL,
 CONSTRAINT [PK_DocumentFulltextIndex] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_DocumentFulltextIndex]    Script Date: 11.11.2025 11:20:28 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_DocumentFulltextIndex] ON [dbo].[DocumentFulltextIndex]
(
	[DocumentI3D] ASC,
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentFulltextIndexStats]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentFulltextIndexStats](
	[DocumentI3D] [int] NOT NULL,
	[LastUpdate] [datetime2](2) NOT NULL,
	[IsUpdateRequested] [bit] NOT NULL,
	[DurationInMS] [int] NULL,
 CONSTRAINT [PK_DocumentFulltextIndexStats] PRIMARY KEY CLUSTERED 
(
	[DocumentI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentMetaInformations]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentMetaInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocumentI3D] [int] NOT NULL,
	[Type] [tinyint] NOT NULL,
	[TypeName] [nvarchar](50) NULL,
	[Value] [nvarchar](400) NULL,
 CONSTRAINT [PK_DocumentMetaInformations] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_DocumentMetaInformations]    Script Date: 11.11.2025 11:20:28 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_DocumentMetaInformations] ON [dbo].[DocumentMetaInformations]
(
	[DocumentI3D] ASC,
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Documents]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Documents](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](500) NULL,
	[DocSize] [int] NULL,
	[DocType] [int] NULL,
	[CreationDate] [datetime] NULL,
	[OwnerDirI3D] [int] NULL,
	[Data] [image] NULL,
	[NumPages] [int] NULL,
	[DataType] [int] NULL,
	[ImageIndex] [int] NULL,
	[DocDate] [datetime] NULL,
	[PublicDelete] [int] NULL,
	[Version] [int] NULL,
	[BelongsToI3D] [int] NULL,
	[Angelegt_von] [int] NULL,
	[Geandert_am] [datetime] NULL,
	[Geandert_von] [int] NULL,
	[Attachment] [int] NULL,
	[BelongsToKundenI3D] [int] NULL,
	[ReferenzI3D] [int] NULL,
	[LockUserI3D] [int] NULL,
	[LockWorkstation] [varchar](20) NULL,
	[LockPath] [varchar](300) NULL,
	[Status] [int] NULL,
	[WEBKundenAnzeigen] [int] NULL,
	[WEBPersonenI3D] [int] NULL,
	[Flags] [bigint] NOT NULL,
	[DMSSyncUniqueID] [nvarchar](250) NULL,
	[DMSSyncDate] [datetime2](0) NULL,
	[DMSSyncType] [tinyint] NULL,
	[DMSSyncEmployeeI3D] [int] NULL,
	[DocumentKind] [int] NULL,
	[CreatedVersion] [varchar](20) NULL,
	[ChangedVersion] [varchar](20) NULL,
	[DocumentFulltextIndexStatsI3D] [int] NULL,
	[ThumbnailI3D] [int] NULL,
	[HelpdeskHistoryI3D] [int] NULL,
 CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocumentThumbnails]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentThumbnails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FileSize] [int] NOT NULL,
	[Width] [int] NOT NULL,
	[Height] [int] NOT NULL,
	[Data] [varbinary](max) NOT NULL,
 CONSTRAINT [PK_DocumentThumbnails] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizard]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizard](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](128) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[AddressI3D] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardActiveDirectory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardActiveDirectory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WizardI3D] [int] NOT NULL,
	[FSMORoles] [nvarchar](4000) NULL,
	[AdminAccounts] [nvarchar](4000) NULL,
	[GroupRecommondations] [nvarchar](4000) NULL,
	[Scripts] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardBackupAndRestore]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardBackupAndRestore](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WizardI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardBackupAndRestoreData]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardBackupAndRestoreData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocuWizardBackupAndRestoreI3D] [int] NOT NULL,
	[Name] [nvarchar](128) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[Time] [nvarchar](256) NULL,
	[BackupFrequency] [int] NOT NULL,
	[Software] [nvarchar](256) NULL,
	[Medium] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardCustomerInformation]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardCustomerInformation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WizardI3D] [int] NOT NULL,
	[Description] [nvarchar](4000) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardCustomerInformationExternalContacts]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardCustomerInformationExternalContacts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocuWizardCustomerInformationI3D] [int] NOT NULL,
	[Company] [nvarchar](255) NOT NULL,
	[Firstname] [nvarchar](128) NOT NULL,
	[Lastname] [nvarchar](128) NOT NULL,
	[Phone] [nvarchar](64) NULL,
	[EMail] [nvarchar](64) NULL,
	[Department] [nvarchar](128) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardCustomerInformationToContactPerson]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardCustomerInformationToContactPerson](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocuWizardCustomerInformationI3D] [int] NOT NULL,
	[AddressContactI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardMachine]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardMachine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WizardI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardMachineData]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardMachineData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocuWizardMachineI3D] [int] NOT NULL,
	[Name] [nvarchar](128) NOT NULL,
	[Type] [nvarchar](64) NOT NULL,
	[IP] [nvarchar](64) NULL,
	[SubnetMask] [nvarchar](64) NULL,
	[Gateway] [nvarchar](64) NULL,
	[Description] [nvarchar](4000) NULL,
	[Serialnumber] [nvarchar](256) NULL,
	[Manufacturer] [nvarchar](128) NULL,
	[ILO] [nvarchar](256) NULL,
	[VLANID] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardMail]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardMail](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WizardI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardMailData]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardMailData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocuWizardMailI3D] [int] NOT NULL,
	[MailServer] [nvarchar](64) NOT NULL,
	[DomainName] [nvarchar](64) NULL,
	[NameServer] [nvarchar](64) NULL,
	[IP] [nvarchar](64) NULL,
	[ServerType] [nvarchar](64) NULL,
	[ExternalAccess] [nvarchar](4000) NULL,
	[LoginData] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkComponent]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkComponent](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WizardI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkComponentData]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkComponentData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[Manufacturer] [nvarchar](256) NULL,
	[Typ] [nvarchar](256) NULL,
	[Gateway] [nvarchar](256) NULL,
	[CountOfNetworkCards] [int] NULL,
	[Encoding] [nvarchar](256) NULL,
	[Managed] [bit] NULL,
	[Channel] [nvarchar](256) NULL,
	[DocuWizardNetworkComponentI3D] [int] NOT NULL,
	[NetworkComponentDataType] [nvarchar](32) NOT NULL,
	[Serialnumber] [nvarchar](128) NULL,
	[Share] [nvarchar](256) NULL,
	[Subnet] [nvarchar](256) NULL,
	[Name] [nvarchar](256) NULL,
	[Password] [nvarchar](128) NULL,
	[Ports] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkComponentDataManagedNetwork]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkComponentDataManagedNetwork](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Network] [nvarchar](256) NOT NULL,
	[DocuWizardNetworkComponentDataI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkComponentDataModule]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkComponentDataModule](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[Port] [nvarchar](128) NOT NULL,
	[DocuWizardNetworkComponentDataI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkComponentDataNetworkIP]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkComponentDataNetworkIP](
	[I3D] [int] NOT NULL,
	[IP] [nvarchar](128) NOT NULL,
	[DocuWizardNetworkComponentDataI3D] [int] NOT NULL,
 CONSTRAINT [PK_DocuWizardNetworkComponentDataNetworkIP] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkComponentDataSSID]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkComponentDataSSID](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](256) NOT NULL,
	[DocuWizardNetworkComponentDataI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkStructure]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkStructure](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WizardI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkStructureData]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkStructureData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DocuWizardNetworkStructureI3D] [int] NOT NULL,
	[Name] [nvarchar](128) NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[NetworkStrucureDataType] [nvarchar](32) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkStructureDataExcludedIP]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkStructureDataExcludedIP](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IPStart] [nvarchar](64) NOT NULL,
	[IPEnd] [nvarchar](64) NOT NULL,
	[DocuWizardNetworkStructureDataI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DocuWizardNetworkStructureDataNetworkIP]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocuWizardNetworkStructureDataNetworkIP](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IP] [nvarchar](256) NOT NULL,
	[DocuWizardNetworkStructureDataI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDI1Kopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDI1Kopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Sender] [varchar](20) NULL,
	[Recipient] [varchar](20) NULL,
	[Datum] [datetime] NULL,
	[Belegart] [int] NULL,
	[Belegnummer] [varchar](10) NULL,
	[Waehrung] [varchar](5) NULL,
	[DatumBeleg] [datetime] NULL,
	[DatumFaellig] [datetime] NULL,
	[DatumFaktura] [datetime] NULL,
	[MwstSatz] [float] NULL,
	[KondArt] [int] NULL,
	[KondBetrag] [float] NULL,
	[KondProz] [float] NULL,
	[KondText] [varchar](80) NULL,
	[RSName1] [varchar](35) NULL,
	[RSName2] [varchar](35) NULL,
	[RSStrasse] [varchar](35) NULL,
	[RSPLZ] [varchar](9) NULL,
	[RSOrt] [varchar](35) NULL,
	[RSLand] [varchar](3) NULL,
	[RSUID] [varchar](20) NULL,
	[REName1] [varchar](35) NULL,
	[REName2] [varchar](35) NULL,
	[REStrasse] [varchar](35) NULL,
	[REPLZ] [varchar](9) NULL,
	[REOrt] [varchar](35) NULL,
	[RELand] [varchar](3) NULL,
	[REUID] [varchar](20) NULL,
	[AGName1] [varchar](35) NULL,
	[AGName2] [varchar](35) NULL,
	[AGStrasse] [varchar](35) NULL,
	[AGPLZ] [varchar](9) NULL,
	[AGOrt] [varchar](35) NULL,
	[AGLand] [varchar](3) NULL,
	[AGUID] [varchar](20) NULL,
	[WEName1] [varchar](35) NULL,
	[WEName2] [varchar](35) NULL,
	[WEStrasse] [varchar](35) NULL,
	[WEPLZ] [varchar](9) NULL,
	[WEOrt] [varchar](35) NULL,
	[WELand] [varchar](3) NULL,
	[WEUID] [varchar](20) NULL,
	[SummeNetto] [float] NULL,
	[SummeMwst] [float] NULL,
	[SummeFaktura] [float] NULL,
	[Status] [int] NULL,
	[Pruefstatus] [int] NULL,
	[WareKopfI3D] [int] NULL,
	[KalkKopfI3D] [int] NULL,
	[DatenuebernahmeDatum] [datetime] NULL,
	[DatenuebernahmePersonalI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDI1Pos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDI1Pos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDI1KopfI3D] [int] NULL,
	[AuftragNr] [varchar](35) NULL,
	[AuftragPos] [int] NULL,
	[AuftragDatum] [datetime] NULL,
	[BestellNr] [varchar](35) NULL,
	[BestellPos] [int] NULL,
	[BestellDatum] [datetime] NULL,
	[LiefNr] [varchar](35) NULL,
	[LiefPos] [int] NULL,
	[LiefDatum] [datetime] NULL,
	[MaterialNr] [varchar](35) NULL,
	[MaterialKdNr] [varchar](35) NULL,
	[HerstellerteileNr] [varchar](35) NULL,
	[StawaNr] [varchar](17) NULL,
	[FakMenge] [float] NULL,
	[BruttoWert] [float] NULL,
	[NettoBetrag] [float] NULL,
	[MwstBetrag] [float] NULL,
	[MwstSatz] [float] NULL,
	[Status] [int] NULL,
	[Pruefstatus] [int] NULL,
	[BestPosI3D] [int] NULL,
	[WarePosI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDI1SN]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDI1SN](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDI1PosI3D] [int] NULL,
	[SerialNr] [varchar](35) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIABKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIABKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DistributorID] [int] NULL,
	[Distributor] [varchar](40) NULL,
	[XMLErstellung] [datetime] NULL,
	[BestellnrDistributor] [varchar](40) NULL,
	[DatumAuftrag] [datetime] NULL,
	[BestellnrEigene] [varchar](40) NULL,
	[DatumBestellung] [datetime] NULL,
	[WEName1] [varchar](40) NULL,
	[WEName2] [varchar](40) NULL,
	[WEName3] [varchar](40) NULL,
	[WEName4] [varchar](40) NULL,
	[WEStrasse] [varchar](40) NULL,
	[WEPLZ] [varchar](10) NULL,
	[WEOrt] [varchar](40) NULL,
	[WELand] [varchar](3) NULL,
	[EDI2StatusCode] [varchar](10) NULL,
	[EDI2StatusText] [varchar](100) NULL,
	[EDI3AddressErrorCode] [varchar](10) NULL,
	[EDI3AddressErrorText] [varchar](100) NULL,
	[EDI3SuffixErrorCode] [varchar](10) NULL,
	[EDI3SuffixErrorText] [varchar](100) NULL,
	[Pruefstatus] [int] NULL,
	[BestKopfI3D] [int] NULL,
	[XMLDokument] [text] NULL,
	[XMLFileNameOnServer] [varchar](60) NULL,
	[EDI2MsgID] [int] NULL,
	[Status] [int] NULL,
	[Ausgeblendet] [int] NULL,
	[AusgeblendetHinweis] [varchar](100) NULL,
	[DatenUebernommen] [int] NULL,
	[Prueflog] [varchar](1000) NULL,
	[BestellnrEigeneOrig] [varchar](40) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIABPos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIABPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIABKopfI3D] [int] NULL,
	[BestellnrEigene] [varchar](40) NULL,
	[BestellPos] [varchar](6) NULL,
	[MaterialnrDistributor] [varchar](40) NULL,
	[MaterialnrEigene] [varchar](40) NULL,
	[MaterialnrHersteller] [varchar](40) NULL,
	[Menge] [float] NULL,
	[Einzelpreis] [float] NULL,
	[PosSumme] [float] NULL,
	[AbsagegrundCode] [varchar](10) NULL,
	[AbsagegrundText] [varchar](100) NULL,
	[StatusCode] [varchar](10) NULL,
	[StatusText] [varchar](100) NULL,
	[Pruefstatus] [int] NULL,
	[BestPosI3D] [int] NULL,
	[Prueflog] [varchar](1000) NULL,
	[Artikeltext] [varchar](200) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIABTermine]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIABTermine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIABPosI3D] [int] NULL,
	[DatumLieferung] [datetime] NULL,
	[EDI4WocheLieferung] [int] NULL,
	[Menge] [float] NULL,
	[EDI2SchedulingType] [varchar](10) NULL,
	[EDI2DeliveryDateType] [varchar](10) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIActebisKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIActebisKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Sender] [varchar](20) NULL,
	[Recipient] [varchar](20) NULL,
	[Datum] [datetime] NULL,
	[Belegart] [int] NULL,
	[Belegnummer] [varchar](10) NULL,
	[Waehrung] [varchar](5) NULL,
	[DatumBeleg] [datetime] NULL,
	[DatumFaellig] [datetime] NULL,
	[DatumFaktura] [datetime] NULL,
	[MwstSatz] [float] NULL,
	[KondArt] [int] NULL,
	[KondBetrag] [float] NULL,
	[KondProz] [float] NULL,
	[KondText] [varchar](80) NULL,
	[RSName1] [varchar](35) NULL,
	[RSName2] [varchar](35) NULL,
	[RSStrasse] [varchar](35) NULL,
	[RSPLZ] [varchar](9) NULL,
	[RSOrt] [varchar](35) NULL,
	[RSLand] [varchar](3) NULL,
	[RSUID] [varchar](20) NULL,
	[REName1] [varchar](35) NULL,
	[REName2] [varchar](35) NULL,
	[REStrasse] [varchar](35) NULL,
	[REPLZ] [varchar](9) NULL,
	[REOrt] [varchar](35) NULL,
	[RELand] [varchar](3) NULL,
	[REUID] [varchar](20) NULL,
	[AGName1] [varchar](35) NULL,
	[AGName2] [varchar](35) NULL,
	[AGStrasse] [varchar](35) NULL,
	[AGPLZ] [varchar](9) NULL,
	[AGOrt] [varchar](35) NULL,
	[AGLand] [varchar](3) NULL,
	[AGUID] [varchar](20) NULL,
	[WEName1] [varchar](35) NULL,
	[WEName2] [varchar](35) NULL,
	[WEStrasse] [varchar](35) NULL,
	[WEPLZ] [varchar](9) NULL,
	[WEOrt] [varchar](35) NULL,
	[WELand] [varchar](3) NULL,
	[WEUID] [varchar](20) NULL,
	[SummeNetto] [float] NULL,
	[SummeMwst] [float] NULL,
	[SummeFaktura] [float] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIActebisPos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIActebisPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIActebisKopfI3D] [int] NULL,
	[AuftragNr] [varchar](35) NULL,
	[AuftragPos] [int] NULL,
	[AuftragDatum] [datetime] NULL,
	[BestellNr] [varchar](35) NULL,
	[BestellPos] [int] NULL,
	[BestellDatum] [datetime] NULL,
	[LiefNr] [varchar](35) NULL,
	[LiefPos] [int] NULL,
	[LiefDatum] [datetime] NULL,
	[MaterialNr] [varchar](35) NULL,
	[MaterialKdNr] [varchar](35) NULL,
	[StawaNr] [varchar](17) NULL,
	[FakMenge] [float] NULL,
	[BruttoWert] [float] NULL,
	[NettoBetrag] [float] NULL,
	[MwstBetrag] [float] NULL,
	[MwstSatz] [float] NULL,
	[SerialNr] [varchar](35) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIActebisSN]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIActebisSN](
	[I3D] [int] NOT NULL,
	[EDIActebisPosI3D] [int] NULL,
	[SerialNr] [varchar](35) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_EDIActebisSN] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIAdditionalArticles]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIAdditionalArticles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierI3D] [int] NULL,
	[SupplierArticleDescription] [nvarchar](100) NULL,
	[CentronArticleI3D] [int] NULL,
	[CentronArticleKind] [int] NULL,
	[SupplierArticleCode] [nvarchar](50) NULL,
	[CentronArticleCode] [nvarchar](50) NULL,
 CONSTRAINT [PK_EDIAdditionalArticles] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIDeliveryHead]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIDeliveryHead](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierI3D] [int] NOT NULL,
	[OrigFileName] [nvarchar](200) NOT NULL,
	[SupplierFileName] [nvarchar](200) NOT NULL,
	[SourceOrderNumber] [nvarchar](100) NULL,
	[SourceOrderDate] [datetime2](0) NULL,
	[SupplierDeliveryNumber] [nvarchar](100) NULL,
	[SupplierDeliveryDate] [datetime2](0) NULL,
	[DeliveryDateStart] [datetime2](0) NULL,
	[DeliveryDateEnd] [datetime2](0) NULL,
	[CentronOrderNumber] [int] NULL,
	[BuyerName] [nvarchar](50) NULL,
	[BuyerName2] [nvarchar](50) NULL,
	[BuyerName3] [nvarchar](50) NULL,
	[BuyerStreet] [nvarchar](50) NULL,
	[BuyerZip] [nvarchar](10) NULL,
	[BuyerCity] [nvarchar](50) NULL,
	[BuyerCountry] [nvarchar](5) NULL,
	[DeliveryName] [nvarchar](50) NULL,
	[DeliveryName2] [nvarchar](50) NULL,
	[DeliveryName3] [nvarchar](50) NULL,
	[DeliveryStreet] [nvarchar](50) NULL,
	[DeliveryZip] [nvarchar](10) NULL,
	[DeliveryCity] [nvarchar](50) NULL,
	[DeliveryCountry] [nvarchar](5) NULL,
	[BuyerPartyID] [nvarchar](100) NULL,
	[DeliveryPartyID] [nvarchar](100) NULL,
	[NeedsUserValidation] [bit] NULL,
	[SupplierNetto] [decimal](12, 2) NULL,
	[SupplierBrutto] [decimal](12, 2) NULL,
	[Currency] [nvarchar](10) NULL,
	[Multidistributor] [int] NULL,
	[CreatedDate] [datetime2](0) NULL,
	[Comment] [nvarchar](2000) NULL,
	[CentronOrderI3D] [int] NULL,
	[State] [int] NULL,
	[MandatorI3D] [int] NULL,
	[EDIConfigurationI3D] [int] NULL,
 CONSTRAINT [PK_EdiDeliveryHead] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIDeliveryItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIDeliveryItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIDeliveryHeadI3D] [int] NOT NULL,
	[LineID] [nvarchar](50) NULL,
	[SupplierArticleCode] [nvarchar](100) NULL,
	[EANCode] [nvarchar](15) NULL,
	[ManufacturerArticleCode] [nvarchar](100) NULL,
	[Quantity] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[Description] [nvarchar](100) NULL,
	[DeliveryDateStart] [datetime] NULL,
	[DeliveryDateEnd] [datetime] NULL,
	[VAT] [decimal](9, 4) NULL,
	[Comment] [nvarchar](200) NULL,
	[AdditionalArticle] [bit] NULL,
	[TrackingName] [nvarchar](50) NULL,
	[TrackingNumber] [nvarchar](50) NULL,
	[TrackingURL] [nvarchar](500) NULL,
	[PackageQuantity] [int] NULL,
 CONSTRAINT [PK_EDIDeliveryItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIDeliveryItemsToOrder]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIDeliveryItemsToOrder](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIDeliveryItemsI3D] [int] NOT NULL,
	[OrderPosI3D] [int] NOT NULL,
	[AppliedQuantity] [decimal](9, 2) NOT NULL,
	[CentronArticleKind] [int] NULL,
 CONSTRAINT [PK_EDIDeliveryItemsToOrder] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIDocuments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIDocuments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerI3D] [int] NOT NULL,
	[OwnerKind] [int] NOT NULL,
	[CreateDate] [datetime] NOT NULL,
	[FileData] [varbinary](max) NOT NULL,
 CONSTRAINT [PK_EDIDocuments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIInvoiceBarcodes]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIInvoiceBarcodes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Barcode] [nvarchar](100) NOT NULL,
	[EDIInvoiceItemsI3D] [int] NOT NULL,
	[EDIDeliveryItemsI3D] [int] NULL,
 CONSTRAINT [PK_EDIInvoiceBarcodes] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [idxEDIInvoiceItemsI3D]    Script Date: 11.11.2025 11:20:28 ******/
CREATE CLUSTERED INDEX [idxEDIInvoiceItemsI3D] ON [dbo].[EDIInvoiceBarcodes]
(
	[EDIInvoiceItemsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIInvoiceHead]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIInvoiceHead](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierI3D] [int] NOT NULL,
	[OrigFileName] [nvarchar](100) NOT NULL,
	[SupplierFileName] [nvarchar](100) NOT NULL,
	[SourceOrderNumber] [nvarchar](100) NULL,
	[SourceOrderDate] [datetime2](0) NULL,
	[SupplierInvoiceNumber] [nvarchar](100) NULL,
	[SupplierInvoiceDate] [datetime2](0) NULL,
	[DeliveryDateStart] [datetime2](0) NULL,
	[DeliveryDateEnd] [datetime2](0) NULL,
	[CentronOrderNumber] [int] NULL,
	[BuyerName] [nvarchar](50) NULL,
	[BuyerName2] [nvarchar](50) NULL,
	[BuyerName3] [nvarchar](50) NULL,
	[BuyerStreet] [nvarchar](50) NULL,
	[BuyerZip] [nvarchar](10) NULL,
	[BuyerCity] [nvarchar](50) NULL,
	[BuyerCountry] [nvarchar](5) NULL,
	[DeliveryName] [nvarchar](50) NULL,
	[DeliveryName2] [nvarchar](50) NULL,
	[DeliveryName3] [nvarchar](50) NULL,
	[DeliveryStreet] [nvarchar](50) NULL,
	[DeliveryZip] [nvarchar](10) NULL,
	[DeliveryCity] [nvarchar](50) NULL,
	[DeliveryCountry] [nvarchar](5) NULL,
	[BuyerPartyID] [nvarchar](100) NULL,
	[DeliveryPartyID] [nvarchar](100) NULL,
	[NeedsUserValidation] [bit] NULL,
	[SupplierNetto] [decimal](12, 2) NULL,
	[SupplierBrutto] [decimal](12, 2) NULL,
	[Currency] [nvarchar](10) NULL,
	[Multidistributor] [int] NULL,
	[Comment] [nvarchar](2000) NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CentronDeliveryListI3D] [int] NULL,
	[CentronOrderI3D] [int] NULL,
	[State] [int] NULL,
	[DeliveryNumber] [nvarchar](50) NULL,
	[IsDeliveryAccept] [bit] NULL,
	[EDIConfigurationI3D] [int] NULL,
	[AddField1] [nvarchar](100) NULL,
	[AddField2] [nvarchar](100) NULL,
 CONSTRAINT [PK_EdiInvoiceHead] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIInvoiceItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIInvoiceItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIInvoiceHeadI3D] [int] NOT NULL,
	[LineID] [nvarchar](50) NULL,
	[SupplierArticleCode] [nvarchar](100) NULL,
	[EANCode] [nvarchar](15) NULL,
	[ManufacturerArticleCode] [nvarchar](100) NULL,
	[Quantity] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[Description] [nvarchar](100) NULL,
	[DeliveryDateStart] [datetime] NULL,
	[DeliveryDateEnd] [datetime] NULL,
	[VAT] [decimal](9, 4) NULL,
	[Comment] [nvarchar](200) NULL,
	[AdditionalArticle] [bit] NULL,
	[DeliveryNumber] [nvarchar](50) NULL,
 CONSTRAINT [PK_EDIInvoiceItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIInvoiceItemsToOrder]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIInvoiceItemsToOrder](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIInvoiceItemsI3D] [int] NOT NULL,
	[OrderPosI3D] [int] NOT NULL,
	[AppliedQuantity] [decimal](9, 2) NOT NULL,
	[CentronArticleKind] [int] NOT NULL,
 CONSTRAINT [PK_EDIInvoiceItemsToOrder] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [idxInvoiceToOrder]    Script Date: 11.11.2025 11:20:28 ******/
CREATE UNIQUE CLUSTERED INDEX [idxInvoiceToOrder] ON [dbo].[EDIInvoiceItemsToOrder]
(
	[EDIInvoiceItemsI3D] ASC,
	[OrderPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDILog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDILog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[PersonalI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[BestellungI3D] [int] NULL,
	[BestellungVersion] [int] NULL,
	[Beschreibung] [varchar](1000) NULL,
	[ReferenzI3D] [int] NULL,
	[ReferenzNummer] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIManagementLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIManagementLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MultiDistributor] [int] NULL,
	[DistributorI3D] [int] NULL,
	[FileName] [nvarchar](200) NULL,
	[EDIReceiptLogKind] [int] NULL,
	[State] [int] NULL,
	[Comment] [nvarchar](2000) NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[EmployeeI3D] [int] NULL,
	[ReceiptI3D] [int] NULL,
 CONSTRAINT [PK_EDIManagementLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIOrderResponseHead]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIOrderResponseHead](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierI3D] [int] NOT NULL,
	[OrigFileName] [nvarchar](100) NOT NULL,
	[SupplierFileName] [nvarchar](100) NOT NULL,
	[SourceOrderNumber] [nvarchar](100) NULL,
	[SourceOrderDate] [datetime2](0) NULL,
	[SupplierOrderNumber] [nvarchar](100) NULL,
	[SupplierOrderDate] [datetime2](0) NULL,
	[DeliveryDateStart] [datetime2](0) NULL,
	[DeliveryDateEnd] [datetime2](0) NULL,
	[CentronOrderNumber] [int] NULL,
	[BuyerName] [nvarchar](50) NULL,
	[BuyerName2] [nvarchar](50) NULL,
	[BuyerName3] [nvarchar](50) NULL,
	[BuyerStreet] [nvarchar](50) NULL,
	[BuyerZip] [nvarchar](10) NULL,
	[BuyerCity] [nvarchar](50) NULL,
	[BuyerCountry] [nvarchar](5) NULL,
	[DeliveryName] [nvarchar](50) NULL,
	[DeliveryName2] [nvarchar](50) NULL,
	[DeliveryName3] [nvarchar](50) NULL,
	[DeliveryStreet] [nvarchar](50) NULL,
	[DeliveryZip] [nvarchar](10) NULL,
	[DeliveryCity] [nvarchar](50) NULL,
	[DeliveryCountry] [nvarchar](5) NULL,
	[BuyerPartyID] [nvarchar](100) NULL,
	[DeliveryPartyID] [nvarchar](100) NULL,
	[NeedsUserValidation] [bit] NULL,
	[SupplierNetto] [decimal](12, 2) NULL,
	[SupplierBrutto] [decimal](12, 2) NULL,
	[Currency] [nvarchar](10) NULL,
	[Multidistributor] [int] NULL,
	[Comment] [nvarchar](2000) NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CentronOrderI3D] [int] NULL,
	[State] [int] NULL,
	[EDIConfigurationI3D] [int] NULL,
 CONSTRAINT [PK_EdiOrderResponseHead] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIOrderResponseItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIOrderResponseItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIOrderResponseHeadI3D] [int] NOT NULL,
	[LineID] [nvarchar](50) NULL,
	[SupplierArticleCode] [nvarchar](100) NULL,
	[EANCode] [nvarchar](15) NULL,
	[ManufacturerArticleCode] [nvarchar](100) NULL,
	[Quantity] [decimal](9, 2) NULL,
	[Price] [decimal](9, 2) NULL,
	[Description] [nvarchar](100) NULL,
	[DeliveryDateStart] [datetime] NULL,
	[DeliveryDateEnd] [datetime] NULL,
	[VAT] [decimal](9, 4) NULL,
	[Comment] [nvarchar](200) NULL,
	[PartDelivery] [bit] NULL,
 CONSTRAINT [PK_EDIOrderResponseItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIOrderResponseItemsToOrder]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIOrderResponseItemsToOrder](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIOrderResponseItemsI3D] [int] NOT NULL,
	[OrderPosI3D] [int] NOT NULL,
	[AppliedQuantity] [decimal](9, 2) NOT NULL,
 CONSTRAINT [PK_EDIOrderResponseItemsToOrder] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [idxOrderResponseToOrder]    Script Date: 11.11.2025 11:20:28 ******/
CREATE UNIQUE CLUSTERED INDEX [idxOrderResponseToOrder] ON [dbo].[EDIOrderResponseItemsToOrder]
(
	[EDIOrderResponseItemsI3D] ASC,
	[OrderPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIRechKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIRechKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DistributorID] [int] NULL,
	[Distributor] [varchar](40) NULL,
	[Belegart] [int] NULL,
	[Belegnummer] [varchar](10) NULL,
	[DatumBeleg] [datetime] NULL,
	[Waehrung] [varchar](5) NULL,
	[DatumFaellig] [datetime] NULL,
	[AGName1] [varchar](40) NULL,
	[AGName2] [varchar](40) NULL,
	[AGName3] [varchar](40) NULL,
	[AGName4] [varchar](40) NULL,
	[AGStrasse] [varchar](40) NULL,
	[AGPLZ] [varchar](10) NULL,
	[AGOrt] [varchar](40) NULL,
	[AGLand] [varchar](3) NULL,
	[WEName1] [varchar](40) NULL,
	[WEName2] [varchar](40) NULL,
	[WEName3] [varchar](40) NULL,
	[WEName4] [varchar](40) NULL,
	[WEStrasse] [varchar](40) NULL,
	[WEPLZ] [varchar](10) NULL,
	[WEOrt] [varchar](40) NULL,
	[WELand] [varchar](3) NULL,
	[REName1] [varchar](40) NULL,
	[REName2] [varchar](40) NULL,
	[REName3] [varchar](40) NULL,
	[REName4] [varchar](40) NULL,
	[REStrasse] [varchar](40) NULL,
	[REPLZ] [varchar](10) NULL,
	[REOrt] [varchar](40) NULL,
	[RELand] [varchar](3) NULL,
	[REUstID] [varchar](20) NULL,
	[RSName1] [varchar](40) NULL,
	[RSName2] [varchar](40) NULL,
	[RSName3] [varchar](40) NULL,
	[RSName4] [varchar](40) NULL,
	[RSStrasse] [varchar](40) NULL,
	[RSPLZ] [varchar](10) NULL,
	[RSOrt] [varchar](40) NULL,
	[RSLand] [varchar](3) NULL,
	[RSUstID] [varchar](20) NULL,
	[SummeNetto] [float] NULL,
	[SummeMwst] [float] NULL,
	[SummeBrutto] [float] NULL,
	[Versandkosten] [float] NULL,
	[Verpackungskosten] [float] NULL,
	[Status] [int] NULL,
	[Pruefstatus] [int] NULL,
	[WareKopfI3D] [int] NULL,
	[KalkKopfI3D] [varchar](10) NULL,
	[DatenuebernahmeDatum] [datetime] NULL,
	[DatenuebernahmePersonalI3D] [int] NULL,
	[XMLDokument] [text] NULL,
	[Ausgeblendet] [bit] NOT NULL,
	[AusgeblendetHinweis] [varchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIRechKopfBueroRing]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIRechKopfBueroRing](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ILNLieferant] [int] NULL,
	[LieferantennummerPBS] [int] NULL,
	[Lieferantenname] [varchar](100) NULL,
	[RENrLieferant] [varchar](30) NULL,
	[RENrPBS] [varchar](30) NULL,
	[Rechnungsdatum] [datetime] NULL,
	[Waehrung] [varchar](3) NULL,
	[NettoMWSTohne] [float] NULL,
	[NettoMWSThalb] [float] NULL,
	[MWSThalb] [float] NULL,
	[NettoMWSTvoll] [float] NULL,
	[MWSTvoll] [float] NULL,
	[Nebenkosten] [float] NULL,
	[Rabatt] [float] NULL,
	[Brutto] [float] NULL,
	[Skonto] [float] NULL,
	[Buchungsdatum] [datetime] NULL,
	[Status] [int] NULL,
	[Pruefstatus] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIRechPos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIRechPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIRechKopfI3D] [int] NULL,
	[BestellnrDistributor] [varchar](40) NULL,
	[BestellnrEigene] [varchar](40) NULL,
	[DatumBestellung] [datetime] NULL,
	[Lieferscheinnr] [varchar](40) NULL,
	[DatumLieferung] [datetime] NULL,
	[BestellPos] [varchar](6) NULL,
	[MaterialnrDistributor] [varchar](40) NULL,
	[MaterialnrEigene] [varchar](40) NULL,
	[MaterialnrHersteller] [varchar](40) NULL,
	[Menge] [float] NULL,
	[Einzelpreis] [float] NULL,
	[PosSumme] [float] NULL,
	[MwstSatz] [float] NULL,
	[Frachtkosten] [float] NULL,
	[Status] [int] NULL,
	[Pruefstatus] [int] NULL,
	[BestPosI3D] [int] NULL,
	[WarePosI3D] [int] NULL,
	[Prueflog] [varchar](500) NULL,
	[BestellnrEigeneOrig] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIRechPosBueroRing]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIRechPosBueroRing](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PosNr] [int] NULL,
	[RENrPBS] [varchar](30) NULL,
	[Lieferscheinnummer] [varchar](254) NULL,
	[Lieferanschrift] [varchar](271) NULL,
	[Bestellnummer] [varchar](254) NULL,
	[Kommissionsnummer] [varchar](254) NULL,
	[ArtikelnummerLief] [varchar](30) NULL,
	[Artikeltext] [varchar](254) NULL,
	[PosBetrag] [float] NULL,
	[PosMenge] [float] NULL,
	[PosMengenEinheit] [varchar](10) NULL,
	[Einzelpreis] [float] NULL,
	[PosRabatt] [float] NULL,
	[Mwst] [float] NULL,
	[Status] [int] NULL,
	[Pruefstatus] [int] NULL,
	[Sonderposition] [int] NULL,
	[PruefLog] [varchar](250) NULL,
	[WareKopfI3D] [int] NULL,
	[BestPosI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDIRechSN]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDIRechSN](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDIRechPosI3D] [int] NULL,
	[Seriennr] [varchar](40) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDISchnittstellenKonfiguration]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDISchnittstellenKonfiguration](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[Bezeichnung] [varchar](256) NULL,
	[Art] [int] NULL,
	[EDIArt] [int] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](24) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](24) NULL,
	[ServerArt] [int] NULL,
	[Server] [varchar](256) NULL,
	[Pfad] [varchar](256) NULL,
	[Benutzername] [varchar](64) NULL,
	[Passwort] [varchar](256) NULL,
	[ObjektI3D] [int] NULL,
	[VariableExportFelder] [text] NULL,
	[AutoStart] [int] NULL,
	[AutoStartIntervall] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDISchnittstellenLOG]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDISchnittstellenLOG](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDISchnittstellenKonfigurationI3D] [int] NULL,
	[Beschreibung] [varchar](4000) NULL,
	[ErstellerI3D] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVersion] [varchar](50) NULL,
	[RechnerName] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDISchnittstellenLOGDetails]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDISchnittstellenLOGDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EDISchnittstellenLOGI3D] [int] NULL,
	[EDISchnittstellenLOGXmlI3D] [int] NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
	[Beschreibung] [varchar](1000) NULL,
	[Status] [int] NULL,
	[Date] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[RechnerName] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EDISchnittstellenLOGXml]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EDISchnittstellenLOGXml](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FileName] [varchar](500) NULL,
	[XMLText] [image] NULL,
	[XMLTextMD5] [varchar](200) NULL,
	[XMLTextSHA1] [varchar](200) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EgisWarenkorbHead]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EgisWarenkorbHead](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KorbNumber] [int] NOT NULL,
	[KorbName] [varchar](50) NOT NULL,
	[CreatedAt] [datetime2](0) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[OptimizedAt] [datetime2](7) NULL,
	[OptimizedByI3D] [int] NULL,
 CONSTRAINT [PK_WarenKorbHead] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EgisWarenkorbItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EgisWarenkorbItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EgisWarenKorbHeadI3D] [int] NOT NULL,
	[ArticleI3D] [int] NOT NULL,
	[OrderItemI3D] [int] NULL,
	[PCSCode] [nvarchar](50) NULL,
 CONSTRAINT [PK_WarenKorbItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Einheiten]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Einheiten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NULL,
	[Einheit] [varchar](20) NULL,
	[Faktor] [float] NULL,
	[Zeichen] [varchar](10) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmailAdditionalRecipients]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmailAdditionalRecipients](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmailRecipientKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[To] [nvarchar](255) NULL,
	[CC] [nvarchar](255) NULL,
	[BCC] [nvarchar](255) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EMailDomainBlacklist]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EMailDomainBlacklist](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[State] [int] NOT NULL,
	[Domain] [varchar](256) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmployeeFavorites]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmployeeFavorites](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[DisplayText] [nvarchar](255) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Image] [image] NULL,
	[OrderPosition] [int] NULL,
 CONSTRAINT [PK_CSI_EmployeeFavorites] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmployeeRfidTokens]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmployeeRfidTokens](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[RfidTokenEncrypted] [nvarchar](255) NOT NULL,
	[CreatedAt] [datetime2](0) NOT NULL,
	[CreatedByEmployeeI3D] [int] NOT NULL,
 CONSTRAINT [PK_EmployeeRfidTokens] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmployeeSettingsProfileNet]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmployeeSettingsProfileNet](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeSettingsProfileI3D] [int] NOT NULL,
	[ParentType] [varchar](255) NOT NULL,
	[ControlName] [varchar](64) NOT NULL,
	[Configuration] [image] NOT NULL,
	[CentronUiProfileI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmployeeStatistic]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmployeeStatistic](
	[I3D] [int] NOT NULL,
	[EmployeeID] [int] NOT NULL,
	[Seconds] [int] NOT NULL,
	[Revenue] [float] NOT NULL,
	[Date] [varchar](10) NOT NULL,
	[StatisticType] [int] NOT NULL,
 CONSTRAINT [PK_EmployeeStatistic] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmployeeTeam]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmployeeTeam](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[State] [int] NOT NULL,
	[Name] [varchar](64) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedVersion] [varchar](24) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[ChangedVersion] [varchar](24) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmployeeToEmployeeTeam]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmployeeToEmployeeTeam](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[State] [int] NULL,
	[EmployeeTeamI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[EmployeeKind] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmployeeToSalesArea]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmployeeToSalesArea](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[SalesAreaI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EmployeeUserSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmployeeUserSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[SettingKind] [int] NOT NULL,
	[ValueInt] [int] NULL,
	[ValueString] [nvarchar](4000) NULL,
	[ValueBool] [bit] NULL,
	[ValueDecimal] [decimal](24, 7) NULL,
	[ValueDateTime] [datetime2](0) NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
 CONSTRAINT [PK_PersonalSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Equipment]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Equipment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundeI3D] [int] NULL,
	[TypI3D] [int] NULL,
	[Hersteller] [varchar](150) NULL,
	[Produkt] [varchar](150) NULL,
	[Seriennummer] [varchar](150) NULL,
	[Gebaeude] [varchar](150) NULL,
	[Stock] [varchar](150) NULL,
	[Zimmer] [varchar](150) NULL,
	[Netzwerkdose] [varchar](150) NULL,
	[ISDN] [varchar](150) NULL,
	[DetailSonstiges] [text] NULL,
	[Gehaeusetyp] [varchar](150) NULL,
	[Netzteil] [varchar](150) NULL,
	[Mainboard] [varchar](150) NULL,
	[CPU] [varchar](150) NULL,
	[RAM] [varchar](150) NULL,
	[Festplatten] [varchar](150) NULL,
	[Laufwerke] [varchar](150) NULL,
	[Grafikkarte] [varchar](150) NULL,
	[Netzwerkkarte] [varchar](150) NULL,
	[Soundkarte] [varchar](150) NULL,
	[HardwareSonstiges] [varchar](150) NULL,
	[Bios] [varchar](150) NULL,
	[OS] [varchar](150) NULL,
	[Office] [varchar](150) NULL,
	[Fernwartung] [varchar](150) NULL,
	[SoftwareSonstiges] [varchar](150) NULL,
	[IP] [varchar](150) NULL,
	[DNS] [varchar](150) NULL,
	[Gateway] [varchar](150) NULL,
	[Proxy] [varchar](150) NULL,
	[Aufloesung] [varchar](150) NULL,
	[Farbtiefe] [varchar](150) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Equipment] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EquipmentTyp]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EquipmentTyp](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](300) NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_EquipmentTyp] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EscalationsLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EscalationsLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Message] [nvarchar](255) NULL,
	[Date] [datetime] NOT NULL,
	[State] [int] NOT NULL,
 CONSTRAINT [PK_EscaltionsLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Eskalationen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Eskalationen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjektI3D] [int] NOT NULL,
	[Eskalation1Am] [datetime] NULL,
	[Eskalation2Am] [datetime] NULL,
	[Eskalation3Am] [datetime] NULL,
	[ErstelltAm] [datetime] NULL,
	[Status] [int] NULL,
	[ObArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EskalationStatistik]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EskalationStatistik](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
	[UrsprungTermin] [datetime] NULL,
	[Eskalation1Am] [datetime] NULL,
	[Eskalation2Am] [datetime] NULL,
	[Eskalation3Am] [datetime] NULL,
	[Eskalation3Anzahl] [int] NULL,
	[AbschlussDatum] [datetime] NULL,
	[EskalationI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EskalationTypen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EskalationTypen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EskalationsTyp] [int] NULL,
	[Beschreibung] [varchar](120) NULL,
	[Stunden1] [numeric](9, 2) NULL,
	[Stunden2] [numeric](9, 2) NULL,
	[Stunden3] [numeric](9, 2) NULL,
	[EskalationSa] [int] NULL,
	[EskalationSo] [int] NULL,
	[Status] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[GeschaeftsZeitVon] [datetime] NULL,
	[GeschaeftsZeitBis] [datetime] NULL,
	[ToDoListeArt] [int] NULL,
	[TicketPriorityI3D] [int] NULL,
	[IsObsolet] [bit] NULL,
	[Stage1Receivers] [int] NULL,
	[Stage2Receivers] [int] NULL,
	[Stage3Receivers] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[EstimatedProgressForHelpdesks]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EstimatedProgressForHelpdesks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HelpdeskI3D] [int] NOT NULL,
	[EstimatedProgressInPercent] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[CreatedAt] [datetime2](0) NOT NULL,
 CONSTRAINT [PK_EstimatedProgressForHelpdesks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ExceptionLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExceptionLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NOT NULL,
	[EClass] [varchar](50) NOT NULL,
	[EText] [varchar](500) NOT NULL,
	[UserName] [varchar](20) NOT NULL,
	[MachineName] [varchar](50) NULL,
	[SQLQuery] [varchar](1000) NULL,
	[Status] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ExpectedEventLogEntries]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExpectedEventLogEntries](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExpectedEventI3D] [int] NOT NULL,
	[Date] [datetime] NOT NULL,
	[Comment] [nvarchar](250) NULL,
	[EventType] [int] NOT NULL,
	[AccountI3D] [int] NOT NULL,
	[EventDate] [datetime] NULL,
	[FileName] [nvarchar](200) NULL,
	[File] [image] NULL,
	[HelpdeskI3D] [int] NULL,
	[MailID] [varchar](100) NULL,
 CONSTRAINT [PK_ExpectedEventLogEntries] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ExpectedEvents]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExpectedEvents](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[EventTriggeredBy] [nvarchar](100) NOT NULL,
	[IsEventMessageContains] [bit] NOT NULL,
	[MessageContains] [nvarchar](1000) NULL,
	[ExecuteOnDaysOfWeek] [int] NOT NULL,
	[ExecuteSundayFrom] [datetime] NULL,
	[ExecuteSundayTo] [datetime] NULL,
	[ExecuteMondayFrom] [datetime] NULL,
	[ExecuteMondayTo] [datetime] NULL,
	[ExecuteTuesdayFrom] [datetime] NULL,
	[ExecuteTuesdayTo] [datetime] NULL,
	[ExecuteWednesdayFrom] [datetime] NULL,
	[ExecuteWednesdayTo] [datetime] NULL,
	[ExecuteThursdayFrom] [datetime] NULL,
	[ExecuteThursdayTo] [datetime] NULL,
	[ExecuteFridayFrom] [datetime] NULL,
	[ExecuteFridayTo] [datetime] NULL,
	[ExecuteSaturdayFrom] [datetime] NULL,
	[ExecuteSaturdayTo] [datetime] NULL,
	[AccountI3D] [int] NULL,
	[Source] [nvarchar](100) NULL,
	[EventTriggerKind] [int] NOT NULL,
	[ExpectedEventType] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[TimeBetweenMonday] [bit] NULL,
	[ExpectedIncomeMonday] [int] NULL,
	[TimeBetweenTuesday] [bit] NULL,
	[ExpectedIncomeTuesday] [int] NULL,
	[TimeBetweenWednesday] [bit] NULL,
	[ExpectedIncomeWednesday] [int] NULL,
	[TimeBetweenThursday] [bit] NULL,
	[ExpectedIncomeThursday] [int] NULL,
	[TimeBetweenFriday] [bit] NULL,
	[ExpectedIncomeFriday] [int] NULL,
	[TimeBetweenSaturday] [bit] NULL,
	[ExpectedIncomeSaturday] [int] NULL,
	[TimeBetweenSunday] [bit] NULL,
	[ExpectedIncomeSunday] [int] NULL,
	[MessageContainsSuccess] [nvarchar](1000) NULL,
	[MessageContainsWarning] [nvarchar](1000) NULL,
	[MessageContainsError] [nvarchar](1000) NULL,
	[ExpectedEventTypeTime] [int] NOT NULL,
	[ExpectedEventTypeMessageContainsSuccess] [int] NOT NULL,
	[ExpectedEventTypeMessageContainsWarning] [int] NOT NULL,
	[ExpectedEventTypeMessageContainsError] [int] NOT NULL,
 CONSTRAINT [PK_ExpectedEvents] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ExportLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExportLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LogFileText] [text] NULL,
	[ErrorFileText] [text] NULL,
	[HeaderFile] [image] NULL,
	[DataFile] [image] NULL,
	[ExportTime] [datetime] NULL,
	[ExportUser] [int] NULL,
	[ExportKind] [int] NULL,
	[ExportFormat] [int] NULL,
	[Status] [int] NULL,
	[DataFile02] [image] NULL,
	[DataFile03] [image] NULL,
	[DataFile04] [image] NULL,
	[DataFile05] [image] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ExternalApplications]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExternalApplications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[Image] [image] NULL,
	[Name] [nvarchar](200) NOT NULL,
	[Path] [nvarchar](400) NOT NULL,
	[CommandLineParameters] [nvarchar](400) NULL,
	[CategoryI3D] [int] NOT NULL,
	[VPNRequired] [bit] NOT NULL,
 CONSTRAINT [PK_ExternalApplications] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ExternalTools]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ExternalTools](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](200) NOT NULL,
	[Path] [varchar](400) NULL,
	[Location] [varchar](25) NOT NULL,
	[CommandLineArguments] [varchar](400) NOT NULL,
	[SuccessAction] [int] NOT NULL,
	[IsDeactivated] [bit] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[ChangedBy] [int] NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
 CONSTRAINT [PK_ExternalTools] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FahrkTXT]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FahrkTXT](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kategorie] [int] NULL,
	[Land] [int] NULL,
	[Text] [varchar](60) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_FahrkTXT] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FahrzeugArt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FahrzeugArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FahrzeugArt] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FahrzeugBetankung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FahrzeugBetankung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FahrzeugI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Menge] [float] NULL,
	[Preis] [float] NULL,
	[PersonI3D] [int] NULL,
	[KMStand] [int] NULL,
	[Pos] [int] NULL,
	[Verbrauch] [float] NULL,
	[ScanDocI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_FahrzeugBetankung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Fahrzeuge]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Fahrzeuge](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MandantI3D] [int] NULL,
	[KundeI3D] [int] NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Erstzulassung] [datetime] NULL,
	[Tachostand] [int] NULL,
	[TUEV] [datetime] NULL,
	[ASU] [datetime] NULL,
	[KW] [int] NULL,
	[PS] [int] NULL,
	[Reifengroesse] [varchar](50) NULL,
	[Kennzeichen] [varchar](50) NULL,
	[Eingangsdatum] [datetime] NULL,
	[Motorart] [int] NULL,
	[BriefNr] [varchar](50) NULL,
	[IdentNr] [varchar](50) NULL,
	[Bild] [image] NULL,
	[Aktiv] [int] NULL,
	[PersonalI3D] [int] NULL,
	[RootDirI3D] [int] NULL,
	[TankDirI3D] [int] NULL,
	[BriefDirI3D] [int] NULL,
	[WarDirI3D] [int] NULL,
	[RepDirI3D] [int] NULL,
	[AnschaffungsPreis] [float] NULL,
	[Buchwert] [float] NULL,
	[FahrzeugArt] [int] NULL,
	[Kostenstelle] [int] NULL,
	[AbschreibungsDauer] [int] NULL,
	[ScanBriefI3D] [int] NULL,
	[Tankkarte] [varchar](50) NULL,
	[TankPasswort] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Fahrzeuge] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FahrzeuzgMotorart]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FahrzeuzgMotorart](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Motorart] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FertigungsPlanung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FertigungsPlanung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Ersteller] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[HilfsauftragI3D] [int] NULL,
	[AufPosI3D] [int] NULL,
	[Menge] [int] NULL,
	[Status] [int] NULL,
	[GeplBeginn] [datetime] NULL,
	[GeplEnde] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FibuExportBuchungstextEinstellungen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FibuExportBuchungstextEinstellungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BuchhaltungI3D] [int] NULL,
	[Typ] [int] NULL,
	[BuchungstextArt] [int] NULL,
	[VariablerText] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FilialeLeiter]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FilialeLeiter](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FilialeI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FilialeToLager]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FilialeToLager](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FilialI3D] [int] NULL,
	[LagerI3D] [int] NULL,
	[IsDefault] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FirmenStrukturen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FirmenStrukturen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundeI3D] [int] NULL,
	[ParentI3D] [int] NULL,
	[Bereich] [int] NULL,
	[KundenName] [varchar](50) NULL,
	[NumChildren] [int] NULL,
	[ImageIndex] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Forms]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Forms](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FileName] [varchar](50) NULL,
	[Resource] [image] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Forms] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FormularInformationen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FormularInformationen](
	[I3D] [int] NOT NULL,
	[FormularArt] [int] NULL,
	[FormularName] [varchar](255) NULL,
	[PersonalI3D] [int] NULL,
	[Beschreibung] [varchar](5000) NULL,
	[Status] [int] NULL,
	[Zeitstempel] [datetime] NULL,
 CONSTRAINT [PK_FormularInformationen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FreightArticleSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FreightArticleSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CustomerI3D] [int] NULL,
	[ExtendedAccountSearchI3D] [int] NULL,
	[Kind] [int] NOT NULL,
	[SalePriceUsePercentage] [bit] NULL,
	[SalePricePercentage] [float] NULL,
	[SalePriceMaxCost] [float] NOT NULL,
	[SalePriceMinCost] [float] NOT NULL,
	[PurchasePriceUsePercentage] [bit] NULL,
	[PurchasePricePercentage] [float] NULL,
	[PurchasePriceMaxCost] [float] NOT NULL,
	[PurchasePriceMinCost] [float] NOT NULL,
	[SetSalesPriceToZero] [bit] NOT NULL,
	[SalesPriceCanBeChangedManually] [bit] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FremdArtikelImportLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FremdArtikelImportLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[Text] [varchar](500) NULL,
	[HerstellerI3D] [int] NULL,
	[ImportArt] [int] NULL,
	[BearbeiterI3D] [int] NULL,
	[ServiceType] [int] NULL,
	[ErrorType] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FremdherstellerZuKreditor]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FremdherstellerZuKreditor](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Hersteller] [varchar](100) NULL,
	[HerstellerI3D] [int] NULL,
	[LieferantI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FremdImport]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FremdImport](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[HerstellerI3D] [int] NULL,
	[OpenDLG] [int] NULL,
	[DatenQuelle] [varchar](200) NULL,
	[Tabelle] [varchar](50) NULL,
	[Format] [int] NULL,
	[TrennZeichen] [varchar](50) NULL,
	[Ueberschrift] [int] NULL,
	[Code] [int] NULL,
	[Text] [int] NULL,
	[Text2] [int] NULL,
	[Text3] [int] NULL,
	[HEK] [int] NULL,
	[VK] [int] NULL,
	[Verfuegbarkeit] [int] NULL,
	[Hersteller] [int] NULL,
	[Sprache] [int] NULL,
	[EANCODE] [int] NULL,
	[Nachfolger] [int] NULL,
	[Garantie] [int] NULL,
	[SpezialEK] [int] NULL,
	[SpezialEKgiltBis] [int] NULL,
	[Hoehe] [int] NULL,
	[Breite] [int] NULL,
	[Laenge] [int] NULL,
	[Gewicht] [int] NULL,
	[Datenblatt] [int] NULL,
	[Bild] [int] NULL,
	[FTPAktiv] [int] NULL,
	[FTPServername] [varchar](50) NULL,
	[FTPDateiName] [varchar](50) NULL,
	[FTPVerzeichnis] [varchar](50) NULL,
	[FTPCkbVerzeichnis] [int] NULL,
	[FTPCkbDateiName] [int] NULL,
	[FTPAnonymus] [int] NULL,
	[FTPBenutzer] [varchar](50) NULL,
	[FTPPasswort] [varchar](50) NULL,
	[FTPTimeout] [int] NULL,
	[FTPPassiveTransfer] [int] NULL,
	[FTPPort] [int] NULL,
	[FTPRemotePort] [int] NULL,
	[Beschreibung] [varchar](500) NULL,
	[Filecompress] [int] NULL,
	[FTPCkbVerzeichnist] [int] NULL,
	[LetzteAenderung] [varchar](50) NULL,
	[LetzteAenderung_Am] [datetime] NULL,
	[KreditorI3D] [int] NULL,
	[FTPAutomatisierung] [int] NULL,
	[Zyklus] [int] NULL,
	[ZeitVorgabeStunde] [int] NULL,
	[ZeitVorgabeMinute] [int] NULL,
	[HttpBenutzer] [varchar](50) NULL,
	[HttpPasswort] [varchar](50) NULL,
	[HttpDateiName] [varchar](50) NULL,
	[HttpServername] [varchar](1000) NULL,
	[HttpBasicAuthentication] [int] NULL,
	[DatenblattLink] [varchar](100) NULL,
	[BildLink] [varchar](100) NULL,
	[KreditorNr] [int] NULL,
	[Hauptartikel] [int] NULL,
	[Zubehoerartikel] [int] NULL,
	[SourceFilenames] [varchar](1000) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK__FremdImport__4CE05A84] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FullTextIndexSearchTextDummyTable]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FullTextIndexSearchTextDummyTable](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Description] [nvarchar](255) NULL,
 CONSTRAINT [PK_FullTextIndexSearchTextDummyTable] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteClickZaehler]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteClickZaehler](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Bezeichnung] [varchar](250) NULL,
	[StandAktuell] [int] NULL,
	[ZaehlerArtI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[StandAngelegt] [int] NULL,
	[Status] [int] NULL,
	[SeriennummerI3D] [int] NULL,
 CONSTRAINT [PK_GeraeteClickZaehler] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteClickZaehlerHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteClickZaehlerHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GeraeteClickZaehlerI3D] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVon] [int] NULL,
	[Grund] [varchar](500) NULL,
	[AlterStand] [int] NULL,
	[NeuerStand] [int] NULL,
	[NeuerStandDatum] [datetime] NULL,
	[Abgerechnet] [int] NULL,
	[VertragKopfI3D] [int] NULL,
	[RechPosI3D] [int] NULL,
	[VertragStartwert] [int] NULL,
	[PrognoseWert] [int] NULL,
	[Status] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[IsAutomaticallyImported] [bit] NULL,
	[SeriennummerI3D] [int] NULL,
	[importFileName] [nvarchar](200) NULL,
	[ImportID] [int] NULL,
 CONSTRAINT [PK_GeraeteClickZaehlerHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteCMan]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteCMan](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ParentI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[ComputerID] [varchar](255) NULL,
	[DeviceID] [int] NULL,
	[BeginDate] [datetime] NULL,
	[EndDate] [datetime] NULL,
	[Attribut01] [varchar](255) NULL,
	[Attribut02] [varchar](255) NULL,
	[Attribut03] [varchar](255) NULL,
	[Attribut04] [varchar](255) NULL,
	[Attribut05] [varchar](255) NULL,
	[Attribut06] [varchar](255) NULL,
	[Attribut07] [varchar](255) NULL,
	[Attribut08] [varchar](255) NULL,
	[Attribut09] [varchar](255) NULL,
	[Attribut10] [varchar](255) NULL,
	[Attribut11] [varchar](255) NULL,
	[Attribut12] [varchar](255) NULL,
	[Attribut13] [varchar](255) NULL,
	[Attribut14] [varchar](255) NULL,
	[Attribut15] [varchar](255) NULL,
	[Attribut16] [varchar](255) NULL,
	[Attribut17] [varchar](255) NULL,
	[Attribut18] [varchar](255) NULL,
	[Attribut19] [varchar](255) NULL,
	[Attribut20] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteCManAttribut]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteCManAttribut](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceID] [int] NULL,
	[AttributNr] [int] NULL,
	[Text] [varchar](255) NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteCManClientSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteCManClientSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[ComputerID] [varchar](255) NULL,
	[SchwellwertPartitionKapazitaet] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteCManDevice]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteCManDevice](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](255) NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteCManEventLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteCManEventLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ComputerID] [varchar](255) NULL,
	[Datum] [datetime] NULL,
	[Text] [text] NULL,
	[EventLogArt] [varchar](20) NULL,
	[LogType] [int] NULL,
	[Source] [varchar](255) NULL,
	[Identifier] [varchar](255) NULL,
	[Kategorie] [varchar](20) NULL,
	[Code] [varchar](20) NULL,
	[Benutzer] [varchar](50) NULL,
	[ComputerName] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteCManServerSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteCManServerSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[Port] [int] NULL,
	[LogDatei] [varchar](255) NULL,
	[SchwellwertLogDatei] [varchar](255) NULL,
	[FarbeSystemnachricht] [varchar](50) NULL,
	[FarbeClientVerbunden] [varchar](50) NULL,
	[FarbeNachrichtVonClient] [varchar](50) NULL,
	[FarbeFehlermeldungVonClient] [varchar](50) NULL,
	[FarbeClientGetrennt] [varchar](50) NULL,
	[FarbeSupportAnfrageDesClients] [varchar](50) NULL,
	[FarbeErrormeldungDesClients] [varchar](50) NULL,
	[PfadClientEXE] [varchar](255) NULL,
	[PfadClientService] [varchar](255) NULL,
	[PfadClientDLL] [varchar](255) NULL,
	[FTPIndex] [int] NULL,
	[FTPAuswahl1] [datetime] NULL,
	[FTPAuswahl2] [datetime] NULL,
	[FTPAuswahl3] [datetime] NULL,
	[SchwellwertPartitionKapazitaet] [int] NULL,
	[Status] [int] NULL,
	[Uebertragungsart] [int] NULL,
	[FTPHost] [varchar](50) NULL,
	[FTPUsername] [varchar](50) NULL,
	[FTPPassword] [varchar](50) NULL,
	[FTPPort] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteWartung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteWartung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Objekt] [varchar](150) NULL,
	[Wartungsarbeit] [varchar](150) NULL,
	[Version] [int] NULL,
	[Intervall] [int] NULL,
	[IntervallArt] [int] NULL,
	[VorlaufIntervall] [int] NULL,
	[VorlaufIntervallArt] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Zuletzt] [datetime] NULL,
	[Faellig] [datetime] NULL,
	[Beschreibung] [text] NULL,
	[AngelegtAm] [datetime] NULL,
	[AngelegtVon] [int] NULL,
	[Status] [int] NULL,
	[IntervallText] [varchar](50) NULL,
	[Memo] [varchar](500) NULL,
	[ScanDocI3D] [int] NULL,
	[RechnungTemplateI3D] [int] NULL,
	[IntervallText1] [varchar](50) NULL,
	[Aktiv] [int] NULL,
	[ToDoListeI3D] [int] NULL,
 CONSTRAINT [PK_GeraeteWartung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeraeteWartungHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeraeteWartungHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungI3D] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Objekt] [varchar](150) NULL,
	[Wartungsarbeit] [varchar](150) NULL,
	[Version] [int] NULL,
	[Intervall] [int] NULL,
	[IntervallArt] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Zuletzt] [datetime] NULL,
	[Faellig] [datetime] NULL,
	[Beschreibung] [text] NULL,
	[Datum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[Memo] [varchar](500) NULL,
	[RechKopfI3D] [int] NULL,
	[Bemerkungen] [text] NULL,
	[BearbeitetAm] [datetime] NULL,
	[IntervallText] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_GeraeteWartungHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeschaeftspartnerTextbausteineGruppen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GeschaeftspartnerTextbausteineGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](100) NULL,
	[Status] [int] NULL,
	[ServiceBoardWebColor] [varchar](30) NULL,
	[ServiceBoardWebIcon] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GfiChecks]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GfiChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CheckID] [int] NOT NULL,
	[ClientID] [int] NOT NULL,
	[HelpdeskI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[gi_Grid]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[gi_Grid](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[gi_GridColumn]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[gi_GridColumn](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GridId] [int] NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[TagName] [nvarchar](200) NOT NULL,
	[Width] [int] NOT NULL,
	[IsDefaultColumn] [bit] NOT NULL,
	[SequenceNumber] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[gi_GridUserSetting]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[gi_GridUserSetting](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GridColumnId] [int] NOT NULL,
	[PersonalId] [int] NOT NULL,
	[GridColumnWidth] [int] NOT NULL,
	[SequenceNo] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GlobalLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GlobalLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
	[ObjektNummer] [int] NULL,
	[BearbeiterI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Wert] [varchar](150) NULL,
	[AlterWert] [text] NULL,
	[NeuerWert] [text] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GroupToContingent]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GroupToContingent](
	[ContractI3D] [int] NOT NULL,
	[Kind] [int] NOT NULL,
	[ElementI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GroupwareEntryIDs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GroupwareEntryIDs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
	[EntryID] [varchar](500) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GutKopfErweitert]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GutKopfErweitert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GutkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GutKopfErweitertVersions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GutKopfErweitertVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GutkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[OriginalI3D] [int] NULL,
	[Version] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GutProv]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GutProv](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GutKopfI3D] [int] NOT NULL,
	[GutNummer] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[Provision] [float] NULL,
	[Standard] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GutscheinZuRechnung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GutscheinZuRechnung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[SNI3D] [int] NULL,
	[AktivierungRechPosI3D] [int] NULL,
	[EingeloestRechPosI3D] [int] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HelpdeskCategoryToSkillAssignment]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HelpdeskCategoryToSkillAssignment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CategoryI3D] [int] NOT NULL,
	[SkillGroupI3D] [int] NOT NULL,
 CONSTRAINT [PK_HelpdeskCategoryToSkillAssignment] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HelpdeskFavorites]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HelpdeskFavorites](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[HelpdeskI3D] [int] NOT NULL,
	[ResubmissionDate] [datetime2](0) NULL,
	[ResubmissionText] [nvarchar](1000) NULL,
 CONSTRAINT [PK_HelpdeskFavorites] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HelpdeskSolutionDocuments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HelpdeskSolutionDocuments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SolutionI3D] [int] NOT NULL,
	[DocumentI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HelpdeskTimerBillingStates]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HelpdeskTimerBillingStates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
 CONSTRAINT [PK_HelpdeskTimerBillingStates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HelpdeskTimeRecording]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HelpdeskTimeRecording](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HelpdeskI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Date] [datetime] NOT NULL,
	[Kind] [int] NOT NULL,
	[Comment] [varchar](2000) NULL,
	[LastClosed] [datetime2](0) NULL,
	[Guid] [nvarchar](50) NULL,
	[CustomerContactI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HelpdeskTimerSpecialArticles]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HelpdeskTimerSpecialArticles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HelpdeskTimerI3D] [int] NULL,
	[ArticleI3D] [int] NULL,
	[SettlementType] [int] NULL,
	[Multiplier] [decimal](19, 7) NULL,
	[Price] [float] NULL,
 CONSTRAINT [PK_HelpdeskTimerSpecialArticles] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerArtikAktionspreis]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerArtikAktionspreis](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[Preis] [float] NULL,
	[Distributor] [varchar](100) NULL,
	[GueltigAb] [datetime] NULL,
	[GueltigBis] [datetime] NULL,
	[Text] [varchar](500) NULL,
	[Hersteller] [varchar](60) NULL,
	[BearbeiterI3D] [int] NULL,
	[EDI_I3D] [int] NULL,
	[Verfuegbarkeit] [varchar](50) NULL,
	[VK] [float] NULL,
	[Kreditorcode] [varchar](50) NULL,
	[Status] [int] NULL,
	[DistID] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerArtikStaffelpreise]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerArtikStaffelpreise](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HerstellerArtikI3D] [int] NULL,
	[Menge1] [float] NULL,
	[EVP1] [float] NULL,
	[Menge2] [float] NULL,
	[EVP2] [float] NULL,
	[Menge3] [float] NULL,
	[EVP3] [float] NULL,
	[Menge4] [float] NULL,
	[EVP4] [float] NULL,
	[Menge5] [float] NULL,
	[EVP5] [float] NULL,
	[Status] [int] NULL,
	[EKMenge1] [float] NULL,
	[EKPreis1] [float] NULL,
	[EKMenge2] [float] NULL,
	[EKPreis2] [float] NULL,
	[EKMenge3] [float] NULL,
	[EKPreis3] [float] NULL,
	[EKMenge4] [float] NULL,
	[EKPreis4] [float] NULL,
	[EKMenge5] [float] NULL,
	[EKPreis5] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerBisher]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerBisher](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_HerstellerBisher] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerDrucker]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerDrucker](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_HerstellerDrucker] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerImport]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerImport](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HerstellerI3D] [int] NULL,
	[Name] [varchar](50) NULL,
	[DownloadType] [int] NULL,
	[FileType] [int] NULL,
	[FileCompression] [int] NULL,
	[SourcePath] [varchar](200) NULL,
	[SourceFilename] [varchar](200) NULL,
	[FTPServer] [varchar](500) NULL,
	[FTPPort] [int] NULL,
	[FTPAnonymous] [int] NULL,
	[FTPUsername] [varchar](100) NULL,
	[FTPPassword] [varchar](100) NULL,
	[FTPTimeout] [int] NULL,
	[FTPPassiveTransfer] [int] NULL,
	[HTTPServer] [varchar](500) NULL,
	[HTTPPort] [int] NULL,
	[HTTPUsername] [varchar](100) NULL,
	[HTTPPassword] [varchar](100) NULL,
	[HTTPAuthentification] [int] NULL,
	[ServiceActive] [int] NULL,
	[ServiceInterval] [int] NULL,
	[ServiceHour] [int] NULL,
	[ServiceMinute] [int] NULL,
	[FileFormat] [int] NULL,
	[Delimiter] [int] NULL,
	[IgnoreFirstLine] [int] NULL,
	[LetzterImportAusCentron] [int] NULL,
	[LetzterImportDatum] [datetime] NULL,
	[LetzterImportPersonalI3D] [int] NULL,
	[DecimalSeparator] [varchar](1) NULL,
	[Filter] [varchar](255) NULL,
	[ErsetzenMit] [varchar](255) NULL,
	[Status] [int] NULL,
	[ServiceType] [int] NULL,
	[SourceFilenameInZip] [varchar](200) NULL,
	[AnzahlDatensaetze] [int] NULL,
	[Kommentar] [varchar](500) NULL,
	[CharsetConvert] [int] NULL,
	[FieldMarginChar] [varchar](1) NULL,
	[IsAvailabilityList] [int] NULL,
	[DeleteOnFail] [int] NULL,
	[MultiImport] [int] NULL,
	[StandardPDL] [int] NULL,
	[StandardListenpreis] [int] NULL,
	[DateiFelder] [image] NULL,
	[EGISDistributoren] [image] NULL,
	[DistributorFeld] [int] NULL,
	[InPreismatrixAnzeigen] [int] NULL,
	[BeschreibungInZeile] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerImportDateien]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerImportDateien](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HerstellerImportI3D] [int] NULL,
	[Filename] [varchar](200) NULL,
	[Content] [image] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerImportMultiDistributoren]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerImportMultiDistributoren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HerstellerImportI3D] [int] NULL,
	[DistributorName] [varchar](50) NULL,
	[Status] [int] NULL,
	[HerstellerI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerImportZuweisung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerImportZuweisung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HerstellerImportI3D] [int] NULL,
	[Pos] [int] NULL,
	[CentronFieldID] [int] NULL,
	[Prefix] [varchar](200) NULL,
	[DistributorFieldID] [int] NULL,
	[Postfix] [varchar](200) NULL,
	[Filter] [varchar](255) NULL,
	[ErsetzenMit] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerPC]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerPC](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_HerstellerPC] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerServer]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerServer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_HerstellerServer] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerVerfuegbarToCentron]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerVerfuegbarToCentron](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HerstellerI3D] [int] NULL,
	[Menge] [float] NULL,
	[HerstellerVerfuegbar] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HerstellerWarenZuWaren]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HerstellerWarenZuWaren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HerstellerI3D] [int] NULL,
	[HerstellerWarengruppe] [varchar](40) NULL,
	[HerstellerUnterwarengruppe] [varchar](40) NULL,
	[HerstellerUnterwarengruppe2] [varchar](40) NULL,
	[Warengruppe] [int] NULL,
	[UnterwarengruppeI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_8DReport]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_8DReport](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[hlpdsk_requestsI3D] [int] NULL,
	[ProjektNr] [varchar](20) NULL,
	[AuftragsNr] [varchar](20) NULL,
	[InternerFehler] [int] NULL,
	[ZuliefererFehler] [int] NULL,
	[GeraeteNr] [varchar](100) NULL,
	[PersonalI3D] [int] NULL,
	[ExtBearbeiter] [varchar](100) NULL,
	[Melder] [varchar](100) NULL,
	[SN] [varchar](500) NULL,
	[AnzahlGeraete] [int] NULL,
	[AnzahlBetroffeneGeraete] [int] NULL,
	[AnzahlZurueck] [int] NULL,
	[Hauptabweichung] [int] NULL,
	[Nebenabweichung] [int] NULL,
	[Korrekturmassnahmen] [text] NULL,
	[Praeventivmassnahmen] [text] NULL,
	[Status] [int] NULL,
	[ErledigtVon] [varchar](100) NULL,
	[ErledigtAm] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Code] [varchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_8DReportTexte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_8DReportTexte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[hlpdsk_8DReportI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[Name] [varchar](100) NULL,
	[Datum] [datetime] NULL,
	[Art] [int] NULL,
	[Status] [int] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_cmanage]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_cmanage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HelpdeskI3D] [int] NULL,
	[CManageI3D] [int] NULL,
	[CManageDataType] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HlpDsk_Geraete]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HlpDsk_Geraete](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[HlpDskI3D] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Standard] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_history_empfaenger]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_history_empfaenger](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HistoryI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[TodoI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_hlpdsk_history_empfaenger] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_loesungen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_loesungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Beschreibung] [text] NULL,
	[HauptkategorieI3D] [int] NULL,
	[Unterkategorie1I3D] [int] NULL,
	[Unterkategorie2I3D] [int] NULL,
	[Loesung] [text] NULL,
	[ErstellerI3D] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[giltAlle] [int] NULL,
	[Bezeichnung] [varchar](1000) NULL,
	[BearbeiterI3D] [int] NULL,
	[LoesungRichtext] [text] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_hlpdsk_loesungen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_nable_link]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_nable_link](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HelpdeskI3D] [int] NOT NULL,
	[ActiveNotificationTriggerID] [nvarchar](128) NOT NULL,
	[TaskIdent] [nvarchar](256) NOT NULL,
	[DeviceID] [nvarchar](256) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_Notify]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_Notify](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HDI3D] [int] NOT NULL,
	[DeviceID] [nvarchar](256) NOT NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_hlpdsk_Notify] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_notify_history]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_notify_history](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HD_HistoryI3D] [int] NOT NULL,
	[Status] [int] NULL,
	[Datum] [datetime] NULL,
 CONSTRAINT [PK_hlpdsk_notify_history] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_requests_signature]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_requests_signature](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RequestI3D] [int] NOT NULL,
	[HelpdeskSignature] [image] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_templatekopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_templatekopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Beschreibung] [text] NULL,
	[HauptkategorieI3D] [int] NULL,
	[Unterkategorie1I3D] [int] NULL,
	[Unterkategorie2I3D] [int] NULL,
	[hlpdsk_typenI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_hlpdsk_templatekopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_templatepos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_templatepos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateI3D] [int] NULL,
	[Sort] [int] NULL,
	[Was] [varchar](300) NULL,
	[Bearbeiter] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_hlpdsk_templatepos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_timer_log]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_timer_log](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[hlpdsk_timer_I3D] [int] NULL,
	[StartAlt] [datetime] NULL,
	[StopAlt] [datetime] NULL,
	[TimerAlt] [int] NULL,
	[BemerkungAlt] [varchar](2000) NULL,
	[BerechenbarAlt] [int] NULL,
	[hlpdsk_timer_typenI3DAlt] [int] NULL,
	[StartNeu] [datetime] NULL,
	[StopNeu] [datetime] NULL,
	[TimerNeu] [int] NULL,
	[BemerkungNeu] [varchar](2000) NULL,
	[BerechenbarNeu] [int] NULL,
	[hlpdsk_timer_typenI3DNeu] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[InterneNotizAlt] [varchar](2000) NULL,
	[InterneNotizNeu] [varchar](2000) NULL,
	[Status] [int] NULL,
	[Bewertung] [int] NULL,
	[GeplantAlt] [int] NULL,
	[LunchTimeAlt] [int] NULL,
	[DeviceI3D] [int] NULL,
	[ContractI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[ArtikelI3DNeu] [int] NULL,
	[ArtikelI3DAlt] [int] NULL,
	[Action] [nvarchar](max) NULL,
	[LunchTimeNew] [int] NULL,
	[PlannedNew] [bit] NULL,
	[ContractI3DOld] [int] NULL,
	[DeviceI3DOld] [int] NULL,
	[ArticleWorkItemI3DOld] [int] NULL,
	[ArticleWorkItemI3DNew] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_timer_settings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_timer_settings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RequestTimeI3D] [int] NOT NULL,
	[SignatureVisible] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_timer_signature]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_timer_signature](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RequestTimeI3D] [int] NOT NULL,
	[TimeSignature] [image] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[hlpdsk_timer_typen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[hlpdsk_timer_typen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](300) NULL,
	[Status] [int] NULL,
	[WithAddressSpecialArticle] [bit] NULL,
	[Color] [varchar](10) NULL,
	[WithCustomerSpecialArticle] [bit] NULL,
	[Deactivated] [bit] NULL,
	[IsDefault] [bit] NULL,
	[JourneyToRequired] [bit] NULL,
	[JourneyFromRequired] [bit] NULL,
	[ServiceBoardWebColor] [varchar](30) NULL,
	[ServiceBoardWebIcon] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Hotline]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Hotline](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenID] [int] NULL,
	[KreditorID] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Username] [varchar](60) NULL,
	[Passwort] [varchar](60) NULL,
	[IP] [varchar](50) NULL,
	[Subnet] [varchar](15) NULL,
	[Einwahl] [varchar](50) NULL,
	[Komment] [varchar](1000) NULL,
	[Status] [int] NULL,
	[Link] [varchar](500) NULL,
 CONSTRAINT [PK_Hotline] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HotlineCustomCategories]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HotlineCustomCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Image] [image] NULL,
	[IsActive] [bit] NOT NULL,
	[RDPHost] [nvarchar](40) NULL,
	[RDPDomain] [nvarchar](40) NULL,
	[RDPUsername] [nvarchar](40) NULL,
	[RDPPassword] [nvarchar](40) NULL,
	[TVID] [nvarchar](40) NULL,
	[TVPassword] [nvarchar](40) NULL,
	[SSHHost] [nvarchar](40) NULL,
	[SSHUsername] [nvarchar](40) NULL,
	[SSHPassword] [nvarchar](40) NULL,
	[TVPath] [nvarchar](400) NULL,
	[RDPVPNRequired] [bit] NOT NULL,
	[SSHVPNRequired] [bit] NOT NULL,
	[RDPPort] [nvarchar](40) NULL,
	[SSHPort] [nvarchar](40) NULL,
 CONSTRAINT [PK_HotlineCustomCategories] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HotlineCustomItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HotlineCustomItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](64) NOT NULL,
	[HotlineCustomCategoryI3D] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[EditorI3D] [int] NULL,
 CONSTRAINT [PK_HotlineCustomItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HourlySurchargeRateItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HourlySurchargeRateItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HeadI3D] [int] NULL,
	[StartTime] [datetime] NULL,
	[EndTime] [datetime] NULL,
	[MondayPercent] [decimal](18, 4) NULL,
	[TuesdayPercent] [decimal](18, 4) NULL,
	[WednesdayPercent] [decimal](18, 4) NULL,
	[ThursdayPercent] [decimal](18, 4) NULL,
	[FridayPercent] [decimal](18, 4) NULL,
	[SaturdayPercent] [decimal](18, 4) NULL,
	[SundayPercent] [decimal](18, 4) NULL,
	[HolidayPercent] [decimal](18, 4) NULL,
 CONSTRAINT [PK_HourlySurchargeRateItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HourlySurchargeRateLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HourlySurchargeRateLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Date] [datetime2](7) NOT NULL,
	[RateI3D] [int] NOT NULL,
	[Caption] [nvarchar](max) NULL,
 CONSTRAINT [PK_HourlySurchargeRateLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HourlySurchargeRates]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HourlySurchargeRates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_HourlySurchargeRates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[I3D]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[I3D](
	[I3D] [int] NOT NULL,
	[Barcode] [int] NULL,
	[KW] [int] NULL,
	[Version] [int] NULL,
	[Version2] [int] NULL,
	[Konvertierung] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK__I3D__7F36D027] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ICUConfig]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ICUConfig](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ServiceName] [varchar](120) NULL,
	[ServiceTyp] [int] NULL,
	[ServiceActive] [int] NULL,
	[ServiceInterval] [int] NULL,
	[ServiceHour] [int] NULL,
	[ServiceMinute] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ImportHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImportHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedVersion] [nvarchar](16) NOT NULL,
	[ImportKind] [int] NOT NULL,
	[ImportFileName] [nvarchar](200) NULL,
	[ImportFileData] [varbinary](max) NULL,
	[ImportedFileName] [nvarchar](200) NOT NULL,
	[ImportedFileData] [varbinary](max) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[ChangedVersion] [nvarchar](16) NOT NULL,
 CONSTRAINT [PK_ImportHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ImportLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImportLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ImportTime] [datetime] NULL,
	[ImportUser] [int] NULL,
	[ImportKind] [int] NULL,
	[ImportFileText] [text] NULL,
	[Status] [int] NULL,
	[ImportForBranches] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Imports]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Imports](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ActUniqueID] [varchar](12) NULL,
	[ActETime] [datetime] NULL,
	[PersonI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InfoMail]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InfoMail](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InfoMailName] [varchar](50) NULL,
	[Status] [int] NOT NULL,
	[GruppenI3D] [varchar](200) NULL,
	[PersonalI3D] [varchar](200) NULL,
	[Betreff] [varchar](50) NULL,
	[MailBody] [text] NULL,
	[Absender] [varchar](50) NULL,
	[UhrZeit] [datetime] NULL,
	[GesendetAm] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Interesse]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Interesse](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InventoryLogs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InventoryLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InventoryI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Date] [datetime] NOT NULL,
	[Notification] [nvarchar](4000) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Inventur]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Inventur](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[Text] [varchar](50) NULL,
	[SNErfassung] [int] NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
	[LagerwertVorher] [float] NULL,
	[LagerwertNachher] [float] NULL,
	[Lieferwert] [float] NULL,
	[Lager] [int] NULL,
 CONSTRAINT [PK_Inventur] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InventurArtikel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InventurArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InventurI3D] [int] NULL,
	[InventurGruppenI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Menge] [float] NULL,
	[NebenlagerI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_InventurArtikel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InventurArtikels]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InventurArtikels](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InventurI3D] [int] NOT NULL,
	[BearbeiterI3D] [int] NOT NULL,
	[ArtikelI3D] [int] NOT NULL,
	[GruppeI3D] [int] NOT NULL,
	[LagerI3D] [int] NULL,
	[LagerOrtI3D] [int] NULL,
	[Status] [int] NULL,
	[Menge] [int] NULL,
	[SerienNummerI3D] [int] NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NULL,
	[ArticleUnitGroupI3D] [int] NULL,
	[OriginalAmountForArticleUnitGroup] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InventurBuchungen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InventurBuchungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InventurI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Art] [int] NULL,
	[Vorher] [float] NULL,
	[Nachher] [float] NULL,
	[EK] [float] NULL,
	[NebenlagerI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_InventurBuchungen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InventurBuchungenLager]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InventurBuchungenLager](
	[i3d] [int] IDENTITY(1,1) NOT NULL,
	[InventurI3D] [int] NULL,
	[LagerI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[i3d] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InventurGruppen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InventurGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InventurI3D] [int] NULL,
	[Text] [varchar](50) NULL,
	[LockUser] [varchar](50) NULL,
	[NebenlagerI3D] [int] NULL,
	[Nebenlager] [varchar](250) NULL,
	[Status] [int] NULL,
	[IsAutomaticGroup] [bit] NULL,
 CONSTRAINT [PK_InventurGruppen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InventurLieferscheine]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InventurLieferscheine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InventurI3D] [int] NOT NULL,
	[ArtikelI3D] [int] NOT NULL,
	[Artikelcode] [varchar](60) NULL,
	[Text] [varchar](8000) NULL,
	[Stk] [float] NOT NULL,
	[EK] [float] NOT NULL,
	[VK] [float] NOT NULL,
	[Status] [int] NULL,
	[WarehouseI3D] [int] NULL,
 CONSTRAINT [PK_InventurLieferscheine] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[InventurSeriennummern]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[InventurSeriennummern](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InventurI3D] [int] NULL,
	[InventurGruppenI3D] [int] NULL,
	[InventurArtikelI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[SeriennummerI3D] [int] NULL,
	[Seriennummer] [varchar](50) NULL,
	[NebenlagerI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_InventurSeriennummern] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[iSeminare]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[iSeminare](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[Link] [varchar](255) NULL,
	[iSeminareModeratorenI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[iSeminareModeratoren]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[iSeminareModeratoren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Vorname] [varchar](255) NULL,
	[Beschreibung] [text] NULL,
	[Bild] [image] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[iSeminareModZuordnung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[iSeminareModZuordnung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[iSeminareI3D] [int] NULL,
	[iSeminareModeratorenI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ITScopeEDILog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ITScopeEDILog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Date] [datetime2](0) NULL,
	[OrderID] [nvarchar](50) NULL,
	[TransactionID] [nvarchar](50) NULL,
	[Description] [nvarchar](500) NULL,
	[State] [int] NULL,
	[AttemtingNumber] [int] NULL,
 CONSTRAINT [PK_ITScopeEDILog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ITscopeStammdaten]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ITscopeStammdaten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[xmlFile] [text] NULL,
	[xmlArt] [int] NULL,
	[xmlArtText] [varchar](30) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ITScopeTexte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ITScopeTexte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[AttributID] [varchar](30) NULL,
	[Beschreibung] [varchar](50) NULL,
	[Rigiditaetswert] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Jobs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Jobs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](50) NULL,
	[ToDoAbteilung] [int] NULL,
	[Objekt] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Jobs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KassenbuchAbschluss]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KassenbuchAbschluss](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[SaldoGesamt] [float] NULL,
	[SaldoLetzterSchluss] [float] NULL,
	[SaldoDifferenz] [float] NULL,
	[KBLaufnummer] [int] NULL,
	[BranchI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KassenBuchChangeLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KassenBuchChangeLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[KassenbuchI3D] [int] NULL,
	[BranchI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KassenbuchZaehlHilfeLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KassenbuchZaehlHilfeLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Log] [text] NULL,
	[Datum] [datetime] NULL,
	[Status] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[FilialI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KassendisplayFilialEinstellungen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KassendisplayFilialEinstellungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FilialI3D] [int] NULL,
	[BarKundenI3D] [int] NULL,
	[Kassenkonto] [varchar](20) NULL,
	[SchubladeVerwenden] [int] NULL,
	[SchubladePort] [varchar](20) NULL,
	[SchubladeBaud] [int] NULL,
	[SchubladeInterval] [int] NULL,
	[SchubladeArt] [int] NULL,
	[SchubladeCommand] [varchar](255) NULL,
	[DisplayVerwenden] [int] NULL,
	[DisplayPort] [varchar](20) NULL,
	[DisplayBaud] [int] NULL,
	[DisplaySpalten] [int] NULL,
	[DisplayZeilen] [int] NULL,
	[DisplayReset] [varchar](255) NULL,
	[DisplayAnzeigeArtikel] [varchar](255) NULL,
	[DisplayAnzeigePreis] [varchar](255) NULL,
	[DisplayAnzeigeSumme] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Kategorie]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kategorie](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](60) NULL,
	[Farbe] [varchar](30) NULL,
	[Standtage] [int] NULL,
	[Bild] [image] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Kategorie] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KdDivers]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KdDivers](
	[Kundennummer] [float] NULL,
	[Status] [int] NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KdKategorie]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KdKategorie](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KdID] [int] NULL,
	[KateID] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_KdKategorie] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KdObjekt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KdObjekt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjArtID] [int] NULL,
	[Text] [varchar](60) NULL,
	[Visible] [int] NULL,
	[RightID] [int] NULL,
	[ObjData] [image] NULL,
	[DataSize] [int] NULL,
	[CreationDate] [datetime] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_KdObjekt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KdProjekt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KdProjekt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](60) NULL,
	[Visible] [int] NULL,
	[RightID] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_KdProjekt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KdProjektItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KdProjektItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenID] [int] NULL,
	[ProjectID] [int] NULL,
	[ObjectID] [int] NULL,
	[ParentID] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_KdProjektItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KontakteAnschriften]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KontakteAnschriften](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
	[KontakteI3D] [int] NULL,
	[Standard] [int] NULL,
	[Kommentar] [varchar](500) NULL,
	[Strasse] [varchar](200) NULL,
	[PLZ] [varchar](10) NULL,
	[Ort] [varchar](30) NULL,
	[LandI3D] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[PostfachAktiv] [int] NULL,
	[UmsatzStIdentNr] [varchar](10) NULL,
	[MwStKennzeichen] [int] NULL,
	[EG] [int] NULL,
	[Faxverteiler] [int] NULL,
	[Mailverteiler] [int] NULL,
	[Abteilung] [varchar](255) NULL,
	[AccountAddressReferenceI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Kostenart]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kostenart](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MandantI3D] [int] NOT NULL,
	[Kostenart] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Kostenart] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Kostenstelle]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Kostenstelle](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MandantI3D] [int] NOT NULL,
	[Kostenstelle] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Kostenstelle] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KostenstellenArt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KostenstellenArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KostenstellenI3D] [int] NULL,
	[KstArt] [int] NULL,
	[KstArtName] [varchar](10) NULL,
	[Bereich] [varchar](10) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_KostenstellenArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KostenstellenBackup]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KostenstellenBackup](
	[I3D] [int] NULL,
	[ParentI3D] [int] NULL,
	[Text] [varchar](50) NULL,
	[Nummer] [int] NULL,
	[Status] [int] NULL,
	[Name] [varchar](100) NULL,
	[SollDB] [float] NULL,
	[KostentraegerI3D] [int] NULL,
	[Beschreibung] [varchar](255) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KreditorCodes]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KreditorCodes](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelCode] [varchar](60) NULL,
	[KreditorI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_KreditorCodes] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KreditorRMAKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KreditorRMAKopf](
	[I3D] [int] NOT NULL,
	[Nummer] [int] NULL,
	[KreditorI3D] [int] NULL,
	[Empfanger] [varchar](300) NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[ErstellerPersonalI3D] [int] NULL,
	[Ersteller] [varchar](25) NULL,
	[Versanddatum] [datetime] NULL,
	[Retourdatum] [datetime] NULL,
	[Tel] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[EMail] [varchar](50) NULL,
	[Status] [int] NULL,
	[PaketNr] [varchar](50) NULL,
	[ReNrLief] [int] NULL,
	[ReNrKunde] [int] NULL,
	[KundenName] [varchar](150) NULL,
	[VersandArtI3D] [int] NULL,
 CONSTRAINT [PK_KreditorRMAKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KreditorRMAPos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KreditorRMAPos](
	[I3D] [int] NOT NULL,
	[KreditorRMAKopfI3D] [int] NULL,
	[KundenRMAI3D] [int] NULL,
	[KundenRMANummer] [int] NULL,
	[RMANummer] [varchar](30) NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](15) NULL,
	[Artikeltext] [varchar](255) NULL,
	[SeriennummerI3D] [int] NULL,
	[Seriennummer] [varchar](80) NULL,
	[RechPosI3D] [int] NULL,
	[Status] [int] NULL,
	[ErstellDatum] [datetime] NULL,
	[ErstellPersonalI3D] [int] NULL,
	[Fehlerbeschreibung] [text] NULL,
	[Zubehoer] [text] NULL,
	[Priority] [int] NULL,
	[KredRMANummer] [varchar](30) NULL,
	[Eigenware] [int] NULL,
	[FehlerbeschreibungIntern] [text] NULL,
	[ZubehoerIntern] [text] NULL,
	[RechNummer] [int] NULL,
 CONSTRAINT [PK_KreditorRMAPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KreditorSonderposition]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KreditorSonderposition](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KreditorI3D] [int] NULL,
	[KreditorCode] [varchar](60) NULL,
	[Artikeltext] [varchar](254) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KuendigungsArt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KuendigungsArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](300) NULL,
	[Beschreibung] [text] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenBenachrichtigung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenBenachrichtigung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[AnsprechI3D] [int] NULL,
	[Kunde] [text] NULL,
	[Empfaenger] [varchar](250) NULL,
	[Adressen] [varchar](250) NULL,
	[CC] [varchar](250) NULL,
	[Betreff] [varchar](250) NULL,
	[ToDo] [text] NULL,
	[Beschreibung] [text] NULL,
	[Rueckruf] [int] NULL,
	[Kenntnis] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_KundenBenachrichtigung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenBranche]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenBranche](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[BrancheI3D] [int] NULL,
	[Status] [int] NULL,
	[BusinessPartnerArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenDirectories]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenDirectories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[ImageBlob] [image] NULL,
	[SelImageBlob] [image] NULL,
	[Status] [int] NULL,
	[OwnerI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenFertigungskonfiguration]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenFertigungskonfiguration](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Konfigurationsname] [varchar](60) NOT NULL,
	[Konfigurationsbeschreibung] [text] NULL,
	[KundenI3D] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenHardlock]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenHardlock](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[ProduktID] [varchar](20) NULL,
	[DongleID] [int] NULL,
	[Gueltig] [int] NULL,
	[Unlimited] [int] NULL,
	[VersionNr] [varchar](20) NULL,
	[Status] [int] NULL,
	[Kommentar] [varchar](100) NULL,
	[AnzahlLizenzen] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenInteresse]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenInteresse](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[InteresseI3D] [int] NULL,
	[Status] [int] NULL,
	[BusinessPartnerArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenKostenstelle]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenKostenstelle](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[Nummer] [varchar](50) NULL,
	[Beschreibung] [varchar](255) NULL,
	[Status] [int] NULL,
	[AccountI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenProdukt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenProdukt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[ProduktI3D] [int] NULL,
	[Status] [int] NULL,
	[BusinessPartnerArt] [int] NULL,
	[Beschreibung] [varchar](250) NULL,
	[AnzahlLizenzen] [int] NULL,
	[Aktiv] [int] NULL,
	[Carepack] [int] NULL,
	[Wiedervorlage] [datetime] NULL,
	[ToDoI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenRMA]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenRMA](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[RepNummer] [int] NULL,
	[KundeI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](50) NULL,
	[Artikeltext] [varchar](255) NULL,
	[SeriennummerI3D] [int] NULL,
	[Seriennummer] [varchar](80) NULL,
	[Status] [int] NULL,
	[Eigenware] [int] NULL,
	[WarenStatus] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungNummer] [int] NULL,
	[UrsprungDatum] [datetime] NULL,
	[UrsprungPosI3D] [int] NULL,
	[ErstellDatum] [datetime] NULL,
	[ErstellPersonalI3D] [int] NULL,
	[Garantie] [int] NULL,
	[Fehlerbeschreibung] [varchar](500) NULL,
	[Zubehoer] [varchar](200) NULL,
	[KredFehlerbeschreibung] [varchar](500) NULL,
	[KredZubehoer] [varchar](200) NULL,
	[Priority] [int] NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[Vorgang] [int] NULL,
	[Fracht] [float] NULL,
	[Kosten] [float] NULL,
	[RechGutNummer] [int] NULL,
	[RechGutArt] [int] NULL,
	[LiefI3D] [int] NULL,
	[LiefNummer] [int] NULL,
	[ErstellteRechI3D] [int] NULL,
	[ErstellteRechNummer] [int] NULL,
	[KredRMADatum] [datetime] NULL,
	[VersandArt] [int] NULL,
	[PaketNr] [varchar](50) NULL,
	[KundenRMANummer] [varchar](50) NULL,
	[KreditorRMANummer] [varchar](50) NULL,
	[ReNrKred] [varchar](50) NULL,
	[ReDatKred] [datetime] NULL,
	[ReKredName] [varchar](50) NULL,
	[Versanddatum] [datetime] NULL,
	[Retourdatum] [datetime] NULL,
	[Empfanger] [varchar](500) NULL,
	[Datum] [datetime] NULL,
	[RepStatus] [int] NULL,
	[ErsatzArtikelCode] [varchar](50) NULL,
	[ErsatzArtikelText] [varchar](50) NULL,
	[ErsatzArtikelSN] [varchar](50) NULL,
	[ErsatzArtikelI3D] [int] NULL,
	[ErsatzArtikelSNI3D] [int] NULL,
	[Rechnungsnummer] [int] NULL,
	[RechPosI3D] [int] NULL,
	[LeihTauArt] [int] NULL,
	[LeihTauArtikelI3D] [int] NULL,
	[LeihTauArtikelCode] [varchar](50) NULL,
	[LeihTauArtikelText] [varchar](300) NULL,
	[LeihTauSeriennummerI3D] [int] NULL,
	[LeihTauSeriennummer] [varchar](80) NULL,
	[Rechnungsdatum] [datetime] NULL,
	[RMANummer] [varchar](50) NULL,
	[RuecksendungNr] [int] NULL,
	[GeschDatumAllgem] [datetime] NULL,
	[GeschDatumRMA] [datetime] NULL,
	[DatumFertig] [datetime] NULL,
	[EmpfaengerKunde] [varchar](500) NULL,
	[RMAPosI3D] [int] NULL,
 CONSTRAINT [PK_KundenRMA] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenRMASN]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenRMASN](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenRMAI3D] [int] NULL,
	[SeriennummerI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenSonderpreise]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenSonderpreise](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NOT NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[Artikelbeschreibung] [varchar](300) NULL,
	[WarengruppeI3D] [int] NULL,
	[Warengruppebezeichnung] [varchar](50) NULL,
	[GiltVon] [datetime] NULL,
	[GiltBis] [datetime] NULL,
	[Aufschlag] [float] NOT NULL,
	[Basis] [int] NOT NULL,
	[ErstellerI3D] [int] NOT NULL,
	[Erstelldatum] [datetime] NOT NULL,
	[Kommentar] [varchar](200) NULL,
	[UnterwarengruppeI3D] [int] NULL,
	[ProjektpreisI3D] [int] NULL,
	[ProjektpreisText] [varchar](200) NULL,
	[AnlageDialogNichtZeigen] [int] NULL,
	[VKMenge1] [float] NULL,
	[VKPreis1] [float] NULL,
	[VKMenge2] [float] NULL,
	[VKPreis2] [float] NULL,
	[VKMenge3] [float] NULL,
	[VKPreis3] [float] NULL,
	[VKMenge4] [float] NULL,
	[VKPreis4] [float] NULL,
	[VKMenge5] [float] NULL,
	[VKPreis5] [float] NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
 CONSTRAINT [PK_KundenSonderpreise] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundenToGfiClients]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundenToGfiClients](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundeI3D] [int] NOT NULL,
	[GfiClientID] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[KundeToArtikel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[KundeToArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[ArtikelcodeKunde] [varchar](60) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerAufKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerAufKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[ErstellungsArt] [varchar](50) NULL,
	[Version] [int] NOT NULL,
	[Datum] [datetime] NOT NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NOT NULL,
	[AnschriftID] [int] NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](60) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlkondID] [int] NULL,
	[LieferbedID] [int] NULL,
	[Status] [int] NULL,
	[LockUserI3D] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[AusAng] [int] NULL,
	[BestNr] [varchar](50) NULL,
	[Zusatztext] [varchar](50) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[Kommisioniert] [int] NULL,
	[Produziert] [int] NULL,
	[WorkFlowI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[ProjNr] [varchar](50) NULL,
	[AufScanDocI3D] [int] NULL,
	[BestScanDocI3D] [int] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[KommisioniertAm] [datetime] NULL,
	[ProduziertAm] [datetime] NULL,
	[ToDoI3D] [int] NULL,
	[ToDoKomI3D] [int] NULL,
	[ToDoMonI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[RechKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[ZahlKondRechI3D] [int] NULL,
	[Direktlieferung] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[hlpdsk_requestsI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](255) NULL,
	[RechnungskonditionsText] [varchar](255) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Bar] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[Var1Auftrag] [datetime] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[Service] [int] NULL,
	[LiefEskDatum] [datetime] NULL,
	[Abholung] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerAufKopfErweitert]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerAufKopfErweitert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LagerAufkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[AufkopfI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerAufKopfErweitertVersions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerAufKopfErweitertVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LagerAufkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[OriginalI3D] [int] NULL,
	[Version] [int] NULL,
	[AufkopfI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerAufKopfVersions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerAufKopfVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NOT NULL,
	[ErstellungsArt] [varchar](50) NULL,
	[Version] [int] NOT NULL,
	[Datum] [datetime] NOT NULL,
	[Empfanger] [varchar](500) NULL,
	[KundenID] [int] NOT NULL,
	[AnschriftID] [int] NOT NULL,
	[PersonID] [int] NULL,
	[Strasse] [varchar](50) NULL,
	[Plz] [varchar](50) NULL,
	[Ort] [varchar](50) NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Ansprech] [varchar](60) NULL,
	[KurzZeich] [nvarchar](50) NULL,
	[Ersteller] [varchar](50) NULL,
	[WVorlage] [datetime] NULL,
	[Netto] [float] NULL,
	[Brutto] [float] NULL,
	[SummeEK] [float] NULL,
	[ZahlKond] [varchar](4000) NULL,
	[ZahlkondID] [int] NULL,
	[LieferbedID] [int] NULL,
	[Status] [int] NULL,
	[LockUserI3D] [int] NULL,
	[LockUser] [nvarchar](50) NULL,
	[AusAng] [int] NULL,
	[BestNr] [varchar](50) NULL,
	[Zusatztext] [varchar](50) NULL,
	[Lieferdatum] [datetime] NULL,
	[Bereitstellung] [datetime] NULL,
	[Kommisioniert] [int] NULL,
	[Produziert] [int] NULL,
	[WorkFlowI3D] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwstArt] [int] NULL,
	[Info] [varchar](8000) NULL,
	[ProjNr] [varchar](50) NULL,
	[AufScanDocI3D] [int] NULL,
	[BestScanDocI3D] [int] NULL,
	[InnendienstID] [int] NULL,
	[AussendienstID] [int] NULL,
	[TechnikerID] [int] NULL,
	[Techniker2ID] [int] NULL,
	[LiefKundI3D] [int] NULL,
	[LiefKundAnschriftI3D] [int] NULL,
	[LiefKundPersonI3D] [int] NULL,
	[LiefKundEmpfaenger] [varchar](500) NULL,
	[LiefKundInfo] [varchar](500) NULL,
	[RechKundI3D] [int] NULL,
	[RechKundAnschriftI3D] [int] NULL,
	[RechKundPersonI3D] [int] NULL,
	[RechKundEmpfaenger] [varchar](500) NULL,
	[RechKundInfo] [varchar](500) NULL,
	[DocDirI3D] [int] NULL,
	[KommisioniertAm] [datetime] NULL,
	[ProduziertAm] [datetime] NULL,
	[ToDoI3D] [int] NULL,
	[ToDoKomI3D] [int] NULL,
	[ToDoMonI3D] [int] NULL,
	[LandI3D] [int] NULL,
	[MwStNichtAusweisbar] [int] NULL,
	[LeistungImAusland] [int] NULL,
	[LiefKundFremd] [int] NULL,
	[RechKundFremd] [int] NULL,
	[PostfachAktiv] [int] NULL,
	[Postfach] [varchar](50) NULL,
	[Abteilung] [varchar](50) NULL,
	[LSuREvVersand] [int] NULL,
	[Teillieferung] [int] NULL,
	[ZahlKondRechI3D] [int] NULL,
	[OriginalI3D] [int] NULL,
	[Direktlieferung] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[BearbeiterI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[FilialI3D] [int] NULL,
	[hlpdsk_requestsI3D] [int] NULL,
	[LockUniqueID] [varchar](50) NULL,
	[LieferbedingungsText] [varchar](255) NULL,
	[RechnungskonditionsText] [varchar](255) NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Bar] [int] NULL,
	[KostentraegerI3D] [int] NULL,
	[Var1Auftrag] [datetime] NULL,
	[FreigabeStatus] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ErstelltDurch] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[FertigungskonfI3D] [int] NULL,
	[NettoOriginal] [float] NULL,
	[BruttoOriginal] [float] NULL,
	[InfoAnzeigen] [int] NULL,
	[FilialgeberI3D] [int] NULL,
	[LizenznehmerKundI3D] [int] NULL,
	[LizenznehmerKundAnschriftI3D] [int] NULL,
	[LizenznehmerKundPersonI3D] [int] NULL,
	[LizenznehmerKundEmpfaenger] [varchar](500) NULL,
	[LizenznehmerKundInfo] [varchar](500) NULL,
	[Service] [int] NULL,
	[LiefEskDatum] [datetime] NULL,
	[Abholung] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerAufPos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerAufPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LagerAufKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[Kommisioniert] [float] NULL,
	[Liefermenge] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockId] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Status] [int] NULL,
	[UrsprungAngNr] [int] NULL,
	[RechLiefNr] [int] NULL,
	[RechLiefArt] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellPos] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[EKStkBestellt] [float] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[OriginalI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungPosI3D] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[AufKopfI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[VKBasisWert] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerAufPosVersions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerAufPosVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LagerAufKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](5000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[Kommisioniert] [float] NULL,
	[Liefermenge] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockId] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Status] [int] NULL,
	[UrsprungAngNr] [int] NULL,
	[RechLiefNr] [int] NULL,
	[RechLiefArt] [int] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellPos] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[EKStkBestellt] [float] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[OriginalI3D] [int] NULL,
	[KopfVersionsI3D] [int] NULL,
	[Bestellung] [varchar](50) NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungPosI3D] [int] NULL,
	[Artikelpositionsart] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVP] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[numBarcodes] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[OldAufKopfI3D] [int] NULL,
	[AufKopfI3D] [int] NULL,
	[VKBasis] [int] NULL,
	[EKBasis] [int] NULL,
	[Bestellinformation] [varchar](200) NULL,
	[VKBasisWert] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerorteQM]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerorteQM](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Lagerort] [varchar](150) NULL,
 CONSTRAINT [PK_LagerorteQM] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerUmbuchungsliste]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerUmbuchungsliste](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Kommentar] [varchar](500) NULL,
	[Abschlussdatum] [datetime] NULL,
	[DirektBuchen] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GebuchtAufLagerI3D] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerUmbuchungslisteArtikel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerUmbuchungslisteArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LagerUmbuchungslisteI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Menge] [int] NULL,
	[EK] [float] NULL,
	[QuellLagerI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LagerZuWebShopEinstellungen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LagerZuWebShopEinstellungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WebShopEinstellungenI3D] [int] NULL,
	[LagerI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LatestUsedCentronObjects]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LatestUsedCentronObjects](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](100) NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Kind] [int] NOT NULL,
	[AppUserI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[IsFavorite] [int] NOT NULL,
	[ClosedDate] [datetime2](7) NULL,
 CONSTRAINT [PK_LatestUsedCentronObjects] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LeasingFaktor]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LeasingFaktor](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Faktor] [int] NULL,
 CONSTRAINT [PK_LeasingFaktor] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LeasingLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LeasingLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Vorher] [varchar](100) NULL,
	[Nachher] [varchar](100) NULL,
	[GeaendertVon] [nvarchar](50) NULL,
	[GeaendertAm] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LeasingSaetze]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LeasingSaetze](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Monate] [int] NULL,
	[Preisklasse1] [float] NULL,
	[Preisklasse2] [float] NULL,
	[Preisklasse3] [float] NULL,
	[Preisklasse4] [float] NULL,
	[Preisklasse5] [float] NULL,
	[Preisklasse6] [float] NULL,
 CONSTRAINT [PK_LeasingSaetze] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LetzteAnlage]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LetzteAnlage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AnlageNr] [int] NULL,
	[KundenName] [varchar](500) NULL,
	[SichBenuI3D] [int] NULL,
	[AnlageArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LetzteArtikelVerwendung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LetzteArtikelVerwendung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NOT NULL,
	[ArtikelI3D] [int] NOT NULL,
	[AnlageArt] [int] NOT NULL,
	[PosI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LicenseCustomCategories]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LicenseCustomCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Image] [image] NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_LicenseCustomCategories] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LicenseCustomItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LicenseCustomItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](64) NOT NULL,
	[LicenseCustomCategoryI3D] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[EditorI3D] [int] NULL,
 CONSTRAINT [PK_LicenseCustomItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LicensedEmployee]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LicensedEmployee](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[LastLogin] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LieferungKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LieferungKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KreditorI3D] [int] NULL,
	[KreditorName] [varchar](50) NULL,
	[LieferscheinNr] [varchar](50) NULL,
	[RechnungsNr] [varchar](50) NULL,
	[LieferscheinDatum] [datetime] NULL,
	[RechnungsDatum] [datetime] NULL,
	[EingangsDatum] [datetime] NULL,
	[NettoBetrag] [float] NULL,
	[Frachtkosten] [float] NULL,
	[Versicherung] [float] NULL,
	[NettoBetragGesamt] [float] NULL,
	[BrutoBetragGesamt] [float] NULL,
	[ZahlungsArt] [int] NULL,
	[Anlagedatum] [datetime] NULL,
	[Anlagebenutzer] [varchar](50) NULL,
	[Status] [int] NULL,
	[MultiMwst] [int] NULL,
	[UrsprungBestellung] [int] NULL,
	[UrsprungVersion] [int] NULL,
	[CurrencyString] [varchar](50) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[DocI3D] [int] NULL,
 CONSTRAINT [PK_LieferungKopf] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LiefKopfErweitert]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiefKopfErweitert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LiefkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LiefKopfErweitertVersions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiefKopfErweitertVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LiefkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[OriginalI3D] [int] NULL,
	[Version] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LiefProv]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LiefProv](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LiefKopfI3D] [int] NULL,
	[LiefNummer] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Provision] [float] NULL,
	[Standard] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LizenzKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LizenzKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Status] [int] NULL,
	[Name] [varchar](100) NULL,
	[KundenI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[AnsprechpartnerI3D] [int] NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[Info] [varchar](8000) NULL,
	[ZahlungsartVorNach] [int] NULL,
	[ZahlungsIntervallAnzahl] [int] NULL,
	[ZahlungsIntervallArt] [int] NULL,
	[ZahlungsZeitpunkt] [datetime] NULL,
	[ZahlungskonditionI3D] [int] NOT NULL,
	[AutoVerlaengerung] [int] NULL,
	[GekuendigtAm] [datetime] NULL,
	[GekuendigtKunde] [int] NULL,
	[Kuendigungsgrund] [varchar](255) NULL,
	[Kuendigungsfrist] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[GeaendertAm] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[GeaendertVonI3D] [int] NULL,
	[AbgerechnetBis] [datetime] NULL,
	[Anrede] [text] NULL,
	[Abrede] [text] NULL,
	[ZahlungsIntervall] [int] NULL,
	[IgnoreRabatt] [int] NULL,
	[CurrencyString] [varchar](10) NULL,
	[CurrencyFactor] [float] NULL,
	[CurrencyI3D] [int] NULL,
	[MwStArt] [int] NULL,
	[BasisPreisGueltigFuer] [int] NULL,
 CONSTRAINT [PK_LizenzKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LizenzPos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LizenzPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LizenzKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](20) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](300) NULL,
	[Angezeigtertext] [varchar](300) NULL,
	[FreiText] [varchar](1000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[AnzahlUser] [int] NULL,
	[BasisBetrag] [float] NULL,
	[ProzentSatz] [float] NULL,
	[MwStSatz] [float] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[AbrechnungszeitraumVon] [datetime] NULL,
	[AbrechnungszeitraumBis] [datetime] NULL,
 CONSTRAINT [PK_LizenzPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC,
	[LizenzKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[LizenzRech]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LizenzRech](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[LizenzKopfI3D] [int] NOT NULL,
	[RechnungsI3D] [int] NOT NULL,
	[Erstelldatum] [datetime] NULL,
	[AbgerechnetBis] [datetime] NULL,
	[PersonalI3D] [int] NULL,
 CONSTRAINT [PK_LizenzRech] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Logos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Logos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Logo] [image] NOT NULL,
	[IsDefault] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Lohngruppen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Lohngruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Stundenlohn] [float] NULL,
	[Beschreibung] [text] NULL,
 CONSTRAINT [PK_Lohngruppen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MaAbteilung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MaAbteilung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Kommentar] [varchar](50) NULL,
	[Status] [int] NULL,
	[Umsatzorientiert] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[Abteilung] [varchar](50) NULL,
	[ExchangeSync] [int] NULL,
	[IsMyDayActive] [bit] NOT NULL,
	[MyDayBegin] [datetime2](7) NULL,
	[IsCallSyncActive] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MaAbteilungSortierung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MaAbteilungSortierung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[WebAccountsI3D] [int] NULL,
	[MaAbteilungI3D] [int] NULL,
	[Sortierung] [int] NULL,
	[Visible] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MachineKind]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MachineKind](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_MachineKind] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MachineKindStepsDescription]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MachineKindStepsDescription](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Description] [nvarchar](1000) NOT NULL,
	[MachineKindI3D] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_MachineKindStepsDescription] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MachineLocations]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MachineLocations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[ParentMachineLocationI3D] [int] NULL,
	[FullName] [nvarchar](4000) NULL,
 CONSTRAINT [PK_MachineLocations] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Machines]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Machines](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[Name] [nvarchar](255) NULL,
	[MachineKindI3D] [int] NULL,
	[MachineLocationI3D] [int] NULL,
	[RunKind] [int] NOT NULL,
	[AmountPerRun] [int] NOT NULL,
	[RunsPerDay] [int] NOT NULL,
 CONSTRAINT [PK_Machines] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailAgentEinstellungen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailAgentEinstellungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[OutlookVZEntryID] [varchar](500) NULL,
	[OutlookVZStoreID] [varchar](500) NULL,
	[DatumEinschraenken] [int] NULL,
	[LetzteXTageAnzeigen] [int] NULL,
	[BodyAlsPlaintextAnzeigen] [int] NULL,
	[Status] [int] NULL,
	[AutoRefresh] [int] NULL,
	[AutoRefreshIntervall] [float] NULL,
	[AutoEMailsPruefen] [int] NULL,
	[MailErkennungUeberAnsprechEMail1] [int] NULL,
	[MailErkennungUeberAnsprechEMail2] [int] NULL,
	[MailErkennungZuerstInAnsprechEMailFeld] [int] NULL,
	[MailErkennungUeberDomaeneAktiv] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailAgentRegel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailAgentRegel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[RegelKind] [int] NULL,
	[AktionAnlageOeffnen] [int] NULL,
	[AktionAnlageEMailHinzufuegen] [int] NULL,
	[AktionEMailVerschieben] [int] NULL,
	[EMailVerschiebenInVZEntryID] [varchar](500) NULL,
	[EMailVerschiebenInVZStoreID] [varchar](500) NULL,
	[Status] [int] NULL,
	[Prioritaet] [int] NULL,
	[Bezeichnung] [varchar](100) NULL,
	[AktionTextSucheInBetreff] [int] NULL,
	[AktionTextSucheInBody] [int] NULL,
	[SucheNachText] [varchar](255) NULL,
	[AktionHelpdeskAnlegen] [int] NULL,
	[KundenI3D] [int] NULL,
	[AutoKdErkennung] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailAgentRollen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailAgentRollen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](100) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailArchiv]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailArchiv](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Subject] [varchar](255) NULL,
	[BodyText] [varchar](7000) NULL,
	[BodyType] [int] NULL,
	[SenderAddress] [varchar](255) NULL,
	[SenderName] [varchar](255) NULL,
	[SendDateTime] [datetime] NULL,
	[SenderI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailArchivAttachment]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailArchivAttachment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MailI3D] [int] NULL,
	[Attachment] [image] NULL,
	[FileName] [varchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailArchivBodyRTF]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailArchivBodyRTF](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MailI3D] [int] NULL,
	[Body] [image] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailArchivRecipient]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailArchivRecipient](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MailI3D] [int] NULL,
	[RecipientType] [int] NULL,
	[Recipient] [varchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Mailing]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mailing](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Datum] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[DocI3D] [int] NULL,
	[isHDDFile] [int] NULL,
	[HDDPath] [varchar](255) NULL,
	[Subject] [varchar](255) NULL,
	[MailField] [int] NULL,
	[DefRecipient] [varchar](60) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailingAttachments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailingAttachments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MailingDatenI3D] [int] NULL,
	[Attachment] [image] NULL,
	[AttachmentType] [int] NULL,
	[AttachmentName] [varchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailingDataToRelationshipKind]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailingDataToRelationshipKind](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MailingDataI3D] [int] NOT NULL,
	[Subject] [nvarchar](255) NOT NULL,
	[Body] [nvarchar](max) NOT NULL,
	[MailTemplateRelationshipKindI3D] [int] NOT NULL,
 CONSTRAINT [PK_MailingDataToRelationshipKind] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailingDaten]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailingDaten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[Mail] [image] NULL,
	[MailType] [int] NULL,
	[Beschreibung] [varchar](max) NULL,
	[Subject] [varchar](255) NULL,
	[Datenquelle] [image] NULL,
	[MappingFields] [text] NULL,
	[MailingCreateAction] [int] NULL,
	[HelpdeskTypeI3D] [int] NULL,
	[HelpdeskCategoryI3D] [int] NULL,
	[HelpdeskCategory1I3D] [int] NULL,
	[HelpdeskCategory2I3D] [int] NULL,
	[HelpdeskCreateForTechnican1] [int] NULL,
	[HelpdeskCreateForTechnican2] [int] NULL,
	[NoMailSend] [int] NULL,
	[Version] [int] NOT NULL,
	[CampaignI3D] [int] NULL,
	[Signature] [image] NULL,
	[DataSourceType] [int] NULL,
	[SurveyTemplateI3D] [int] NULL,
	[WebFormI3D] [int] NULL,
	[SMSGateway] [bit] NULL,
	[ActivityOption] [nvarchar](max) NULL,
	[HelpdeskOption] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailingTeilnahme]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailingTeilnahme](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MailingI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[AnsprechI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Mailingtexte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mailingtexte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Mailingtexte] [text] NULL,
	[MailingDatenI3D] [int] NULL,
	[EMail] [varchar](255) NULL,
	[Versendet] [int] NULL,
	[Date] [datetime] NULL,
	[SurveyI3D] [int] NULL,
	[AccountAddressContactI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailingToKunde]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailingToKunde](
	[I3d] [int] IDENTITY(1,1) NOT NULL,
	[MailingDatenI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[AnsprechI3D] [int] NULL,
	[MailingsNummer] [int] NULL,
	[ProductFamilyActionI3D] [int] NULL,
	[ProductFamilyI3D] [int] NULL,
	[WithAction] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3d] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailingVorlagen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailingVorlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Beschreibung] [varchar](255) NULL,
	[Vorlage] [image] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailScannerLogs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailScannerLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MessageId] [nvarchar](255) NULL,
	[LogMessage] [nvarchar](4000) NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[Type] [int] NOT NULL,
	[ProcessGuid] [uniqueidentifier] NULL,
	[LogLevel] [int] NOT NULL,
	[WorkflowComponentGuid] [uniqueidentifier] NULL,
 CONSTRAINT [PK_MailScannerLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailScannerProfiles]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailScannerProfiles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](255) NULL,
	[MailUrl] [nvarchar](255) NULL,
	[Active] [bit] NOT NULL,
	[MailPort] [int] NULL,
	[MailUsername] [nvarchar](255) NULL,
	[MailPassword] [nvarchar](max) NULL,
	[WorkflowI3Ds] [nvarchar](max) NULL,
	[MailProtocol] [int] NOT NULL,
	[BranchI3D] [int] NULL,
	[TenantId] [nvarchar](40) NULL,
	[ClientId] [nvarchar](40) NULL,
	[ClientSecret] [nvarchar](max) NULL,
	[Password] [nvarchar](max) NULL,
	[ConnectionType] [int] NOT NULL,
 CONSTRAINT [PK_MailScannerProfiles] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailTemplateAttachments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailTemplateAttachments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[SubObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
	[Name] [nvarchar](255) NOT NULL,
	[FileData] [varbinary](max) NOT NULL,
	[FileSize] [int] NOT NULL,
	[Type] [int] NOT NULL,
	[CreatedAt] [datetime] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[IsGlobal] [bit] NOT NULL,
	[IsPersonal] [bit] NOT NULL,
	[BranchI3D] [int] NULL,
	[AccountI3D] [int] NULL,
 CONSTRAINT [PK_MailTemplateAttachments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailTemplateRelationshipKinds]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailTemplateRelationshipKinds](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](50) NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[Description] [nvarchar](500) NULL,
 CONSTRAINT [PK_MailTemplateRelationshipKinds] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailVerzeichnisse]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailVerzeichnisse](
	[I3D] [int] NOT NULL,
	[Status] [int] NULL,
	[OwnerI3D] [int] NULL,
	[Name] [varchar](100) NULL,
	[ImageIndex] [int] NULL,
	[SelectedIndex] [int] NULL,
	[MailOptions] [int] NULL,
 CONSTRAINT [PK_MailVerzeichnisse] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailVorlagen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailVorlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[MailVerzeichnisseI3D] [int] NULL,
	[Betreff] [varchar](500) NULL,
	[Body] [text] NULL,
	[An] [varchar](255) NULL,
	[CC] [varchar](255) NULL,
	[BCC] [varchar](255) NULL,
	[Von] [varchar](100) NULL,
	[Name] [varchar](100) NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NULL,
	[SubObjectKind] [int] NULL,
	[TemplatePrio] [int] NULL,
	[RelationshipKindI3D] [int] NULL,
	[BranchI3D] [int] NULL,
	[IsPersonalMailTemplate] [bit] NOT NULL,
	[AccountI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MailVorlagenAttachments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MailVorlagenAttachments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[DocumentsI3D] [int] NULL,
	[MailVorlagenI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MandantenStammdat]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MandantenStammdat](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MandantID] [int] NULL,
	[StammDatID] [int] NULL,
	[Text] [varchar](30) NULL,
	[Wert] [int] NULL,
	[WertText] [varchar](100) NULL,
	[WertMemo] [varchar](255) NULL,
	[WertNum] [float] NULL,
 CONSTRAINT [PK_MandantenStammdat] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MassUpdateTemplate]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MassUpdateTemplate](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](250) NOT NULL,
	[Description] [nvarchar](4000) NOT NULL,
	[CreatedAt] [datetime2](0) NOT NULL,
	[ChangedAt] [datetime2](0) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[AutoUpdateAt] [datetime2](0) NULL,
	[UpdateExecutedAt] [datetime2](0) NULL,
	[ExecutedByI3D] [int] NULL,
	[IsExecuted] [bit] NULL,
	[IsActive] [bit] NOT NULL,
	[PriceUpdateSettingsI3D] [int] NULL,
 CONSTRAINT [PK_MassUpdateTemplate] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MassUpdateTemplateItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MassUpdateTemplateItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MassUpdateTemplateI3D] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[AdditionalObjectI3D] [int] NULL,
	[NewPurchasePrice] [decimal](18, 6) NULL,
	[NewBasePrice] [decimal](18, 6) NULL,
	[NewPrice1] [decimal](18, 6) NULL,
	[NewPrice2] [decimal](18, 6) NULL,
	[NewPrice3] [decimal](18, 6) NULL,
	[NewPrice4] [decimal](18, 6) NULL,
	[IsExecuted] [bit] NULL,
	[ExecutedAt] [datetime2](0) NULL,
	[ExecutedByI3D] [int] NULL,
	[FailureMessage] [nvarchar](250) NULL,
	[ReceiptPositionNumber] [int] NULL,
	[IdmI3D] [int] NULL,
	[AdmI3D] [int] NULL,
	[PaymentConditionI3D] [int] NULL,
	[NewAdvisor1I3D] [int] NULL,
	[NewAdvisor2I3D] [int] NULL,
	[NewAdvisor3I3D] [int] NULL,
	[NewAdvisor4I3D] [int] NULL,
	[NewAdvisor5I3D] [int] NULL,
	[NewAdvisor6I3D] [int] NULL,
	[OldAdvisor1I3D] [int] NULL,
	[OldAdvisor2I3D] [int] NULL,
	[OldAdvisor3I3D] [int] NULL,
	[OldAdvisor4I3D] [int] NULL,
	[OldAdvisor5I3D] [int] NULL,
	[OldAdvisor6I3D] [int] NULL,
	[NewCustomerClassificationI3D] [int] NULL,
	[OldCustomerClassificationI3D] [int] NULL,
 CONSTRAINT [PK_MassUpdateTemplateItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MindCheckKind]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MindCheckKind](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KindName] [nvarchar](24) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MindCheckProgress]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MindCheckProgress](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProgressName] [nvarchar](56) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MindCheckProject]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MindCheckProject](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ParentI3D] [int] NULL,
	[Position] [int] NOT NULL,
	[MindCheckKindI3D] [int] NOT NULL,
	[Caption] [nvarchar](56) NOT NULL,
	[Description] [nvarchar](256) NULL,
	[MindCheckProgressI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MindCheckTimeDetails]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MindCheckTimeDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MindCheckProjectI3D] [int] NOT NULL,
	[Duration] [float] NOT NULL,
	[StartDateTime] [datetime] NOT NULL,
	[EndDateTime] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Module]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Module](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DisplayText] [nvarchar](256) NOT NULL,
	[ModuleGuid] [nvarchar](64) NOT NULL,
	[ModuleCategoryI3D] [int] NULL,
	[Internal] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModuleActionLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModuleActionLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ModuleI3D] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[LogText] [nvarchar](512) NOT NULL,
	[Date] [datetime] NOT NULL,
	[ObjectKindI3D] [int] NULL,
	[ObjectI3D] [int] NULL,
	[ActionTypeI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModuleActionType]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModuleActionType](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](64) NOT NULL,
	[Linkable] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModuleCategory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModuleCategory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](24) NOT NULL,
	[DisplayText] [varchar](64) NOT NULL,
	[Internal] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModuleCustomProperties]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModuleCustomProperties](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](64) NOT NULL,
	[DataType] [int] NOT NULL,
	[Category] [nvarchar](64) NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NOT NULL,
	[IsVisible] [bit] NOT NULL,
	[SortOrder] [int] NULL,
	[Sealable] [bit] NOT NULL,
	[ValueMask] [nvarchar](1000) NULL,
	[IsMandatory] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModuleCustomPropertyPossibleValues]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModuleCustomPropertyPossibleValues](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ModuleCustomPropertyI3D] [int] NOT NULL,
	[Value] [varchar](max) NULL,
	[IsVisible] [int] NOT NULL,
 CONSTRAINT [PK_ModuleCustomPropertyPossibleValues] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModuleCustomPropertyValues]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModuleCustomPropertyValues](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ModuleCustomPropertyI3D] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[ValueInteger] [int] NULL,
	[ValueDecimal] [float] NULL,
	[ValueDateTime] [datetime] NULL,
	[ValueString] [nvarchar](4000) NULL,
	[ValueBoolean] [bit] NULL,
	[ValueImage] [image] NULL,
	[ValueText] [ntext] NULL,
	[ValueEncryptedString] [nvarchar](4000) NULL,
	[Sealed] [bit] NOT NULL,
	[ValueBytes] [varbinary](max) NULL,
	[ValueEncryptedBytes] [varbinary](max) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModuleFavorite]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModuleFavorite](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[ModuleI3D] [int] NOT NULL,
	[BigSize] [bit] NOT NULL,
	[Sort] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModuleToClient]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModuleToClient](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ModuleI3D] [int] NOT NULL,
	[ClientI3D] [int] NOT NULL,
	[Namespace] [nvarchar](1024) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonCheckNotificationMobilePushSettingAssignedDevices]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonCheckNotificationMobilePushSettingAssignedDevices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MobilePushSettingI3D] [int] NOT NULL,
	[MobilePhonePushTokenI3D] [int] NOT NULL,
 CONSTRAINT [PK_MonCheckNotificationMobilePushSettingAssignedDevices] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonCheckNotificationMobilePushSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonCheckNotificationMobilePushSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NotificationSettingI3D] [int] NOT NULL,
	[Title] [nvarchar](512) NOT NULL,
	[Body] [nvarchar](max) NOT NULL,
	[SendOnError] [bit] NOT NULL,
	[SendOnWarning] [bit] NOT NULL,
	[SendOnSuccess] [bit] NOT NULL,
	[Adviser1] [bit] NOT NULL,
	[Adviser2] [bit] NOT NULL,
	[Adviser3] [bit] NOT NULL,
	[Adviser4] [bit] NOT NULL,
	[Adviser5] [bit] NOT NULL,
	[Adviser6] [bit] NOT NULL,
 CONSTRAINT [PK_MonCheckNotificationMobilePushSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringCheckDepartmentMappings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringCheckDepartmentMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DepartmentI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
 CONSTRAINT [PK_MonitoringCheckDepartmentMappings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringCheckSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringCheckSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MainCategoryI3D] [int] NOT NULL,
	[SubCategory1I3D] [int] NULL,
	[SubCategory2I3D] [int] NULL,
	[PriorityI3D] [int] NOT NULL,
	[TypeI3D] [int] NOT NULL,
	[IsDelete] [bit] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ModifiedDate] [datetime] NULL,
	[CheckI3D] [int] NOT NULL,
 CONSTRAINT [PK_MonitoringCheckSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringCheckTemplateMaps]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringCheckTemplateMaps](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateI3D] [int] NOT NULL,
	[CheckI3D] [int] NOT NULL,
	[CheckKeyName] [nvarchar](256) NOT NULL,
	[CheckKeyValue] [nvarchar](256) NULL,
	[SequenceOrder] [int] NOT NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDatetime] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDatetime] [datetime] NULL,
 CONSTRAINT [PK_MonitoringCheckTemplateMaps] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringCheckTemplateToChildMaps]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringCheckTemplateToChildMaps](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CheckTemplateMapI3D] [int] NOT NULL,
	[ChildKeyValue] [nvarchar](256) NOT NULL,
 CONSTRAINT [PK_MonitoringCheckTemplateToChildMaps] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringDataChecks]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringDataChecks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MonitoringDeviceI3D] [int] NOT NULL,
	[IsCheck] [bit] NOT NULL,
	[IsProblems] [bit] NOT NULL,
	[IsProcessorPerformance] [bit] NOT NULL,
	[Description] [nvarchar](1000) NULL,
	[CheckName] [nvarchar](255) NULL,
	[CheckDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringDataFailures]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringDataFailures](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MonitoringDeviceI3D] [int] NOT NULL,
	[IsCheck] [bit] NOT NULL,
	[IsProblems] [bit] NOT NULL,
	[IsProcessorPerformance] [bit] NOT NULL,
	[Description] [nvarchar](1000) NULL,
	[Start] [datetime] NULL,
	[Finish] [datetime] NULL,
	[Time] [nvarchar](255) NULL,
	[FailureReason] [nvarchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringDepartmentEmployeeMappings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringDepartmentEmployeeMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[DepartmentMappingI3D] [int] NOT NULL,
 CONSTRAINT [PK_MonitoringDepartmentEmployeeMappings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringGlobalNotifications]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringGlobalNotifications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DepartmentI3D] [int] NULL,
	[EmployeeI3D] [int] NOT NULL,
 CONSTRAINT [PK_MonitoringGlobalNotifications] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringTemplates]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringTemplates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateName] [nvarchar](100) NOT NULL,
	[IsDefaultConfigure] [bit] NOT NULL,
	[CreatedBy] [nvarchar](100) NOT NULL,
	[CreatedDatetime] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](100) NULL,
	[ChangedDatetime] [datetime] NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_MonitoringTemplates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringTemplateToDeviceMaps]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringTemplateToDeviceMaps](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceI3D] [int] NULL,
	[DeviceClassName] [nvarchar](50) NULL,
	[CreatedDatetime] [datetime] NOT NULL,
 CONSTRAINT [PK_MonitoringTemplateToDeviceMaps] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonitoringUserFilterSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonitoringUserFilterSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[UserI3D] [int] NOT NULL,
	[WebPageI3D] [int] NOT NULL,
	[FilterKeyName] [nvarchar](256) NOT NULL,
	[FilterKeyValue] [nvarchar](500) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ModifiedDate] [datetime] NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_MonitoringUserFilterSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonScriptCategories]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonScriptCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[Description] [nvarchar](1000) NULL,
 CONSTRAINT [PK_MonScriptCategories] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MonScripts]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonScripts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MonScriptCategoryI3D] [int] NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[Description] [nvarchar](1000) NULL,
	[ScriptKind] [int] NOT NULL,
	[ScriptType] [int] NOT NULL,
	[Script] [nvarchar](max) NULL,
	[ExitCodeSuccess] [int] NULL,
	[ExitCodeWarning] [int] NULL,
	[ExitCodeError] [int] NULL,
	[IsSelfHeal] [bit] NOT NULL,
	[SelfHealingScript] [nvarchar](max) NULL,
	[SelfHealingExitCodeSuccess] [int] NULL,
	[SelfHealingExitCodeError] [int] NULL,
 CONSTRAINT [PK_MonScripts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MspArticleReferences]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MspArticleReferences](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierArticleID] [nvarchar](50) NOT NULL,
	[MspCollectorI3D] [int] NOT NULL,
	[SupplierArticleLabel] [nvarchar](100) NULL,
	[SupplierArticleDescription] [nvarchar](200) NULL,
	[ImportKind] [int] NOT NULL,
 CONSTRAINT [PK_MspArticleReferences] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MspArticleToCentronArticle]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MspArticleToCentronArticle](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MspArticleReferencesI3D] [int] NOT NULL,
	[CentronArticleI3D] [int] NOT NULL,
 CONSTRAINT [PK_MspArticleToCentronArticle] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MspCollectorInvoiceHead]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MspCollectorInvoiceHead](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MspCollectorI3D] [int] NOT NULL,
	[InvoiceNumber] [nvarchar](50) NULL,
	[InvoiceDate] [datetime2](0) NULL,
	[Currency] [nvarchar](10) NULL,
	[Comment] [nvarchar](100) NULL,
	[State] [nvarchar](50) NULL,
	[ImportKind] [int] NOT NULL,
	[ChangedAt] [datetime2](0) NULL,
 CONSTRAINT [PK_MspCollectorInvoiceHead] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MspCollectorInvoiceItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MspCollectorInvoiceItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MspCollectorInvoiceHeadI3D] [int] NOT NULL,
	[MspArticleReferencesI3D] [int] NOT NULL,
	[MspCustomerReferencesI3D] [int] NULL,
	[Quantity] [numeric](9, 2) NULL,
	[Price] [numeric](9, 2) NULL,
	[Currency] [nvarchar](10) NULL,
	[MspEvaluationDecision] [int] NULL,
 CONSTRAINT [PK_MspCollectorInvoiceItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MspCollectorLogs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MspCollectorLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MspCollectorI3D] [int] NULL,
	[Message] [nvarchar](500) NULL,
	[Date] [datetime2](0) NOT NULL,
	[State] [int] NOT NULL,
	[ImportOwner] [int] NOT NULL,
	[ImportKind] [int] NOT NULL,
 CONSTRAINT [PK_mspCollectorImportLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MspCollectors]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MspCollectors](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[MspSupplierID] [int] NOT NULL,
	[CentronSupplierI3D] [int] NULL,
	[Username] [nvarchar](50) NULL,
	[Password] [nvarchar](50) NULL,
	[IsServiceActive] [bit] NOT NULL,
	[State] [bit] NOT NULL,
	[DownloadType] [int] NULL,
	[Url] [nvarchar](255) NULL,
	[Port] [int] NULL,
	[Directory] [nvarchar](255) NULL,
	[UseAuthentication] [bit] NULL,
	[RecurrenceTime] [datetime2](0) NULL,
	[RecurrenceInterval] [int] NULL,
	[GetParam1] [nvarchar](200) NULL,
	[GetParam2] [nvarchar](100) NULL,
	[GetParam3] [nvarchar](100) NULL,
	[DynImportConfigI3D] [int] NULL,
 CONSTRAINT [PK_MspCollectors] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MspCustomerReferences]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MspCustomerReferences](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MspCollectorI3D] [int] NOT NULL,
	[SupplierCustomerID] [varchar](50) NULL,
	[SupplierCustomerName] [varchar](50) NULL,
	[CentronCustomerI3D] [int] NULL,
	[ImportKind] [int] NOT NULL,
 CONSTRAINT [PK_MspCusomerReferences] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MspEvaluationHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MspEvaluationHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MspInvoiceI3D] [int] NOT NULL,
	[MspInvoiceNumber] [nvarchar](50) NULL,
	[MspArticleI3D] [int] NOT NULL,
	[MspSupplierArticleID] [nvarchar](50) NOT NULL,
	[CentronArticleI3D] [int] NOT NULL,
	[ContractI3D] [int] NOT NULL,
	[ContractNumber] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[ContractPosI3D] [int] NOT NULL,
	[Date] [datetime2](0) NOT NULL,
	[MspEvaluationDecision] [int] NOT NULL,
	[CustomerName] [nvarchar](200) NULL,
	[MspEvaluationSpecialArticleDecision] [int] NULL,
	[MspInvoiceDate] [datetime2](0) NULL,
	[ReceiptState] [int] NULL,
	[ReceiptContractKindI3D] [int] NULL,
	[MspQuantity] [decimal](18, 6) NULL,
	[ContractQuantity] [decimal](18, 6) NULL,
	[LastInvoiceQuantity] [decimal](18, 6) NULL,
 CONSTRAINT [PK_MspEvaluationHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MultiDistributorEDILog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MultiDistributorEDILog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MultidistributorID] [int] NULL,
	[DistributorSupplierNumber] [nvarchar](50) NULL,
	[CentronSupplierOrderI3D] [int] NOT NULL,
	[DistributorOrderID] [nvarchar](100) NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[State] [int] NULL,
 CONSTRAINT [PK_MultiDistributorEDILog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MusterArbeitsgang]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MusterArbeitsgang](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](100) NULL,
	[Bemerkung] [varchar](100) NULL,
	[ErstelltVon] [varchar](100) NULL,
	[ErstelltAm] [datetime] NULL,
	[LetzteAenderungVon] [varchar](100) NULL,
	[LetzteAenderungAm] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MusterArbeitsplatz]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MusterArbeitsplatz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MGangI3D] [int] NULL,
	[MArbeitsplatzI3D] [int] NULL,
	[Bemerkung] [varchar](100) NULL,
	[Nutzen] [int] NULL,
	[Aufruestzeit] [int] NULL,
	[Abruestzeit] [int] NULL,
	[Stueckzeit] [int] NULL,
	[Zykluszeit] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MusterArbeitsschutz]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MusterArbeitsschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MGangI3D] [int] NULL,
	[MArbeitsschutzI3D] [int] NULL,
	[Bemerkung] [varchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MusterArtikel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MusterArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MGangI3D] [int] NULL,
	[MArtikelI3D] [int] NULL,
	[Menge] [int] NULL,
	[Bemerkung] [varchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MusterLohnGruppe]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MusterLohnGruppe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MGangI3D] [int] NULL,
	[MLohngruppeI3D] [int] NULL,
	[Menge] [int] NULL,
	[Bemerkung] [varchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MusterUmweltschutz]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MusterUmweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MGangI3D] [int] NULL,
	[MUmweltschutzI3D] [int] NULL,
	[Bemerkung] [varchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MusterWerkzeug]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MusterWerkzeug](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MGangI3D] [int] NULL,
	[MArtikelI3D] [int] NULL,
	[Menge] [varchar](100) NULL,
	[Bemerkung] [varchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDayEmployeeSelection]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDayEmployeeSelection](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AppUserI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[DepartementI3D] [int] NOT NULL,
 CONSTRAINT [PK_MyDayEmployeeSelection] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDayFinalizedDays]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDayFinalizedDays](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Date] [datetime2](7) NOT NULL,
	[Comment] [nvarchar](max) NULL,
	[ApprovedByEmployeeI3D] [int] NULL,
 CONSTRAINT [PK_MyDayFinalizedDays] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDayNotificationLogs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDayNotificationLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SentDate] [datetime2](3) NOT NULL,
	[Date] [datetime2](3) NOT NULL,
	[Type] [nvarchar](200) NOT NULL,
	[EmployeeI3D] [int] NULL,
	[Description] [nvarchar](max) NULL,
	[EmailReceiver] [nvarchar](4000) NULL,
	[EmailSubject] [nvarchar](4000) NULL,
	[EmailBody] [nvarchar](max) NULL,
 CONSTRAINT [PK_MyDayNotificationLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDaySpecialTimeSettingAssignments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDaySpecialTimeSettingAssignments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SpecialTimeSettingI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
 CONSTRAINT [PK_MyDaySpecialTimeSettingAssignments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDaySpecialTimeSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDaySpecialTimeSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WorkTimeStart] [datetime2](7) NULL,
	[WorkTimeEnd] [datetime2](7) NULL,
	[Caption] [nvarchar](max) NULL,
	[BreakDuration] [datetime2](7) NULL,
 CONSTRAINT [PK_MyDaySpecialTimeSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDayUserItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDayUserItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[ItemDate] [datetime2](0) NOT NULL,
	[IsHidden] [bit] NOT NULL,
	[UniqueId] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_MyDayUserItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDayWorkItemComments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDayWorkItemComments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WorkItemI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[EmployeeFullName] [nvarchar](200) NULL,
	[Time] [datetime2](7) NOT NULL,
	[CommentRTF] [nvarchar](max) NULL,
	[ParentI3D] [int] NULL,
	[LastEdited] [datetime2](7) NULL,
 CONSTRAINT [PK_MyDayWorkItemComments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDayWorkItemFollowers]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDayWorkItemFollowers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WorkItemI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[EmployeeFullName] [nvarchar](200) NULL,
 CONSTRAINT [PK_MyDayWorkItemFollowers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDayWorkItemReactions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDayWorkItemReactions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TargetKind] [nvarchar](200) NOT NULL,
	[TargetI3D] [nvarchar](200) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[EmployeeFullName] [nvarchar](200) NULL,
	[ReactionType] [nvarchar](200) NOT NULL,
 CONSTRAINT [PK_MyDayWorkItemReactions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MyDayWorkItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyDayWorkItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[StartTime] [datetime2](7) NOT NULL,
	[EndTime] [datetime2](7) NULL,
	[Caption] [nvarchar](max) NULL,
	[Type] [nvarchar](200) NOT NULL,
	[IsGenerated] [bit] NOT NULL,
	[CentronObjectKindNumeric] [nvarchar](200) NULL,
	[ObjectI3D] [int] NULL,
	[ShowInTimeLine] [bit] NULL,
	[LastEdited] [datetime2](7) NULL,
	[DescriptionRTF] [nvarchar](max) NULL,
	[ConnectedHelpdeskTimerI3D] [int] NULL,
	[ConnectedHelpdeskI3D] [int] NULL,
	[UniqueId] [varchar](255) NULL,
	[BreakTime] [time](7) NULL,
	[BatchId] [int] NULL,
 CONSTRAINT [PK_MyDayWorkItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NableServices]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NableServices](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](64) NOT NULL,
	[IsCustom] [int] NOT NULL,
	[State] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Nebenlager]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Nebenlager](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MandantI3D] [int] NULL,
	[Nummer] [int] NULL,
	[Bezeichnung] [varchar](250) NULL,
	[Status] [int] NULL,
	[AutoKostenstelle] [int] NULL,
	[LagerplatzPflicht] [int] NULL,
	[DirektFakturierung] [int] NULL,
	[KostenstelleI3D] [int] NULL,
	[AngelegtAm] [datetime] NULL,
	[AngelegtVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVon] [int] NULL,
	[EigenerEK] [int] NULL,
	[LagerArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NebenlagerLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NebenlagerLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NebenlagerI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Wert] [varchar](250) NULL,
	[AlterWert] [varchar](250) NULL,
	[NeuerWert] [varchar](250) NULL,
 CONSTRAINT [PK_NebenlagerLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NebenlagerUmbuchungsLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NebenlagerUmbuchungsLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[VonLagerI3D] [int] NULL,
	[NachLagerI3D] [int] NULL,
	[Menge] [float] NULL,
	[AlterEK] [float] NULL,
	[NeuerEK] [float] NULL,
	[VonLagerOrtI3D] [int] NULL,
	[VonLagerPlatzI3D] [int] NULL,
	[NachLagerOrtI3D] [int] NULL,
	[NachLagerPlatzI3D] [int] NULL,
 CONSTRAINT [PK_NebenlagerUmbuchungsLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NetworkMapItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NetworkMapItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NetworkMapViewI3D] [int] NOT NULL,
	[Item] [nvarchar](max) NULL,
	[Text] [nvarchar](255) NULL,
	[Type] [int] NULL,
	[AssetManagementDeviceI3D] [int] NULL,
	[Color] [nvarchar](max) NULL,
	[ChildrenI3Ds] [nvarchar](max) NULL,
	[StartDeviceI3D] [int] NULL,
	[EndDeviceI3D] [int] NULL,
	[Waypoints] [nvarchar](max) NULL,
	[ItemVisibility] [nvarchar](255) NULL,
	[ConnectorType] [nvarchar](255) NULL,
	[EndArrow] [nvarchar](255) NULL,
	[SubnetAddress] [nvarchar](255) NULL,
	[SubnetMask] [nvarchar](255) NULL,
	[Cidr] [nvarchar](255) NULL,
	[ShapeVectorName] [nvarchar](255) NULL,
	[ItemAngle] [decimal](9, 2) NULL,
	[Image] [varbinary](max) NULL,
	[RichText] [nvarchar](max) NULL,
	[IsPinned] [bit] NULL,
	[ZLevel] [int] NULL,
	[RichTextComment] [nvarchar](max) NULL,
 CONSTRAINT [PK_NetworkMapItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NetworkMapViews]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NetworkMapViews](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [nvarchar](255) NULL,
	[CustomerI3D] [int] NOT NULL,
	[LayoutStrategy] [nvarchar](255) NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedByEmployeeI3D] [int] NOT NULL,
	[ChangedByEmployeeI3D] [int] NULL,
	[LastChangedDate] [datetime2](7) NULL,
	[Preview] [varbinary](max) NULL,
 CONSTRAINT [PK_NetworkMapViews] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NexusNotifications]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NexusNotifications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[UserI3D] [int] NULL,
	[UserKind] [int] NOT NULL,
	[ByUserI3D] [int] NULL,
	[ByUserKind] [int] NOT NULL,
	[CreatedDate] [datetime2](2) NOT NULL,
	[HelpdeskI3D] [int] NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NULL,
	[Text] [nvarchar](400) NULL,
	[Type] [int] NOT NULL,
	[IsSeen] [bit] NOT NULL,
	[IsRead] [bit] NOT NULL,
	[HelpdeskNumber] [int] NULL,
	[HelpdeskShortDescription] [nvarchar](250) NULL,
	[CustomerName] [nvarchar](250) NULL,
 CONSTRAINT [PK_NexusNotifications] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NexusTicketViews]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NexusTicketViews](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IndexOf] [int] NOT NULL,
	[Caption] [nvarchar](255) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[IsGlobal] [bit] NOT NULL,
	[Configuration] [nvarchar](max) NULL,
	[GlobalViewI3D] [int] NULL,
	[ChangedBy] [int] NULL,
 CONSTRAINT [PK_NexusTicketViews] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NotificationUsers]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NotificationUsers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](20) NOT NULL,
	[Firstname] [nvarchar](100) NOT NULL,
	[Lastname] [nvarchar](100) NOT NULL,
	[Phone] [nvarchar](60) NOT NULL,
	[Email] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_NotificationUsers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NotificationUsersToObjects]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NotificationUsersToObjects](
	[NotificationUserI3D] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
 CONSTRAINT [PK_NotificationUsersToObjects] PRIMARY KEY CLUSTERED 
(
	[ObjectKind] ASC,
	[ObjectI3D] ASC,
	[NotificationUserI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Nummernkreis]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Nummernkreis](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NummerArt] [int] NOT NULL,
	[MandantI3D] [int] NOT NULL,
	[Beschreibung] [varchar](50) NULL,
	[BereichVon] [int] NULL,
	[BereichBis] [int] NULL,
	[Aktuell] [int] NULL,
	[Intervall] [int] NULL,
	[BranchI3D] [int] NULL,
	[FilialI3D] [int] NULL,
 CONSTRAINT [PK_Nummernkreis] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ObjectCollections]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ObjectCollections](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerI3D] [int] NOT NULL,
	[DispID] [int] NULL,
	[Name] [varchar](30) NULL,
	[OrderByExpr] [varchar](80) NULL,
	[Extended] [int] NULL,
	[Merge] [int] NULL,
	[VersionDependant] [int] NULL,
 CONSTRAINT [PK_ObjectCollections] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ObjectFields]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ObjectFields](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerI3D] [int] NULL,
	[FieldIndex] [int] NULL,
	[Name] [varchar](50) NULL,
	[DefFindName] [varchar](50) NULL,
	[DefValueName] [varchar](50) NULL,
	[DBFieldName] [varchar](50) NULL,
	[RefTypeFieldName] [varchar](50) NULL,
	[Description] [varchar](100) NULL,
	[DispID] [int] NULL,
	[DefFindDispID] [int] NULL,
	[DefValueDispID] [int] NULL,
	[DefValue] [varchar](50) NULL,
	[DataType] [int] NULL,
	[RefObjectI3D] [int] NULL,
	[Fest] [int] NULL,
	[Format] [varchar](20) NULL,
	[HasDefault] [int] NULL,
	[DefaultValue] [varchar](300) NULL,
	[HasDefaultFind] [int] NULL,
	[DefaultFind] [varchar](300) NULL,
	[Persistent] [int] NULL,
	[Required] [int] NULL,
	[RequiredText] [varchar](300) NULL,
	[FindExpression] [varchar](100) NULL,
	[AggPath] [varchar](150) NULL,
	[AggExpr] [varchar](50) NULL,
	[AggKind] [int] NULL,
	[Fixed] [int] NULL,
 CONSTRAINT [PK_ObjectFields] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ObjectFulltextIndex]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ObjectFulltextIndex](
	[I3D] [bigint] IDENTITY(1,1) NOT NULL,
	[TextValue] [nvarchar](1000) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
 CONSTRAINT [PK_ObjectFulltextIndex] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_ObjectFulltextIndex]    Script Date: 11.11.2025 11:20:28 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_ObjectFulltextIndex] ON [dbo].[ObjectFulltextIndex]
(
	[ObjectI3D] ASC,
	[ObjectKind] ASC,
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ObjectFulltextIndexStats]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ObjectFulltextIndexStats](
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[LastUpdate] [datetime2](2) NOT NULL,
	[IsUpdateRequested] [bit] NOT NULL,
 CONSTRAINT [PK_ObjectFulltextIndexStats] PRIMARY KEY CLUSTERED 
(
	[ObjectI3D] ASC,
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ObjectHeritage]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ObjectHeritage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ParentI3D] [int] NOT NULL,
	[MapAllPropertys] [int] NULL,
 CONSTRAINT [PK_ObjectHeritage] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ObjectMappings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ObjectMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MappedObjectI3D] [int] NULL,
	[DestObjectI3D] [int] NULL,
	[DestFieldI3D] [int] NULL,
	[FieldValue] [varchar](50) NULL,
 CONSTRAINT [PK_ObjectMappings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ObjektArt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ObjektArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Ausloeser] [int] NULL,
	[ObjArtI3D] [int] NULL,
	[Name] [varchar](50) NULL,
 CONSTRAINT [PK_ObjektArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OfferImportSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OfferImportSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kind] [int] NOT NULL,
	[RoutineName] [nvarchar](100) NOT NULL,
	[DescriptionInSource] [bit] NULL,
	[DescriptionInDatabase] [bit] NULL,
	[DescriptionFromVendor] [bit] NULL,
	[VendorDescription] [nvarchar](100) NULL,
	[VendorCode] [nvarchar](100) NOT NULL,
	[Amount] [nvarchar](100) NOT NULL,
	[Description] [nvarchar](100) NULL,
	[PurchasePrice] [nvarchar](100) NULL,
	[Seperator] [nvarchar](100) NULL,
	[IsPriceUpdate] [bit] NULL,
	[BeginReadRow] [int] NULL,
	[EndReadRow] [int] NULL,
	[SalesPriceColumn] [nvarchar](100) NULL,
	[ExcelSheetIndex] [int] NULL,
	[XmlImportKind] [nvarchar](100) NULL,
	[SumCalcField] [nvarchar](100) NULL,
	[RootNode] [nvarchar](100) NULL,
	[OfferPositionNode] [nvarchar](100) NULL,
	[SubPositionNode] [nvarchar](100) NULL,
	[ConcatVendorCode] [bit] NULL,
	[OnlyNewAndAddImport] [bit] NULL,
	[CustomerCostCenterColumn] [nvarchar](200) NULL,
 CONSTRAINT [PK_OfferImportSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OfferProjectLayouts]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OfferProjectLayouts](
	[I3D] [int] NOT NULL,
	[OfferI3D] [int] NOT NULL,
	[LayoutOrder] [int] NOT NULL,
	[Title] [nvarchar](255) NOT NULL,
	[LayoutKind] [int] NOT NULL,
	[FileData] [image] NULL,
	[PreviewImage] [image] NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_OfferProjectLayouts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OneWayContact]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OneWayContact](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Street] [nvarchar](64) NULL,
	[ZIP] [nvarchar](16) NULL,
	[City] [nvarchar](64) NULL,
	[CountryI3D] [int] NULL,
	[TitleI3D] [int] NULL,
	[Company] [nvarchar](128) NULL,
	[Firstname] [nvarchar](64) NULL,
	[Lastname] [nvarchar](64) NULL,
	[AddText] [nvarchar](128) NULL,
	[Comment] [nvarchar](2000) NULL,
	[IsActive] [int] NULL,
	[Fon] [nvarchar](64) NULL,
	[Mail] [nvarchar](128) NULL,
	[Receiver] [nvarchar](64) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OnlineBankingAccountTransactions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OnlineBankingAccountTransactions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OnlineBankingConfigurationI3D] [int] NOT NULL,
	[TypeCode] [nvarchar](10) NOT NULL,
	[BookingDate] [datetime2](0) NOT NULL,
	[Amount] [decimal](18, 7) NOT NULL,
	[Currency] [nvarchar](10) NOT NULL,
	[Description] [nvarchar](500) NOT NULL,
	[BookingText] [nvarchar](100) NOT NULL,
	[BIC] [nvarchar](11) NOT NULL,
	[AccountIBAN] [nvarchar](34) NOT NULL,
	[Sender] [nvarchar](100) NOT NULL,
	[RelatedCustomerI3D] [int] NULL,
	[CustomerMatchingRate] [float] NULL,
	[IsVisible] [bit] NOT NULL,
	[IsCompleted] [bit] NOT NULL,
	[CompletedDate] [datetime2](0) NULL,
	[RelatedCustomerName] [nvarchar](250) NULL,
	[CustomerMatchingHeuristic] [int] NULL,
	[TransactionState] [int] NOT NULL,
 CONSTRAINT [PK_OnlineBankingAccountTransactions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OnlineBankingConfigurations]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OnlineBankingConfigurations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](250) NOT NULL,
	[Description] [nvarchar](1000) NULL,
	[ConfigurationType] [int] NOT NULL,
	[BranchI3D] [int] NULL,
	[CreatedByEmployeeI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CreatedVersion] [nvarchar](20) NOT NULL,
	[ChangedByEmployeeI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
	[ChangedVersion] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_OnlineBankingConfigurations] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OnlineBankingConfigurationsFinApi]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OnlineBankingConfigurationsFinApi](
	[OnlineBankingConfigurationI3D] [int] NOT NULL,
	[UserAccountPassword] [nvarchar](250) NULL,
	[SaveUserAccountPassword] [bit] NOT NULL,
	[FirstAccessDate] [datetime2](0) NULL,
 CONSTRAINT [PK_OnlineBankingConfigurationsFinApi] PRIMARY KEY CLUSTERED 
(
	[OnlineBankingConfigurationI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OnlineBankingConfigurationsFinTS]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OnlineBankingConfigurationsFinTS](
	[OnlineBankingConfigurationI3D] [int] NOT NULL,
	[AccountHolder] [nvarchar](250) NOT NULL,
	[AccountNumber] [nvarchar](10) NOT NULL,
	[AccountIBAN] [nvarchar](34) NOT NULL,
	[AccountUserId] [nvarchar](250) NOT NULL,
	[AccountUserPassword] [nvarchar](250) NOT NULL,
	[BankCode] [nvarchar](8) NOT NULL,
	[BankBIC] [nvarchar](11) NOT NULL,
	[ServiceURL] [nvarchar](2000) NOT NULL,
	[ServiceVersion] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_OnlineBankingConfigurationsFinTS] PRIMARY KEY CLUSTERED 
(
	[OnlineBankingConfigurationI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OnlineBankingConfigurationsSpreadsheet]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OnlineBankingConfigurationsSpreadsheet](
	[OnlineBankingConfigurationI3D] [int] NOT NULL,
	[FileType] [int] NOT NULL,
 CONSTRAINT [PK_OnlineBankingConfigurationsSpreadsheet] PRIMARY KEY CLUSTERED 
(
	[OnlineBankingConfigurationI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OnlineBankingTransactionAssignments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OnlineBankingTransactionAssignments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AccountTransactionI3D] [int] NULL,
	[ReceiptI3D] [int] NOT NULL,
	[ReceiptObjectKind] [int] NOT NULL,
	[ReceiptMatchingRate] [float] NULL,
	[ReceiptDemandedGrossAmount] [decimal](18, 7) NOT NULL,
	[ReceiptPaidGrossAmount] [decimal](18, 7) NOT NULL,
	[ReceiptOpenGrossAmount] [decimal](18, 7) NOT NULL,
	[ReceiptDate] [datetime2](0) NOT NULL,
	[ReceiptNumber] [int] NOT NULL,
	[ReceiptCaption] [nvarchar](70) NULL,
	[AssignedAmount] [decimal](18, 7) NOT NULL,
	[AssignmentState] [int] NOT NULL,
	[IsBooked] [bit] NOT NULL,
	[BookedByEmployeeI3D] [int] NULL,
	[BookedDate] [datetime2](0) NULL,
	[CreditVouchersGrossAmount] [decimal](18, 7) NOT NULL,
	[BookedReceiptDemandedGrossAmount] [decimal](18, 7) NULL,
	[BookedReceiptPaidGrossAmount] [decimal](18, 7) NULL,
	[BookedReceiptOpenGrossAmount] [decimal](18, 7) NULL,
	[BookedCreditVouchersGrossAmount] [decimal](18, 7) NULL,
	[ReceiptMatchingHeuristic] [int] NULL,
 CONSTRAINT [PK_OnlineBankingTransactionAssignments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OnlinePdfDocuments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OnlinePdfDocuments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Guid] [char](32) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[PdfDocument] [varbinary](max) NULL,
	[Description] [nvarchar](max) NULL,
	[ExpectedSignature] [nvarchar](200) NULL,
	[ExpirationDate] [datetime2](7) NULL,
 CONSTRAINT [PK_OnlinePdfDocuments] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [CI_OnlinePdfDocuments] UNIQUE CLUSTERED 
(
	[Guid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Opos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Opos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenID] [int] NULL,
	[RechnungNr] [int] NULL,
	[Datum] [datetime] NULL,
	[Faelligkeit] [datetime] NULL,
	[Belegnr] [int] NULL,
	[Gegenkonto] [int] NULL,
	[Kz] [int] NULL,
	[BetrSoll] [float] NULL,
	[BetrHaben] [float] NULL,
	[Saldo] [float] NULL,
	[R] [varchar](5) NULL,
	[Fael] [int] NULL,
	[BuchungsText] [varchar](255) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK__Opos__34E8D562] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[OrderProcessingContractTemplates]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OrderProcessingContractTemplates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[WordDocument] [varbinary](max) NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedBy] [int] NULL,
	[ChangedDate] [datetime2](7) NULL,
	[MailSubject] [nvarchar](128) NULL,
	[MailBody] [nvarchar](max) NULL,
	[AcceptMailSubject] [nvarchar](128) NULL,
	[AcceptMailBody] [nvarchar](max) NULL,
	[CreatorAcceptMailSubject] [nvarchar](128) NULL,
	[CreatorAcceptMailBody] [nvarchar](max) NULL,
	[DeclinedMailSubject] [nvarchar](128) NULL,
	[DeclinedMailBody] [nvarchar](max) NULL,
	[UseOwnTemplateText] [bit] NOT NULL,
	[ContractNameForCustomerPdf] [nvarchar](256) NULL,
	[ContractNameForCentronFiles] [nvarchar](256) NULL,
 CONSTRAINT [PK_OrderProcessingContractTemplates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PackageManagerInfos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PackageManagerInfos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PackageInfoId] [int] NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[Version] [nvarchar](200) NOT NULL,
	[Channel] [nvarchar](200) NOT NULL,
	[ReleaseDate] [datetimeoffset](7) NOT NULL,
	[Product] [nvarchar](200) NOT NULL,
	[IsDeactivated] [bit] NOT NULL,
	[InternalReleaseDate] [datetimeoffset](7) NULL,
	[ReleasedByEmployeeI3D] [int] NULL,
 CONSTRAINT [PK_PackageManagerInfos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PartialCommissionItemToBarcodeRelations]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PartialCommissionItemToBarcodeRelations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BarcodeI3D] [int] NOT NULL,
	[PartialCommissionOrderI3D] [int] NOT NULL,
	[PartialCommissionOrderItemI3D] [int] NOT NULL,
	[CreatedByEmployeeI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CreatedVersion] [nvarchar](20) NOT NULL,
	[ChangedByEmployeeI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
	[ChangedVersion] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_PartialCommissionItemToBarcodeRelations] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PartialCommissionOrderItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PartialCommissionOrderItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PartialCommissionOrderI3D] [int] NULL,
	[ReceiptOrderItemI3D] [int] NOT NULL,
	[TargetQuantity] [decimal](19, 7) NOT NULL,
	[CurrentQuantity] [decimal](19, 7) NOT NULL,
 CONSTRAINT [PK_PartialCommissionOrderItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PartialCommissionOrders]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PartialCommissionOrders](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptOrderI3D] [int] NOT NULL,
	[Caption] [nvarchar](1000) NOT NULL,
	[DueDate] [datetime2](0) NULL,
	[Info] [nvarchar](4000) NULL,
	[CreatedByEmployeeI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CreatedVersion] [nvarchar](20) NOT NULL,
	[ChangedByEmployeeI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
	[ChangedVersion] [nvarchar](20) NOT NULL,
	[State] [int] NOT NULL,
	[CommissionedByEmployeeI3D] [int] NULL,
	[CommissionDate] [datetime2](0) NULL,
 CONSTRAINT [PK_PartialCommissionOrders] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ParticipantArticles]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ParticipantArticles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[ArticleI3D] [int] NOT NULL,
	[Price] [int] NULL,
	[SpecialArticleKind] [int] NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[UseDefaultPrice] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagement]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagement](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[PasswordManagementTypeI3D] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
	[AssetItemI3D] [int] NULL,
	[AssetItemType] [varchar](54) NULL,
	[PasswordManagementKeywordI3D] [int] NULL,
	[Comment] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagementAccessLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagementAccessLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PasswordManagementKeywordI3D] [int] NOT NULL,
	[ActionType] [varchar](54) NOT NULL,
	[Date] [datetime] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagementKeyword]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagementKeyword](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PasswordManagementI3D] [int] NOT NULL,
	[Username] [nvarchar](128) NOT NULL,
	[Salt] [nvarchar](128) NOT NULL,
	[Password] [nvarchar](128) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagementLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagementLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PasswordManagementI3D] [int] NOT NULL,
	[ActionType] [varchar](54) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Date] [datetime] NOT NULL,
	[OldValue] [nvarchar](4000) NULL,
	[NewValue] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagementType]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagementType](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](54) NOT NULL,
	[Status] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagerCustomerCategories]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagerCustomerCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[CategoryI3D] [int] NOT NULL,
 CONSTRAINT [PK_PasswordManagerCustomerCategories] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagerGuidelineCategories]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagerGuidelineCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[GuidelineI3D] [int] NOT NULL,
	[CategoryI3D] [int] NOT NULL,
 CONSTRAINT [PK_PasswordManagerGuidelineCategories] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_PasswordManagerGuidelineCategories]    Script Date: 11.11.2025 11:20:28 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_PasswordManagerGuidelineCategories] ON [dbo].[PasswordManagerGuidelineCategories]
(
	[GuidelineI3D] ASC,
	[CategoryI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagerGuidelineCustomers]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagerGuidelineCustomers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[GuidelineI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
 CONSTRAINT [PK_PasswordManagerGuidelineCustomers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagerGuidelineDepartments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagerGuidelineDepartments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[GuidelineI3D] [int] NOT NULL,
	[DepartmentI3D] [int] NOT NULL,
 CONSTRAINT [PK_PasswordManagerGuidelineDepartments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagerGuidelineEmployees]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagerGuidelineEmployees](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[GuidelineI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
 CONSTRAINT [PK_PasswordManagerGuidelineEmployees] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagerGuidelineExcludedCustomers]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagerGuidelineExcludedCustomers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[GuidelineI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
 CONSTRAINT [PK_PasswordManagerGuidelineExcludedCustomers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagerGuidelines]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagerGuidelines](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[Description] [nvarchar](200) NULL,
	[LimitedValidity] [bit] NOT NULL,
	[LimitedValidityDateFrom] [datetime2](7) NULL,
	[LimitedValidityDateUntil] [datetime2](7) NULL,
	[Deactivated] [bit] NOT NULL,
	[AccessDataVisible] [bit] NOT NULL,
	[AccessDataEditable] [bit] NOT NULL,
	[SealingAllowed] [bit] NOT NULL,
	[SealBreak] [bit] NOT NULL,
	[TwoFactorAuthentification] [bit] NULL,
	[Notification] [bit] NULL,
	[VPNAccessesEditable] [bit] NOT NULL,
	[AccessDataDeletable] [bit] NOT NULL,
 CONSTRAINT [PK_PasswordManagerGuidelines] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PasswordManagerLogs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PasswordManagerLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ActionKind] [tinyint] NOT NULL,
	[ItemI3D] [int] NOT NULL,
	[ValueI3D] [int] NULL,
	[OldValue] [nvarchar](200) NULL,
	[NewValue] [nvarchar](200) NULL,
	[PropertyI3D] [int] NULL,
	[Comment] [nvarchar](200) NULL,
 CONSTRAINT [PK_PasswordManagerLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PatchManagementDeployableJob]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PatchManagementDeployableJob](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateJobI3D] [int] NULL,
	[CustomerI3D] [int] NULL,
	[Name] [nvarchar](255) NOT NULL,
	[InstallationTyp] [int] NOT NULL,
	[NeverEnds] [bit] NOT NULL,
	[InstallationInterval] [int] NOT NULL,
	[InstallationTime] [datetime] NOT NULL,
	[DownloadInterval] [int] NOT NULL,
	[DownloadIntervalTime] [datetime] NOT NULL,
	[InstallOnExternalDevices] [bit] NOT NULL,
	[InstallOnExternalDevicesWithRestrictedConnection] [bit] NOT NULL,
	[JobFinished] [bit] NOT NULL,
	[FinishedDate] [datetime] NULL,
	[CreatedBy] [int] NOT NULL,
	[CreationDate] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
	[InstallationIntervalMonday] [bit] NOT NULL,
	[InstallationIntervalTuesday] [bit] NOT NULL,
	[InstallationIntervalWednesday] [bit] NOT NULL,
	[InstallationIntervalThursday] [bit] NOT NULL,
	[InstallationIntervalFriday] [bit] NOT NULL,
	[InstallationIntervalSaturday] [bit] NOT NULL,
	[InstallationIntervalSunday] [bit] NOT NULL,
	[DownloadIntervalMonday] [bit] NOT NULL,
	[DownloadIntervalTuesday] [bit] NOT NULL,
	[DownloadIntervalWednesday] [bit] NOT NULL,
	[DownloadIntervalThursday] [bit] NOT NULL,
	[DownloadIntervalFriday] [bit] NOT NULL,
	[DownloadIntervalSaturday] [bit] NOT NULL,
	[DownloadIntervalSunday] [bit] NOT NULL,
	[StartJobDateTime] [datetime] NULL,
	[ServiceConnectorI3DWhichGotIt] [int] NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PatchManagementDeployableJobAssignedDevice]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PatchManagementDeployableJobAssignedDevice](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RunningJobI3D] [int] NOT NULL,
	[DeviceHostnameOrIp] [nvarchar](255) NOT NULL,
	[AllInstallationsFinished] [bit] NOT NULL,
	[Status] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
 CONSTRAINT [PK_PatchManagementDeployableJobAssignedDevice] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PatchManagementDeployableJobAssignedPackages]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PatchManagementDeployableJobAssignedPackages](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[JobI3D] [int] NOT NULL,
	[VersionPortalI3D] [int] NULL,
	[PackagePortalI3D] [int] NULL,
	[Status] [int] NOT NULL,
	[ServiceConnectorDownloadSuccessful] [bit] NULL,
	[ServiceConnectorDownloadErrorMessage] [ntext] NULL,
 CONSTRAINT [PK_PatchManagementDeployableJobAssignedPackages] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PatchManagementDeployableJobInstallationHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PatchManagementDeployableJobInstallationHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[JobAssignedDeviceI3D] [int] NOT NULL,
	[VersionPortalI3D] [int] NOT NULL,
	[InstallationSuccessful] [bit] NULL,
	[InstallationErrorMessage] [ntext] NULL,
	[DownloadSuccessful] [bit] NULL,
	[DownloadErrorMessage] [ntext] NULL,
	[Status] [int] NOT NULL,
 CONSTRAINT [PK_PatchManagementDeployableJobInstallationHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PatchManagementDeploymentInstallationHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PatchManagementDeploymentInstallationHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[InstalledByEmployeeI3D] [int] NOT NULL,
	[InstallDate] [datetime] NOT NULL,
	[VersionPortalI3D] [int] NOT NULL,
	[DeviceHostnameOrIp] [nvarchar](255) NULL,
	[DeviceI3D] [int] NULL,
	[CustomerI3D] [int] NOT NULL,
	[InstallationKind] [int] NOT NULL,
 CONSTRAINT [PK_PatchManagementDeployableInstallationHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PDFCreatorProperty]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PDFCreatorProperty](
	[PrinterName] [varchar](200) NOT NULL,
	[PrinterDistinationPath] [varchar](200) NOT NULL,
	[EmployeeI3d] [int] NOT NULL,
	[PCName] [varchar](100) NOT NULL,
	[I3D] [int] IDENTITY(1,1) NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Index [PK_PDFCreator]    Script Date: 11.11.2025 11:20:28 ******/
CREATE CLUSTERED INDEX [PK_PDFCreator] ON [dbo].[PDFCreatorProperty]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PerformanceTestResult]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PerformanceTestResult](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[MeasureDate] [datetime2](7) NOT NULL,
	[MeasuredByAppUserI3D] [int] NOT NULL,
	[MachineName] [nvarchar](200) NOT NULL,
	[MachineTotalMemory] [bigint] NOT NULL,
	[MachineAvailableMemory] [bigint] NOT NULL,
	[ProcessMemoryInUse] [bigint] NOT NULL,
	[ProcessPeakMemoryInUse] [bigint] NOT NULL,
	[CreateDummyTable] [bigint] NULL,
	[InsertDataIntoDummyTable] [bigint] NULL,
	[QueryDummyTable] [bigint] NULL,
	[DeleteDataFromDummyTable] [bigint] NULL,
	[DeleteDummyTable] [bigint] NULL,
	[QueryEmployees] [bigint] NULL,
	[QueryCustomers] [bigint] NULL,
	[QueryReceipts] [bigint] NULL,
	[QueryTickets] [bigint] NULL,
	[WebServiceConnection] [bigint] NOT NULL,
	[ConnectionType] [nvarchar](200) NOT NULL,
	[ClientMachineName] [nvarchar](200) NOT NULL,
	[ClientMachineTotalMemory] [bigint] NOT NULL,
	[ClientMachineAvailableMemory] [bigint] NOT NULL,
	[ClientProcessMemoryInUse] [bigint] NOT NULL,
	[ClientProcessPeakMemoryInUse] [bigint] NOT NULL,
 CONSTRAINT [PK_PerformanceTestResult] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PermanentLoginToken]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PermanentLoginToken](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Token] [nvarchar](127) NOT NULL,
	[DeviceGuid] [uniqueidentifier] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[LastContact] [datetime2](7) NOT NULL,
	[ApplicationType] [int] NOT NULL,
	[CreatedAt] [datetime2](7) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalErtrage]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalErtrage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AbteilungI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Datum_von] [datetime] NULL,
	[Datum_bis] [datetime] NULL,
	[Ertrag] [float] NULL,
	[Umsatz] [float] NULL,
 CONSTRAINT [PK_PersonalErtrage] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalGrpAbtZuord]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalGrpAbtZuord](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalGruppenI3D] [int] NULL,
	[MaAbteilungI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalGrpPersZuord]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalGrpPersZuord](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalGruppenI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalKosten]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalKosten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[Monat] [int] NULL,
	[Jahr] [int] NULL,
	[Datum] [datetime] NULL,
	[Betrag] [float] NULL,
	[LetzteAenderungAm] [datetime] NULL,
	[LetzteAenderungVon] [varchar](50) NULL,
	[Bezeichnung] [varchar](10) NULL,
	[Kosten] [float] NULL,
	[Januar] [float] NULL,
	[Februar] [float] NULL,
	[März] [float] NULL,
	[April] [float] NULL,
	[Mai] [float] NULL,
	[Juni] [float] NULL,
	[Juli] [float] NULL,
	[August] [float] NULL,
	[September] [float] NULL,
	[Oktober] [float] NULL,
	[November] [float] NULL,
	[Dezember] [float] NULL,
 CONSTRAINT [PK_PersonalKosten] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalSettingsProfile]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalSettingsProfile](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[ProfileName] [varchar](54) NOT NULL,
	[FormSettings] [text] NULL,
	[Active] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalSkills]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalSkills](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[SkillI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalUnterweisung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalUnterweisung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[KundeI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalUrlaub]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalUrlaub](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Soll] [float] NULL,
	[Ist] [float] NULL,
	[Jahr] [int] NULL,
	[Status] [int] NULL,
	[TerminplanungI3D] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[GeaendertI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[GeaendertDatum] [datetime] NULL,
	[ParentId] [int] NULL,
	[Ursprungsjahr] [int] NULL,
	[Urlaubsart] [int] NULL,
	[PersonalI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalUrlaubArt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalUrlaubArt](
	[I3D] [int] NOT NULL,
	[Kurzzeichen] [varchar](4) NULL,
	[Name] [varchar](50) NULL,
 CONSTRAINT [PK_PersonalUrlaubArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalVertretung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalVertretung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[VertretungPersonalI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonalZuMailAgentRollen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonalZuMailAgentRollen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[MailAgentRollenI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonenAktivitaet]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonenAktivitaet](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[AnsprechI3D] [int] NULL,
	[AktivitaetI3D] [int] NULL,
 CONSTRAINT [PK_PersonenAktivitaet] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PersonenSozialesNetzwerk]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PersonenSozialesNetzwerk](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SozialesNetzwerkI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
	[URL] [varchar](500) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PlmLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PlmLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProductFamilyGroupI3D] [int] NULL,
	[ProductFamilyI3D] [int] NULL,
	[Description] [nvarchar](255) NOT NULL,
	[ChangedBy] [nvarchar](50) NOT NULL,
	[ChangedAt] [datetime2](0) NOT NULL,
 CONSTRAINT [PK_PlmLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PORTDEBI]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PORTDEBI](
	[Kundennummer] [float] NULL,
	[MandantenKredNr] [float] NULL,
	[Debitorenname] [varchar](40) NULL,
	[I3D] [int] IDENTITY(1,1) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PriceUpdateSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PriceUpdateSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[UpdateEkForReceipt] [bit] NULL,
	[UpdateVkForReceipt] [bit] NULL,
	[IsArticleUpdate] [bit] NULL,
	[IsReceiptUpdate] [bit] NULL,
	[MassUpdateType] [int] NOT NULL,
	[IsCustomerAdvisorUpdate] [bit] NULL,
	[IsCustomerOptionsUpdate] [bit] NULL,
	[IsMailTemplateUpdate] [bit] NULL,
 CONSTRAINT [PK_PriceUpdateSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Printer]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Printer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PageCollate] [int] NULL,
	[Copies] [int] NULL,
	[Dialog] [int] NULL,
	[PrinterName] [varchar](255) NULL,
	[Orientation] [int] NULL,
	[PaperSource] [int] NULL,
	[PaperSize] [int] NULL,
	[ReportGroup] [varchar](10) NULL,
	[DefaultPrinter] [int] NULL,
	[FaxPrinter] [int] NULL,
	[Orientation2] [int] NULL,
	[PaperSource2] [int] NULL,
	[PaperSize2] [int] NULL,
	[ReportI3D] [int] NULL,
	[Duplex] [int] NULL,
	[PersonalI3D] [int] NULL,
	[PCName] [varchar](50) NULL,
	[DuplikatI3D] [int] NULL,
	[DruckerEinstellungVerwenden] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductFamilyAction]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductFamilyAction](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NOT NULL,
	[Description] [nvarchar](200) NULL,
	[CreatedBy] [int] NULL,
	[ChangedBy] [int] NULL,
	[CreatedDate] [datetime] NULL,
	[ChangedDate] [datetime] NULL,
	[OwnerI3D] [int] NULL,
	[OwnerKind] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductionOrderItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductionOrderItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProductionOrderI3D] [int] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[ArticleI3D] [int] NOT NULL,
	[Description] [nvarchar](4000) NULL,
	[DurationInMinutes] [int] NULL,
	[SortOrder] [decimal](9, 6) NOT NULL,
	[RequiredAmount] [int] NOT NULL,
	[MachineKindI3D] [int] NOT NULL,
	[MachineI3D] [int] NULL,
	[ExecutionDate] [datetime2](7) NULL,
	[ExecutionDailyRunPhase] [int] NULL,
	[Comment] [nvarchar](4000) NULL,
	[ProducedAmount] [int] NOT NULL,
	[State] [int] NOT NULL,
	[LastChange] [datetime2](0) NULL,
	[LastChangedBy] [int] NULL,
	[WorkingEmployeeI3D] [int] NULL,
	[LengthInMm] [int] NULL,
	[HeightInMm] [int] NULL,
	[ThicknessInMm] [int] NULL,
	[WeightInKg] [int] NULL,
 CONSTRAINT [PK_ProductionOrderItems] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_ProductionOrderItems]    Script Date: 11.11.2025 11:20:28 ******/
CREATE CLUSTERED INDEX [CI_ProductionOrderItems] ON [dbo].[ProductionOrderItems]
(
	[ProductionOrderI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductionOrderLogs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductionOrderLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProductionOrderI3D] [int] NOT NULL,
	[ProductionOrderItemI3D] [int] NULL,
	[Kind] [int] NOT NULL,
	[Message] [nvarchar](4000) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CreatedVersion] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_ProductionOrderLogs] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_ProductionOrderLogs]    Script Date: 11.11.2025 11:20:28 ******/
CREATE CLUSTERED INDEX [CI_ProductionOrderLogs] ON [dbo].[ProductionOrderLogs]
(
	[ProductionOrderI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductionOrders]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductionOrders](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[OrderI3D] [int] NOT NULL,
	[OrderNumber] [int] NOT NULL,
	[OrderItemI3D] [int] NULL,
	[PlannedFinishDate] [datetime2](7) NULL,
	[Comment] [nvarchar](4000) NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedVersion] [nvarchar](20) NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedVersion] [nvarchar](20) NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
 CONSTRAINT [PK_ProductionOrders] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProductLifecycleInformations]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProductLifecycleInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SourceType] [int] NOT NULL,
	[ProductFamilyI3D] [int] NULL,
	[AccountI3D] [int] NOT NULL,
	[AccountName] [nvarchar](255) NOT NULL,
	[InvoiceI3D] [int] NULL,
	[InvoiceItemI3D] [int] NULL,
	[InvoiceNumber] [nvarchar](255) NULL,
	[InvoiceDate] [datetime2](0) NULL,
	[ArticleI3D] [int] NULL,
	[ArticleCode] [nvarchar](255) NULL,
	[ManufacturerCode] [nvarchar](255) NULL,
	[BarcodeI3D] [int] NULL,
	[Barcode] [nvarchar](200) NULL,
	[Quantity] [decimal](9, 2) NOT NULL,
	[Price] [decimal](12, 2) NOT NULL,
	[SumPrice] [decimal](12, 2) NOT NULL,
	[Description] [nvarchar](max) NULL,
	[StartDate] [datetime2](0) NULL,
	[EndDate] [datetime2](0) NULL,
	[CreatedAt] [datetime2](0) NOT NULL,
	[ChangedAt] [datetime2](0) NOT NULL,
	[ChangedBy] [nvarchar](50) NOT NULL,
	[ChangedManually] [bit] NOT NULL,
	[ChangedmanuallyBy] [nvarchar](50) NULL,
	[Email] [nvarchar](255) NULL,
	[Adviser1] [nvarchar](50) NULL,
	[Adviser2] [nvarchar](50) NULL,
	[Adviser3] [nvarchar](50) NULL,
	[Adviser4] [nvarchar](50) NULL,
	[Comment] [nvarchar](4000) NULL,
	[IsDeactivated] [bit] NOT NULL,
	[IsOfferSent] [bit] NOT NULL,
	[OfferI3D] [int] NULL,
	[SourceI3D] [int] NULL,
	[Model] [nvarchar](1024) NULL,
	[ShortName] [nvarchar](512) NULL,
	[DeviceName] [nvarchar](1024) NULL,
	[DeviceType] [nvarchar](512) NULL,
	[LicenseKey] [nvarchar](512) NULL,
	[AccountAddressContactI3D] [int] NULL,
	[IsFromDataImport] [bit] NOT NULL,
 CONSTRAINT [PK_ProductInformation] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Produkt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Produkt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProduktfamilieHersteller]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProduktfamilieHersteller](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](200) NULL,
	[Status] [int] NULL,
	[LaufzeitMonate] [int] NULL,
	[ErinnerungTage] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjectPriceImports]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjectPriceImports](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsDefault] [bit] NULL,
	[Name] [nvarchar](200) NULL,
	[TableLeafIndex] [int] NULL,
	[StartCellIndex] [int] NULL,
	[EndCellIndex] [int] NULL,
 CONSTRAINT [PK_ProjectPriceImports] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Projekt]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Projekt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektGruppenI3D] [int] NULL,
	[Name] [varchar](50) NULL,
	[Beschreibung] [varchar](100) NULL,
	[ErstelltVon] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVersion] [int] NULL,
	[GeaendertVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVersion] [int] NULL,
	[Status] [int] NULL,
	[ProjektBeginn] [datetime] NULL,
	[ProjektEnde] [datetime] NULL,
	[ProjektVorlage] [int] NULL,
	[ProjektGesperrtVon] [int] NULL,
	[ProjektGesperrtAm] [datetime] NULL,
	[AnsichtNurBeteiligte] [int] NULL,
	[AenderungenErlaubt] [int] NULL,
	[RootDirI3D] [int] NULL,
	[PhasenDirI3D] [int] NULL,
	[AufgabenDirI3D] [int] NULL,
	[Typ] [int] NULL,
	[Validierungspflicht] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektAkteure]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektAkteure](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[AkteurI3D] [int] NULL,
	[Herkunft] [int] NULL,
	[Aufgabe] [varchar](500) NULL,
	[SkillI3D] [int] NULL,
	[Mail] [int] NULL,
	[Status] [int] NULL,
	[KreditorI3D] [int] NULL,
 CONSTRAINT [PK_ProjektMitarbeiter] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektAkteurGrundlagen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektAkteurGrundlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[GrundlagenI3D] [int] NULL,
	[AkteurI3D] [int] NULL,
	[Herkunft] [int] NULL,
 CONSTRAINT [PK_ProjektAkteurGrundlagen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektAnlagen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektAnlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[ObjektArt] [int] NULL,
 CONSTRAINT [PK_ProjektAnlagen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektAufgaben]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektAufgaben](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](200) NULL,
	[Beschreibung] [varchar](1000) NULL,
	[Status] [int] NULL,
	[EntryID] [varchar](100) NULL,
	[ErstelltVon] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVersion] [int] NULL,
	[GeaendertVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVersion] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektBeteiligte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektBeteiligte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[Benachrichtigung] [int] NULL,
	[PersonArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektBeteiligtePersonen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektBeteiligtePersonen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BeteiligteI3D] [int] NULL,
	[Art] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektEinweisungsTexte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektEinweisungsTexte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ItemI3D] [int] NULL,
	[ItemArt] [int] NULL,
	[ProjektTexteVersionI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[Eingewiesen] [int] NULL,
	[EingewiesenVonI3D] [int] NULL,
	[EingewiesenDatum] [datetime] NULL,
	[Benachrichtigt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektExterne]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektExterne](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
	[Aufgabe] [varchar](100) NULL,
	[Mail] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektGrundlagen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektGrundlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [varchar](50) NULL,
	[ProjektI3D] [int] NULL,
	[Bezeichnung] [varchar](1000) NULL,
	[Akteure] [varchar](250) NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[Status] [int] NULL,
	[VerantwortlicherI3D] [int] NULL,
	[AkteurI3D] [int] NULL,
	[Herkunft] [int] NULL,
 CONSTRAINT [PK_Projektgrundlagen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektGruppen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Beschreibung] [varchar](500) NULL,
	[Status] [int] NULL,
	[ErstelltVon] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVersion] [int] NULL,
	[GeaendertVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVersion] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektMa]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektMa](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[MailBenachritigung] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektMaExtern]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektMaExtern](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
	[Aufgabe] [varchar](100) NULL,
	[Mail] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektMaIntern]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektMaIntern](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Aufgabe] [varchar](100) NULL,
	[Mail] [int] NULL,
	[SkillI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektMaKunde]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektMaKunde](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
	[Aufgabe] [varchar](100) NULL,
	[Mail] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektMitarbeiter]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektMitarbeiter](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[MailBenachritigung] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektMitarbeiterIntern]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektMitarbeiterIntern](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[BenutzerI3D] [int] NULL,
	[Mailbenachrichtigung] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektMitarbeiterKunde]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektMitarbeiterKunde](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
	[MailBenachrichtigung] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektNotiz]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektNotiz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[Notiz] [varchar](1000) NULL,
	[Datum] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[KurzZeich] [nvarchar](50) NULL,
 CONSTRAINT [PK_ProjektNotiz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektPersonenGruppen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektPersonenGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](60) NULL,
	[ProjektI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektPersonenGruppenMitarbeiter]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektPersonenGruppenMitarbeiter](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektPersonenGruppen] [int] NULL,
	[PersonI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektPhasen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektPhasen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektI3D] [int] NULL,
	[VorgaengerI3D] [int] NULL,
	[Name] [varchar](255) NULL,
	[Beschreibung] [text] NULL,
	[Art] [int] NULL,
	[PhaseBeginn] [datetime] NULL,
	[PhaseEnde] [datetime] NULL,
	[Status] [int] NULL,
	[ErstelltVon] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVersion] [int] NULL,
	[GeaendertVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVersion] [int] NULL,
	[Ebene] [int] NULL,
	[Pos] [int] NULL,
	[AnsichtNurBeteiligte] [int] NULL,
	[ErledigteAufgaben] [varchar](1000) NULL,
	[AenderungenErlaubt] [int] NULL,
	[Bnka] [int] NULL,
	[OwnerDirI3D] [int] NULL,
	[Nummer] [int] NULL,
	[Sortierung] [int] NULL,
	[Validierungspflicht] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektPhasenAbhaengigkeit]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektPhasenAbhaengigkeit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektPhasenI3D] [int] NULL,
	[AbhaengigI3D] [int] NULL,
	[Art] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektPhasenAufgaben]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektPhasenAufgaben](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektAufgabenI3D] [int] NULL,
	[ProjektPhaseI3D] [int] NULL,
	[ErstelltVon] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVersion] [int] NULL,
	[GeaendertVon] [int] NULL,
	[GeaendertAm] [datetime] NULL,
	[GeaendertVersion] [int] NULL,
	[Status] [int] NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[ProjektI3D] [int] NULL,
	[Ebene] [int] NULL,
	[Pos] [int] NULL,
	[AnsichtNurBeteiligte] [int] NULL,
	[Name] [varchar](200) NULL,
	[Beschreibung] [varchar](1000) NULL,
	[EntryID] [varchar](100) NULL,
	[ExterneInfo] [varchar](1000) NULL,
	[ErledigteAufgaben] [varchar](1000) NULL,
	[AenderungenErlaubt] [int] NULL,
	[Bnka] [int] NULL,
	[OwnerDirI3D] [int] NULL,
	[Nummer] [int] NULL,
	[Sortierung] [int] NULL,
	[Validierungspflicht] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektPhasenAufgabenAbhaengigkeit]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektPhasenAufgabenAbhaengigkeit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektPhasenAufgabenI3D] [int] NULL,
	[AbhaengigI3D] [int] NULL,
	[Art] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektPhasenAufgabenBeteiligte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektPhasenAufgabenBeteiligte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonI3D] [int] NULL,
	[ProjektPhasenAufgabenI3D] [int] NULL,
	[Benachrichtigung] [int] NULL,
	[PersonArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektPhasenBeteiligte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektPhasenBeteiligte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektPhasenI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[Benachrichtigung] [int] NULL,
	[PersonArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektTexte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektTexte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Beschreibung] [varchar](100) NULL,
	[VersionsNr] [int] NULL,
	[Freigabe] [int] NULL,
	[Datum] [datetime] NULL,
	[PersonalI3D] [int] NULL,
	[Daten] [image] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[FreigabeVonI3D] [int] NULL,
	[FreigabeDatum] [datetime] NULL,
	[PlainText] [text] NULL,
	[Validiert] [int] NULL,
	[ValidiertPersonalI3D] [int] NULL,
	[ValidiertDatum] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektTexteVerknuepfung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektTexteVerknuepfung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ItemI3D] [int] NULL,
	[ItemArt] [int] NULL,
	[ProjektTexteI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ProjektTexteVersion]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjektTexteVersion](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektTexteI3D] [int] NULL,
	[Beschreibung] [varchar](100) NULL,
	[VersionsNr] [int] NULL,
	[Freigabe] [int] NULL,
	[Datum] [datetime] NULL,
	[PersonalI3D] [int] NULL,
	[Daten] [image] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[FreigabeVonI3D] [int] NULL,
	[FreigabeDatum] [datetime] NULL,
	[PlainText] [text] NULL,
	[Validiert] [int] NULL,
	[ValidiertPersonalI3D] [int] NULL,
	[ValidiertDatum] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Projektverwaltung]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Projektverwaltung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ProjektNr] [varchar](50) NULL,
	[KundenI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[Projektueberschrift] [varchar](100) NULL,
	[ProjektIst] [varchar](2000) NULL,
	[ProjektSoll] [varchar](2000) NULL,
	[Status] [int] NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[Starttermin] [datetime] NULL,
	[ManagerI3D] [int] NULL,
	[VertriebMa] [int] NULL,
	[TechnikMa] [int] NULL,
	[KundenManagerI3D] [int] NULL,
	[KundenMa] [int] NULL,
	[AbnahmeErfolgt] [int] NULL,
	[AbnahmeAm] [datetime] NULL,
	[ProjektgrundlagenI3D] [int] NULL,
	[MailBeiAenderung] [int] NULL,
	[ProjDirI3D] [int] NULL,
	[Projektgrundlagen] [int] NULL,
 CONSTRAINT [PK_Projektverwaltung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Pruflinge]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Pruflinge](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Inventarnummer] [varchar](150) NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Beschreibung] [text] NULL,
	[LagerortQMI3D] [int] NULL,
	[Letzte] [datetime] NULL,
	[ErworbenAm] [datetime] NULL,
	[Bild] [image] NULL,
	[Naechste] [datetime] NULL,
 CONSTRAINT [PK_Pruflinge] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Prufmittel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Prufmittel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Inventarnummer] [varchar](150) NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Beschreibung] [text] NULL,
	[LagerortQMI3D] [int] NULL,
	[BetriebsstundenWoche] [int] NULL,
	[Bild] [image] NULL,
 CONSTRAINT [PK_Prufmittel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Prufvorschrift]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Prufvorschrift](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Text] [text] NULL,
 CONSTRAINT [PK_Prufvorschrift] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PrufvorschriftMesswert]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PrufvorschriftMesswert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PrufvorschriftI3D] [int] NULL,
	[Messwert] [varchar](150) NULL,
	[Einheit] [varchar](150) NULL,
 CONSTRAINT [PK_PrufvorschriftMesswert] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[QuickNote]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[QuickNote](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[QuickNoteCategory] [nvarchar](24) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[ShortDescription] [nvarchar](256) NOT NULL,
	[Description] [nvarchar](1024) NULL,
	[DateFrom] [datetime] NOT NULL,
	[DateTo] [datetime] NOT NULL,
	[Status] [int] NOT NULL,
	[AccountI3D] [int] NULL,
	[AccountKind] [int] NULL,
	[AddressI3D] [int] NULL,
	[ContactI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklistRecurrence]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklistRecurrence](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[StartDateTime] [datetime] NOT NULL,
	[BufferInMinutes] [int] NOT NULL,
	[EndDateOption] [int] NOT NULL,
	[EndAfterAmountCreatedChecklist] [int] NULL,
	[EndDateTime] [datetime] NULL,
	[CycleOption] [int] NOT NULL,
	[DailyOption] [int] NULL,
	[DailySeed] [int] NULL,
	[WeeklySeed] [int] NULL,
	[MonthlyOption] [int] NULL,
	[MonthlyDayFromMonth] [int] NULL,
	[MonthlySeed] [int] NULL,
	[MonthlyDaySeedOption] [int] NULL,
	[MonthlyDayOption] [int] NULL,
	[YearlySeed] [int] NULL,
	[YearlyDayFromMonth] [int] NULL,
	[YearlyMonth] [int] NULL,
	[YearlyDaySeedOption] [int] NULL,
	[YearlyDayOption] [int] NULL,
	[YearlyOption] [int] NULL,
	[Status] [int] NOT NULL,
	[DefaultChecklistI3D] [int] NULL,
	[Monday] [bit] NOT NULL,
	[Tuesday] [bit] NOT NULL,
	[Wednesday] [bit] NOT NULL,
	[Thursday] [bit] NOT NULL,
	[Friday] [bit] NOT NULL,
	[Saturday] [bit] NOT NULL,
	[Sunday] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklistRessources]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklistRessources](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[TypeOf] [int] NOT NULL,
	[EmployeeI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklists]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklists](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Status] [int] NOT NULL,
	[CreatedBy_PersonalI3D] [int] NULL,
	[IsTemplate] [bit] NOT NULL,
	[TemplateI3D] [int] NULL,
	[Description] [ntext] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklistVirtualObjectCategory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklistVirtualObjectCategory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [ntext] NULL,
	[Image] [image] NULL,
	[Status] [int] NOT NULL,
	[ParentI3D] [int] NULL,
	[IsFix] [bit] NOT NULL,
	[VirtualObjectKind] [int] NULL,
	[SourceI3D] [int] NULL,
	[CategoryKind] [int] NULL,
	[ChangedDate] [datetime] NULL,
	[ServiceBoardWebColor] [varchar](30) NULL,
	[ServiceBoardWebIcon] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklistVirtualObjectModel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklistVirtualObjectModel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ModelName] [nvarchar](512) NOT NULL,
	[Vendor] [nvarchar](512) NULL,
	[Status] [int] NOT NULL,
	[ObjectKind] [int] NULL,
	[CategoryI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklistVirtualObjects]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklistVirtualObjects](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[Name] [nvarchar](255) NOT NULL,
	[SourceType] [int] NULL,
	[SourceI3D] [int] NULL,
	[CommentOf] [ntext] NULL,
	[ObjectKind] [int] NULL,
	[ParentType] [int] NOT NULL,
	[ParentI3D] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[ModelName] [nvarchar](512) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklistWorkplanAssignmentObjects]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklistWorkplanAssignmentObjects](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WorkplanI3D] [int] NOT NULL,
	[VirtualObjectI3D] [int] NOT NULL,
	[Deactivated] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklistWorkplans]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklistWorkplans](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TemplateI3D] [int] NULL,
	[IsTemplate] [bit] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [ntext] NULL,
	[ChecklistI3D] [int] NULL,
	[TemplateParentI3D] [int] NOT NULL,
	[TemplateParentType] [int] NOT NULL,
	[RecurrenceI3D] [int] NULL,
	[StartDateTime] [datetime] NULL,
	[EndDateTime] [datetime] NULL,
	[OriginWorkplanI3D] [int] NULL,
	[Deactivated] [bit] NOT NULL,
	[IsOverallWorkplan] [bit] NOT NULL,
	[CustomerI3D] [int] NULL,
	[HasWorksteps] [bit] NOT NULL,
	[DurationMinutes] [int] NOT NULL,
	[IsRecurrenceDefault] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBChecklistWorksteps]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBChecklistWorksteps](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WorkplanI3D] [int] NULL,
	[WorkstepTemplateI3D] [int] NULL,
	[IsTemplate] [bit] NOT NULL,
	[OrderNumber] [int] NULL,
	[Description] [ntext] NULL,
	[Name] [nvarchar](255) NOT NULL,
	[DurationMinutes] [int] NULL,
	[Finished] [bit] NULL,
	[RessourceI3D] [int] NULL,
	[StepWorkplanI3D] [int] NULL,
	[Notice] [ntext] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBScheduleJobs]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBScheduleJobs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ScheduleName] [nvarchar](256) NOT NULL,
	[Description] [nvarchar](512) NULL,
	[RecurrenceI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Kind] [int] NOT NULL,
	[Subject] [nvarchar](512) NULL,
	[EmailBody] [nvarchar](max) NULL,
	[CreatedBy] [nvarchar](256) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedBy] [nvarchar](256) NULL,
	[ChangedDate] [datetime] NULL,
	[IsDeleted] [bit] NOT NULL,
 CONSTRAINT [PK_RBScheduleJobs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBScheduleMailRecipients]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBScheduleMailRecipients](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RBScheduleJobI3D] [int] NOT NULL,
	[RecepientType] [int] NOT NULL,
	[EmailId] [nvarchar](256) NOT NULL,
 CONSTRAINT [PK_RBScheduleMailRecipients] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBScheduleReportMappings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBScheduleReportMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportI3D] [int] NOT NULL,
	[ScheduleJobI3D] [int] NOT NULL,
 CONSTRAINT [PK_RBScheduleReportMappings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RBScheduleStatus]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RBScheduleStatus](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RBScheduleJobI3D] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[Message] [nvarchar](2000) NULL,
	[StatusDate] [datetime] NOT NULL,
 CONSTRAINT [PK_RBScheduleStatus] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptComments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptComments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptKind] [int] NOT NULL,
	[ReceiptI3D] [int] NOT NULL,
	[TimeStamp] [datetime2](0) NOT NULL,
	[Comment] [nvarchar](1000) NOT NULL,
	[IsOwnerComment] [bit] NOT NULL,
	[Status] [int] NULL,
	[SendMail] [bit] NOT NULL,
	[ReceiptPdfDocumentsI3D] [int] NOT NULL,
	[OwnerDisplayName] [nvarchar](200) NOT NULL,
	[OwnerI3D] [int] NULL,
 CONSTRAINT [PK_ReceiptComments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptItemServiceArticleClassifications]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptItemServiceArticleClassifications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](100) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[ParentI3D] [int] NULL,
 CONSTRAINT [PK_ReceiptItemsServiceArticleClassifications] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptPdfDocumentLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptPdfDocumentLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptPdfDocumentI3D] [int] NOT NULL,
	[Kind] [int] NOT NULL,
	[Message] [nvarchar](512) NOT NULL,
	[CreatedAt] [datetime2](7) NOT NULL,
	[CreatedByEmployeeI3D] [int] NOT NULL,
 CONSTRAINT [PK_ReceiptPdfDocumentLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptPdfDocuments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptPdfDocuments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Guid] [char](32) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[PdfDocument] [varbinary](max) NULL,
	[EmployeeI3D] [int] NULL,
	[MailAddress] [nvarchar](255) NULL,
	[FirstName] [nvarchar](60) NULL,
	[LastName] [nvarchar](60) NULL,
	[AllowChangeQuantity] [bit] NOT NULL,
	[AllowSelectArticles] [bit] NOT NULL,
	[AllowAcceptReceipt] [bit] NOT NULL,
	[WebReceiptState] [int] NOT NULL,
	[ShareDocument] [bit] NOT NULL,
	[DateOfFirstViewing] [datetime2](7) NULL,
	[AllowAcceptReceiptWithoutSignature] [bit] NULL,
	[TicketCreationMode] [int] NULL,
	[ExpireDate] [datetime2](0) NULL,
 CONSTRAINT [PK_ReceiptPdfDocuments] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [CI_ReceiptPdfDocuments] UNIQUE CLUSTERED 
(
	[Guid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptPositionPricing]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptPositionPricing](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[PositionI3D] [int] NOT NULL,
	[Price] [decimal](18, 7) NULL,
	[DurationKind] [int] NOT NULL,
	[DurationValue] [int] NOT NULL,
	[StartDate] [datetime2](0) NULL,
	[EndDate] [datetime2](0) NULL,
 CONSTRAINT [PK_ReceiptPositionPricing] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CI_ReceiptPositionPricing]    Script Date: 11.11.2025 11:20:28 ******/
CREATE CLUSTERED INDEX [CI_ReceiptPositionPricing] ON [dbo].[ReceiptPositionPricing]
(
	[ObjectI3D] ASC,
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptProjectLayouts]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptProjectLayouts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptI3D] [int] NOT NULL,
	[LayoutOrder] [int] NOT NULL,
	[Title] [nvarchar](255) NOT NULL,
	[LayoutKind] [int] NOT NULL,
	[FileData] [image] NULL,
	[PreviewImage] [image] NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[ReceiptKind] [int] NOT NULL,
	[IsSelectedForPdfGeneration] [bit] NOT NULL,
 CONSTRAINT [PK_ReceiptProjectLayouts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptProvisionEmployeeGoals]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptProvisionEmployeeGoals](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Year] [int] NOT NULL,
	[Month] [int] NOT NULL,
	[Goal] [decimal](18, 7) NOT NULL,
 CONSTRAINT [PK_ReceiptProvisionEmployeeGoals] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptProvisionEmployeeLevels]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptProvisionEmployeeLevels](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[FromPrice] [decimal](18, 7) NULL,
	[ProvisionPercentage] [decimal](18, 7) NOT NULL,
	[OverwriteLowerLevels] [bit] NOT NULL,
	[Bonus] [decimal](18, 7) NULL,
 CONSTRAINT [PK_ReceiptProvisionEmployeeLevels] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptProvisionItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptProvisionItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptI3D] [int] NOT NULL,
	[ReceiptKind] [int] NOT NULL,
	[Receiver] [varchar](50) NOT NULL,
	[EmployeeI3D] [int] NULL,
	[ProvisionPercentage] [decimal](18, 7) NULL,
	[Source] [varchar](50) NOT NULL,
	[ActualEmployeeI3D] [int] NOT NULL,
	[ActualProvision] [decimal](18, 7) NOT NULL,
	[SharePercentage] [decimal](18, 7) NOT NULL,
	[Description] [nvarchar](500) NULL,
	[Value] [varchar](50) NOT NULL,
	[SourceMaterialGroups] [varchar](max) NULL,
	[ActualPrice] [decimal](18, 7) NOT NULL,
	[FilterEmployeeI3D] [int] NULL,
	[ActualPriceSales] [decimal](18, 7) NULL,
	[ActualPriceEarnings] [decimal](18, 7) NULL,
	[ActualProvisionSales] [decimal](18, 7) NULL,
	[ActualProvisionEarnings] [decimal](18, 7) NULL,
	[GroupID] [nvarchar](50) NULL,
	[ActualProvisionPercentage] [decimal](18, 7) NOT NULL,
 CONSTRAINT [PK_ReceiptProvisionItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptProvisionSchemaCustomerAssignments]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptProvisionSchemaCustomerAssignments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[BranchI3D] [int] NOT NULL,
	[ReceiptProvisionSchemaI3D] [int] NOT NULL,
 CONSTRAINT [PK_ReceiptProvisionSchemaCustomerAssignments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptProvisionSchemaItems]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptProvisionSchemaItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptProvisionSchemaI3D] [int] NOT NULL,
	[Receiver] [varchar](50) NOT NULL,
	[EmployeeI3D] [int] NULL,
	[ProvisionPercentage] [decimal](18, 7) NULL,
	[Source] [varchar](50) NOT NULL,
	[SharePercentage] [decimal](18, 7) NOT NULL,
	[Description] [nvarchar](500) NULL,
	[Value] [varchar](50) NOT NULL,
	[SourceMaterialGroups] [varchar](max) NULL,
	[FilterEmployeeI3D] [int] NULL,
 CONSTRAINT [PK_ReceiptProvisionSchemaItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptProvisionSchemas]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptProvisionSchemas](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[ExpiresAt] [datetime2](7) NULL,
	[NextSchemaI3D] [int] NULL,
 CONSTRAINT [PK_ReceiptProvisionSchemas] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptReceivers]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptReceivers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CompanyName] [nvarchar](240) NOT NULL,
	[AdditionalAddressSupplement] [nvarchar](240) NOT NULL,
	[Department] [nvarchar](255) NOT NULL,
	[ContactName] [nvarchar](60) NOT NULL,
	[ContactDepartment] [nvarchar](255) NOT NULL,
	[Street] [nvarchar](300) NOT NULL,
	[HouseNumber] [nvarchar](300) NULL,
	[POBox] [nvarchar](50) NOT NULL,
	[IsPOBoxActive] [int] NOT NULL,
	[Zip] [nvarchar](10) NOT NULL,
	[City] [nvarchar](168) NOT NULL,
	[Country] [nvarchar](255) NOT NULL,
	[CountryI3D] [int] NULL,
 CONSTRAINT [PK_ReceiptReceivers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptTemplateFolders]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptTemplateFolders](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) NULL,
	[ParentFolderI3D] [int] NULL,
	[IconAsPng] [varbinary](max) NULL,
 CONSTRAINT [PK_ReceiptTemplateFolders] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReceiptTemplates]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReceiptTemplates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptKind] [int] NOT NULL,
	[ReceiptI3D] [int] NOT NULL,
	[FolderI3D] [int] NULL,
	[PreviewPdf] [varbinary](max) NULL,
	[Name] [nvarchar](50) NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_ReceiptTemplates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RechKopfErweitert]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RechKopfErweitert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RechkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RechKopfErweitertVersions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RechKopfErweitertVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RechkopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[OriginalI3D] [int] NULL,
	[Version] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RechProv]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RechProv](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RechKopfI3D] [int] NOT NULL,
	[RechNummer] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[Provision] [float] NULL,
	[Standard] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReGsKuADienst3Jahre]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReGsKuADienst3Jahre](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RKundenID1] [int] NULL,
	[RDatum1] [varchar](4) NULL,
	[RAussendienstID1] [int] NULL,
	[RSumSummeKalk1] [float] NULL,
	[RSumErtrag1] [float] NULL,
	[RStunden1] [float] NULL,
	[RKundenID2] [int] NULL,
	[RDatum2] [varchar](4) NULL,
	[RAussendienstID2] [int] NULL,
	[RSumSummeKalk2] [float] NULL,
	[RSumErtrag2] [float] NULL,
	[RStunden2] [float] NULL,
	[RKundenID3] [int] NULL,
	[RDatum3] [varchar](4) NULL,
	[RAussendienstID3] [int] NULL,
	[RSumSummeKalk3] [float] NULL,
	[RSumErtrag3] [float] NULL,
	[RStunden3] [float] NULL,
	[GKundenID1] [int] NULL,
	[GDatum1] [varchar](4) NULL,
	[GAussendienstID1] [int] NULL,
	[GSumSummeKalk1] [float] NULL,
	[GSumErtrag1] [float] NULL,
	[GStunden1] [float] NULL,
	[GKundenID2] [int] NULL,
	[GDatum2] [varchar](4) NULL,
	[GAussendienstID2] [int] NULL,
	[GSumSummeKalk2] [float] NULL,
	[GSumErtrag2] [float] NULL,
	[GStunden2] [float] NULL,
	[GKundenID3] [int] NULL,
	[GDatum3] [varchar](4) NULL,
	[GAussendienstID3] [int] NULL,
	[GSumSummeKalk3] [float] NULL,
	[GSumErtrag3] [float] NULL,
	[GStunden3] [float] NULL,
	[ArtRe] [varchar](2) NULL,
	[ArtGs] [varchar](2) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReisekostenAbrechnungen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReisekostenAbrechnungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErfasstDatum] [datetime] NULL,
	[PersonalI3D] [int] NULL,
	[AbrechnungsArt] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReisekostenBelege]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReisekostenBelege](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[Laufnummer] [int] NULL,
	[Abgerechnet] [int] NULL,
	[AbgerechnetDatum] [datetime] NULL,
	[ReisekostenAbrechnungenI3D] [int] NULL,
	[Kostenart] [int] NULL,
	[Bezeichnung] [varchar](255) NULL,
	[Betrag] [float] NULL,
	[BetragAusgelegt] [float] NULL,
	[MwstSatz] [float] NULL,
	[MwstAusgewiesen] [int] NULL,
	[Status] [int] NULL,
	[ReiskostenAbrechnungenI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReisekostenBelegeHotel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReisekostenBelegeHotel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReisekostenBelegeI3D] [int] NULL,
	[UebernachtungenAnz] [int] NULL,
	[MitFruehstueck] [int] NULL,
	[FruehstueckAusgewiesen] [int] NULL,
	[FruehstueckBetrag] [float] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReisekostenBelegePKW]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReisekostenBelegePKW](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReisekostenBelegeI3D] [int] NULL,
	[Kennzeichen] [varchar](255) NULL,
	[Kilometer] [float] NULL,
	[Tankbeleg] [int] NULL,
	[Start] [varchar](255) NULL,
	[Ziel] [varchar](255) NULL,
	[BelegDatum] [datetime] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReisekostenFahrten]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReisekostenFahrten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReisekostenAbrechnungenI3D] [int] NULL,
	[Monat] [varchar](255) NULL,
	[Kennzeichen] [varchar](255) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReisekostenReisen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReisekostenReisen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReisekostenAbrechnungenI3D] [int] NULL,
	[Ziel] [varchar](255) NULL,
	[Projekt] [varchar](255) NULL,
	[Servicebericht] [varchar](255) NULL,
	[AbfahrtDatum] [datetime] NULL,
	[AnkunftDatum] [datetime] NULL,
	[Mehraufwand] [float] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteAdditionalInformations]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteAdditionalInformations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RemoteConnectionI3D] [int] NOT NULL,
	[InfoKey] [nvarchar](255) NOT NULL,
	[InfoValue] [nvarchar](255) NULL,
	[FolderI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteCredentials]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteCredentials](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RemoteConnectionI3D] [int] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Username] [nvarchar](255) NULL,
	[Password] [nvarchar](255) NULL,
	[IsPasswordStore] [bit] NULL,
	[DomainName] [nvarchar](255) NULL,
	[IsPressEnter] [bit] NULL,
	[AuthenticationMode] [nvarchar](255) NULL,
	[UsernameHtmlID] [nvarchar](255) NULL,
	[PasswordHtmlID] [nvarchar](255) NULL,
	[RemoteTypeI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteExternalApps]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteExternalApps](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RemoteConnectionI3D] [int] NOT NULL,
	[InfoName] [nvarchar](255) NOT NULL,
	[ActionName] [nvarchar](253) NULL,
	[FolderI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteExternalMetadatas]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteExternalMetadatas](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RemoteConnectionI3D] [int] NOT NULL,
	[ApplicationPath] [nvarchar](255) NULL,
	[WorkingDirectory] [nvarchar](255) NULL,
	[Arguments] [nvarchar](255) NULL,
	[TryToIntegrate] [bit] NOT NULL,
	[MinimumWaitTime] [int] NULL,
	[MaximumWaitTime] [int] NULL,
	[Name] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteFolderCredentials]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteFolderCredentials](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FolderI3D] [int] NOT NULL,
	[CredentialI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteFolders]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteFolders](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FolderName] [nvarchar](255) NOT NULL,
	[ParentFolderI3D] [int] NULL,
	[Desciption] [nvarchar](255) NULL,
	[CustomerI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteFolderSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteFolderSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FolderI3D] [int] NOT NULL,
	[SettingI3D] [int] NOT NULL,
	[RemoteTypeI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemotePuttyMetadatas]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemotePuttyMetadatas](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RemoteConnectionI3D] [int] NOT NULL,
	[ConnectionType] [int] NOT NULL,
	[Port] [int] NOT NULL,
	[SSHVersion] [int] NULL,
	[IsSSHCompression] [bit] NOT NULL,
	[ProfileName] [nvarchar](255) NULL,
	[UseOwnCommandline] [bit] NOT NULL,
	[OwnCommandline] [nvarchar](255) NULL,
	[Name] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteRDPLocalDrives]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteRDPLocalDrives](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RDPMetadataI3D] [int] NOT NULL,
	[DriveName] [nvarchar](50) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteRDPMetadatas]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteRDPMetadatas](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RemoteConnectionI3D] [int] NOT NULL,
	[DisplayTypeI3D] [int] NOT NULL,
	[DisplayColorI3D] [int] NOT NULL,
	[DisplayResolutionI3D] [int] NULL,
	[UseShowContentOfWindowDragging] [bit] NOT NULL,
	[UseBitmapCaching] [bit] NOT NULL,
	[UseDesktopBackground] [bit] NOT NULL,
	[UseThemes] [bit] NOT NULL,
	[UseAdjustResolution] [bit] NOT NULL,
	[UseMenuAndWindowAnimation] [bit] NOT NULL,
	[UseFontSmoothing] [bit] NOT NULL,
	[UseDetectConnectionQuality] [bit] NOT NULL,
	[OptionSoundI3D] [int] NOT NULL,
	[OptionShortcutI3D] [int] NOT NULL,
	[UseConsole] [bit] NOT NULL,
	[UseClipboard] [bit] NOT NULL,
	[UseSmardcards] [bit] NOT NULL,
	[UsePrinter] [bit] NOT NULL,
	[UseDoNotUseNLA] [bit] NOT NULL,
	[Port] [int] NULL,
	[UseAllLocalDrives] [bit] NOT NULL,
	[TSGatewayI3D] [int] NOT NULL,
	[ServerName] [nvarchar](255) NULL,
	[UseBypassForLocalAddress] [bit] NOT NULL,
	[UseOwnCredentials] [bit] NOT NULL,
	[Username] [nvarchar](255) NULL,
	[Password] [nvarchar](255) NULL,
	[DomainName] [nvarchar](255) NULL,
	[UseStartProgramConnection] [bit] NOT NULL,
	[ProgramPathFileName] [ntext] NULL,
	[StartFolder] [ntext] NULL,
	[Name] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteVNCMetadatas]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteVNCMetadatas](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RemoteConnectionI3D] [int] NOT NULL,
	[Port] [int] NOT NULL,
	[Display] [int] NOT NULL,
	[UseAdjustResolution] [bit] NOT NULL,
	[UseViewOnly] [bit] NOT NULL,
	[Name] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemoteWebMetadatas]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemoteWebMetadatas](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RemoteConnectionI3D] [int] NOT NULL,
	[DisplayI3D] [int] NOT NULL,
	[PopupHandlingI3D] [int] NOT NULL,
	[UseWebKit] [bit] NOT NULL,
	[Name] [nvarchar](256) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaArbeitssicherheit]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaArbeitssicherheit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [int] NULL,
	[ArbeitssicherheitI3D] [int] NULL,
	[ArbeitsplatzReparaturI3D] [int] NULL,
 CONSTRAINT [PK_RepaArbeitssicherheit] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaArbeitssicherheitHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaArbeitssicherheitHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [int] NULL,
	[ArbeitssicherheitI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaArtikel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Menge] [float] NULL,
	[Einheit] [varchar](50) NULL,
	[Preis] [float] NULL,
	[EK] [float] NULL,
	[TatsMenge] [float] NULL,
	[Summe] [float] NULL,
	[TatsSumme] [float] NULL,
	[ArbeitsplatzReparaturI3D] [int] NULL,
	[Artikelbeschreibung] [varchar](300) NULL,
	[ArtikelCode] [varchar](50) NULL,
 CONSTRAINT [PK_RepaArtikel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaArtikelHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaArtikelHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Menge] [float] NULL,
	[Einheit] [varchar](50) NULL,
	[Preis] [float] NULL,
	[EK] [float] NULL,
	[TatsMenge] [float] NULL,
	[Summe] [float] NULL,
	[TatsSumme] [float] NULL,
	[ArbeitsplatzReparaturI3D] [int] NULL,
	[Artikelbeschreibung] [varchar](300) NULL,
	[ArtikelCode] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplatzI3D] [int] NULL,
	[FahrzeugI3D] [int] NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Beschreibung] [text] NULL,
	[FaelligAm] [datetime] NULL,
	[FaelligVon] [int] NULL,
	[ErledigtAm] [datetime] NULL,
	[ErledigtVon] [int] NULL,
	[Status] [int] NULL,
	[Summe] [float] NULL,
	[TatsSumme] [float] NULL,
	[AngelegtAm] [datetime] NULL,
	[AngelegtVon] [int] NULL,
	[ScanDocI3D] [int] NULL,
	[AbgeschlossenAm] [datetime] NULL,
	[Abgeschlossenvon] [int] NULL,
 CONSTRAINT [PK_RepaKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaKopfHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaKopfHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplatzI3D] [int] NULL,
	[FahrzeugI3D] [int] NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Beschreibung] [text] NULL,
	[FaelligAm] [datetime] NULL,
	[FaelligVon] [int] NULL,
	[ErledigtAm] [datetime] NULL,
	[ErledigtVon] [int] NULL,
	[Status] [int] NULL,
	[Summe] [float] NULL,
	[TatsSumme] [float] NULL,
	[AngelegtAm] [datetime] NULL,
	[AngelegtVon] [int] NULL,
	[ScanDocI3D] [int] NULL,
	[AbgeschlossenVon] [int] NULL,
	[AbgeschlossenAm] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaLohngruppe]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaLohngruppe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplatzReparaturI3D] [int] NULL,
	[LohngruppeI3D] [int] NULL,
	[Stundenlohn] [float] NULL,
	[Zeit] [float] NULL,
	[TatsZeit] [float] NULL,
	[Summe] [float] NULL,
	[TatsSumme] [float] NULL,
 CONSTRAINT [PK_RepaLohngruppe] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaPruefling]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaPruefling](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [int] NULL,
	[PrueflingI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaPrueflingHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaPrueflingHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [int] NULL,
	[PrueflingI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaPruefmittel]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaPruefmittel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [char](10) NULL,
	[PruefmittelI3D] [char](10) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaPruefmittelHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaPruefmittelHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [char](10) NULL,
	[PruefmittelI3D] [char](10) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaUmweltschutz]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaUmweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [int] NULL,
	[UmweltschutzI3D] [int] NULL,
	[ArbeitsplatzReparaturI3D] [int] NULL,
 CONSTRAINT [PK_RepaUmweltschutz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepaUmweltschutzHistory]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepaUmweltschutzHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReparaturI3D] [int] NULL,
	[UmweltschutzI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepEingangKopf]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepEingangKopf](
	[I3D] [int] NOT NULL,
	[Nummer] [int] NULL,
	[KreditorI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Empfanger] [varchar](300) NULL,
	[Tel] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[EMail] [varchar](50) NULL,
	[Fracht] [float] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
 CONSTRAINT [PK_RepEingangKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RepEingangPos]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RepEingangPos](
	[I3D] [int] NOT NULL,
	[KreditorI3D] [int] NULL,
	[RepEingangKopfI3D] [int] NULL,
	[KreditorRMAKopfI3D] [int] NULL,
	[KreditorRMANummer] [int] NULL,
	[KundenRMAKopfI3D] [int] NULL,
	[KundenRMANummer] [int] NULL,
	[RMANummer] [varchar](30) NULL,
	[RueckPosI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](15) NULL,
	[Artikeltext] [varchar](100) NULL,
	[SeriennummerI3D] [int] NULL,
	[Seriennummer] [varchar](100) NULL,
	[Vorgang] [int] NULL,
	[Fehlerbeschreibung] [varchar](255) NULL,
	[Zubehoer] [varchar](255) NULL,
	[Priority] [int] NULL,
	[Kosten] [float] NULL,
	[Fracht] [float] NULL,
	[ErsatzArtikelI3D] [int] NULL,
	[ErsatzArtikelCode] [varchar](15) NULL,
	[ErsatzArtikelText] [varchar](300) NULL,
	[ErsatzArtikelSNI3D] [int] NULL,
	[ErsatzArtikelSN] [varchar](200) NULL,
	[Eigenware] [int] NULL,
	[RechNrKreditor] [varchar](100) NULL,
	[RechDatKreditor] [datetime] NULL,
 CONSTRAINT [PK_RepEingangPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Report_ReportQueries]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Report_ReportQueries](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportI3D] [int] NOT NULL,
	[Name] [nvarchar](256) NOT NULL,
	[CommentOf] [ntext] NULL,
	[ContentOf] [ntext] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Report_Reports]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Report_Reports](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportType] [int] NOT NULL,
	[Name] [nvarchar](256) NOT NULL,
	[CommentOf] [ntext] NULL,
	[Creator] [int] NOT NULL,
	[Created] [datetime] NOT NULL,
	[LastEdit] [datetime] NULL,
	[IsPublic] [bit] NOT NULL,
	[ReportData] [image] NULL,
	[PortalReportI3D] [int] NULL,
	[PortalReportVersion] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportAbfragen]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportAbfragen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RepI3D] [int] NULL,
	[Statement] [text] NULL,
	[Name] [varchar](30) NULL,
	[MasterI3D] [int] NULL,
 CONSTRAINT [PK_ReportAbfragen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportData]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](256) NOT NULL,
	[DuplicateI3D] [int] NULL,
	[MandantI3D] [int] NULL,
	[Description] [varchar](1000) NULL,
	[State] [int] NULL,
	[Report] [image] NOT NULL,
	[PortalReportI3D] [int] NULL,
	[PortalReportVersion] [int] NULL,
 CONSTRAINT [PK_ReportData] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportDataBinSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportDataBinSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportDataSettingsI3D] [int] NOT NULL,
	[SizeRawKind] [int] NOT NULL,
	[Landscape] [int] NOT NULL,
	[BinRawKind] [int] NOT NULL,
	[Type] [int] NOT NULL,
	[Range] [int] NOT NULL,
 CONSTRAINT [PK_ReportDataSetttingsBin] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportDataDefault]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportDataDefault](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportGroupI3D] [int] NOT NULL,
	[ReportDataI3D] [int] NOT NULL,
	[DefaultEnum] [int] NOT NULL,
 CONSTRAINT [PK_ReportDataDefault] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportDataParameters]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportDataParameters](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportGroupToReportDataI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[Expression] [varchar](50) NOT NULL,
	[Typ] [varchar](50) NOT NULL,
	[Description] [varchar](100) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportDataQueries]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportDataQueries](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportDataI3D] [int] NOT NULL,
	[Name] [varchar](64) NOT NULL,
	[Statement] [text] NOT NULL,
	[MasterI3D] [int] NULL,
 CONSTRAINT [PK_ReportDataQueries] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportDataQueriesToReportDataQueryTags]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportDataQueriesToReportDataQueryTags](
	[ReportDataQueryTagI3D] [int] NOT NULL,
	[ReportDataQueryI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportDataQueryTags]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportDataQueryTags](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[Description] [varchar](2000) NULL,
 CONSTRAINT [PK_ReportDataQueryTags] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportDataSettings]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportDataSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportDataI3D] [int] NULL,
	[UserI3D] [int] NULL,
	[PrinterName] [varchar](100) NULL,
	[MachineName] [varchar](24) NULL,
	[PrintColor] [int] NOT NULL,
	[PrintCollated] [int] NOT NULL,
	[DuplexMode] [int] NOT NULL,
	[NumCopies] [int] NOT NULL,
	[ShowDialog] [int] NOT NULL,
	[IsFax] [int] NOT NULL,
	[DuplicateI3D] [int] NULL,
	[UsePrinterSettings] [int] NULL,
	[ReportToGroupI3D] [int] NULL,
	[Description] [nvarchar](100) NULL,
	[Scale] [int] NULL,
	[PageSizeKind] [int] NULL,
 CONSTRAINT [PK_ReportDataSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportGroupParameters]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportGroupParameters](
	[I3D] [int] NOT NULL,
	[ReportGroupI3D] [int] NOT NULL,
	[Name] [varchar](64) NOT NULL,
	[ShortName] [varchar](24) NOT NULL,
	[Value] [varchar](64) NOT NULL,
 CONSTRAINT [PK_ReportGroupStructureParameter] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportGroups]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportGroups](
	[I3D] [int] NOT NULL,
	[Name] [varchar](256) NOT NULL,
	[ReportGroupGuid] [uniqueidentifier] NOT NULL,
	[ParentGroupI3D] [int] NULL,
	[PDFExportActive] [int] NOT NULL,
	[PDFExportPath] [varchar](1024) NULL,
	[CustomPdfFilename] [varchar](1024) NULL,
	[Status] [int] NOT NULL,
	[ShowInTaskManagement] [bit] NULL,
 CONSTRAINT [PK_ReportFolderStructure] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY],
 CONSTRAINT [IX_ReportFolderStructure] UNIQUE NONCLUSTERED 
(
	[ReportGroupGuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportGroupsToReportData]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportGroupsToReportData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportDataI3D] [int] NOT NULL,
	[ReportGroupI3D] [int] NOT NULL,
	[State] [int] NULL,
 CONSTRAINT [PK_ReportGroupsToReportData] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportLog]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BearbeiterI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[Art] [int] NULL,
	[ReportName] [varchar](100) NULL,
	[AnlagePrefix] [varchar](8) NULL,
	[AnlageNummer] [int] NULL,
	[AnlageVersion] [int] NULL,
	[Drucker] [varchar](100) NULL,
	[Kopien] [int] NULL,
	[Faxnummer] [varchar](100) NULL,
	[eMail] [varchar](250) NULL,
	[Nummer] [int] NULL,
	[Version] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Medium] [int] NULL,
	[RepName] [varchar](75) NULL,
 CONSTRAINT [PK_ReportLog] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportObjekte]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportObjekte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](20) NULL,
	[Art] [int] NULL,
	[RepI3D] [int] NULL,
 CONSTRAINT [PK_ReportObjekte] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportPrintOptions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportPrintOptions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportI3D] [int] NOT NULL,
	[CopyCount] [int] NOT NULL,
	[PrintOrder] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[ParentI3D] [int] NULL,
	[ParentObjectKind] [int] NULL,
	[IsPrint] [bit] NOT NULL,
	[IsFax] [bit] NOT NULL,
	[IsMail] [bit] NOT NULL,
 CONSTRAINT [PK_ReportPrintOptions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Reports]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Reports](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Report] [image] NULL,
	[FileName] [varchar](255) NULL,
	[Gruppe] [varchar](3) NULL,
	[Isdefault] [int] NULL,
	[Schacht] [int] NULL,
	[Status] [int] NULL,
	[PDFExport] [int] NULL,
	[PDFVerzeichnis] [varchar](255) NULL,
	[TextDateiName] [varchar](255) NULL,
	[ELOPfad] [varchar](255) NULL,
	[TXTVerzeichnis] [varchar](255) NULL,
	[Beschreibung] [varchar](1000) NULL,
	[Version] [varchar](20) NULL,
	[DuplikatI3D] [int] NULL,
	[Schacht2] [int] NULL,
	[Papier] [int] NULL,
	[Papier2] [int] NULL,
	[Orientierung] [int] NULL,
	[Orientierung2] [int] NULL,
	[MandantI3D] [int] NULL,
	[FRMainVersion] [int] NULL,
	[Duplex] [int] NULL,
	[PDFDateiname] [varchar](255) NULL,
	[Herkunft] [varchar](100) NULL,
 CONSTRAINT [PK_Reports] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportServiceCustomerConfigurations]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportServiceCustomerConfigurations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](512) NOT NULL,
	[ParentI3D] [int] NOT NULL,
	[Subject] [nvarchar](512) NULL,
	[Sender] [nvarchar](512) NULL,
	[CC] [nvarchar](1024) NULL,
	[ReportSendTime] [time](7) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[Interval] [int] NOT NULL,
	[MailBody] [nvarchar](max) NOT NULL,
	[ParentType] [int] NOT NULL,
	[SendToDefaultContactPerson] [bit] NOT NULL,
	[SendToInnendienst] [bit] NOT NULL,
	[SendToAussendienst] [bit] NOT NULL,
	[SendToTechniker1] [bit] NOT NULL,
	[SendToTechniker2] [bit] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportServiceMailingInfo]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportServiceMailingInfo](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EMail] [nvarchar](512) NOT NULL,
	[Salutation] [int] NOT NULL,
	[Firstname] [nvarchar](512) NULL,
	[Lastname] [nvarchar](512) NULL,
	[CustomerConfigurationI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportServiceReportToConfigurationAssignment]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportServiceReportToConfigurationAssignment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerConfigurationI3D] [int] NOT NULL,
	[ReportI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportsVersions]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportsVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[PersonalI3D] [int] NULL,
	[ReportVersion] [int] NULL,
	[CentronVersion] [varchar](50) NULL,
	[Datum] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportToGroupAssignment]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportToGroupAssignment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportI3D] [int] NOT NULL,
	[ReportGroup] [nvarchar](3) NOT NULL,
	[IsDefault] [int] NULL,
	[PDFExport] [int] NULL,
	[PDFFilename] [nvarchar](255) NULL,
	[TXTDirectory] [nvarchar](255) NULL,
	[TXTFilename] [nvarchar](255) NULL,
	[PDFDirectory] [nvarchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportUsers]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportUsers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FirstName] [varchar](60) NOT NULL,
	[LastName] [varchar](60) NOT NULL,
	[Status] [int] NOT NULL,
	[UserName] [varchar](50) NOT NULL,
	[State] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ReportUsersToReportDataQueries]    Script Date: 11.11.2025 11:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ReportUsersToReportDataQueries](
	[ReportUserI3D] [int] NOT NULL,
	[ReportDataQueryI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RequestedBackupInstallation]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RequestedBackupInstallation](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[InstallToken] [nvarchar](250) NOT NULL,
	[ValidUntil] [datetime2](7) NOT NULL,
	[ServerAddress] [nvarchar](200) NULL,
 CONSTRAINT [PK_RequestedBackupInstallation] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RiverbirdMobilePhonePushNotificationTokens]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RiverbirdMobilePhonePushNotificationTokens](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DeviceName] [nvarchar](512) NOT NULL,
	[ExpoPushToken] [nvarchar](512) NULL,
	[DeviceOs] [nvarchar](512) NOT NULL,
	[UserI3D] [int] NOT NULL,
	[UseFor2FA] [bit] NOT NULL,
 CONSTRAINT [PK_RiverbirdMobilePhonePushNotificationTokens] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RiverSuiteRelevantRights]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RiverSuiteRelevantRights](
	[SichrechI3D] [int] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMAAnfKopf]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMAAnfKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Empfaenger] [varchar](500) NULL,
	[VersandDatum] [datetime] NULL,
	[RetourDatum] [datetime] NULL,
	[Versandart] [int] NULL,
	[Paketnummer] [varchar](50) NULL,
	[Status] [int] NULL,
	[Storno] [int] NULL,
	[LockedByI3D] [int] NULL,
	[Info] [varchar](1000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMAAnfPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMAAnfPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenRMANummer] [varchar](50) NULL,
	[ArtikelI3D] [int] NULL,
	[RMAAnfKopfI3D] [int] NULL,
	[Fehlerbeschreibung] [text] NULL,
	[Zubehoer] [text] NULL,
	[KredFehlerbeschreibung] [text] NULL,
	[KredZubehoer] [text] NULL,
	[KreditorRMANummer] [varchar](50) NULL,
	[Menge] [int] NULL,
	[Kosten] [float] NULL,
	[KundeI3D] [int] NULL,
	[ReNrKred] [varchar](50) NULL,
	[ReDatKred] [datetime] NULL,
	[ReKredName] [varchar](50) NULL,
	[RMAPosI3D] [int] NULL,
	[EingangArt] [int] NULL,
	[ErstellDatum] [datetime] NULL,
	[ErstellPersonalI3D] [int] NULL,
	[KostenGemein] [float] NULL,
	[KostenGesamt] [float] NULL,
	[LagerI3D] [int] NULL,
	[Buchung] [int] NULL,
	[BezugI3D] [int] NULL,
	[NumBarcodes] [int] NULL,
	[BarcodeScanen] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RmaArticle]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RmaArticle](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RmaI3D] [int] NOT NULL,
	[SerialNumberI3D] [int] NULL,
	[ArticleI3D] [int] NULL,
	[ReferenceObjectKind] [int] NULL,
	[ReferenceObjectI3D] [int] NULL,
	[NewSerialNumberI3D] [int] NULL,
	[Warranty] [bit] NOT NULL,
	[ErrorDescription] [nvarchar](max) NULL,
	[RmaState] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CreatedVersion] [varchar](25) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](2) NOT NULL,
	[ChangedVersion] [varchar](25) NOT NULL,
	[SupplierNumber] [int] NULL,
	[SupplierName] [varchar](255) NULL,
	[SupplierRmaNumber] [varchar](50) NULL,
	[Quantity] [int] NULL,
	[ReceiptNumber] [int] NULL,
	[ReceiptItemI3D] [int] NULL,
	[ReceiptKind] [int] NULL,
	[WarehousesI3D] [int] NULL,
	[WarehousesName] [nvarchar](50) NULL,
	[SupplierReceiptNumber] [nvarchar](50) NULL,
	[SupplierReceiptDate] [datetime2](2) NULL,
	[ForthWarehouseI3D] [int] NULL,
	[ForthAction] [int] NULL,
	[ReceiptDate] [datetime2](0) NULL,
	[SwapArticleI3D] [int] NULL,
	[BookedWarehouseI3D] [int] NULL,
	[Description] [nvarchar](255) NULL,
 CONSTRAINT [PK_RmaArticle] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [CI_RmaArticle_I3D_RmaI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_RmaArticle_I3D_RmaI3D] ON [dbo].[RmaArticle]
(
	[RmaI3D] ASC,
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RmaArticleHistory]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RmaArticleHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RmaArticleI3D] [int] NOT NULL,
	[RmaArticleState] [int] NOT NULL,
	[Changed] [datetime2](0) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Text] [nvarchar](max) NULL,
	[ParentItemI3D] [int] NULL,
	[ParentNumber] [int] NULL,
	[ForthAction] [int] NULL,
	[State] [int] NULL,
 CONSTRAINT [PK_RmaArticleHistory] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [CI_RmaArticleHistory_I3D_RmaI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE CLUSTERED INDEX [CI_RmaArticleHistory_I3D_RmaI3D] ON [dbo].[RmaArticleHistory]
(
	[RmaArticleI3D] ASC,
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMAKopf]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMAKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Nummer] [int] NULL,
	[KundeI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[AnsprechpartnerI3D] [int] NULL,
	[Status] [int] NULL,
	[Beschreibung] [text] NULL,
	[Besitz] [int] NULL,
	[Prioritaet] [int] NULL,
	[ObjektArt] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[KreditorI3D] [int] NULL,
	[KredAnschriftI3D] [int] NULL,
	[KredAnsprechI3D] [int] NULL,
	[InfoAnzeigen] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMAPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMAPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Sortierung] [int] NULL,
	[ParentI3D] [int] NULL,
	[ParentObjektArt] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Artikelcode] [varchar](60) NULL,
	[SeriennummerI3D] [int] NULL,
	[Seriennummer] [varchar](50) NULL,
	[RechKopfI3D] [int] NULL,
	[Rechnungsnummer] [int] NULL,
	[Beschreibung] [text] NULL,
	[Fehlerbeschreibung] [text] NULL,
	[Zubehoer] [varchar](500) NULL,
	[Garantie] [int] NULL,
	[EreignisArt] [int] NULL,
	[ObjektArt] [int] NULL,
	[RMAKopfI3D] [int] NULL,
	[AssetI3D] [int] NULL,
	[Besitz] [int] NULL,
	[Status] [int] NULL,
	[KreditorI3D] [int] NULL,
	[KredAnschriftI3D] [int] NULL,
	[KredAnsprechI3D] [int] NULL,
	[Menge] [int] NULL,
	[ArtikelBeschreibung] [varchar](5000) NULL,
	[RechPosI3D] [int] NULL,
	[AnlageOA] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMAPosSN]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMAPosSN](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RMAPosI3D] [int] NULL,
	[SNI3D] [int] NULL,
	[RMAKopfI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMAPosStatus]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMAPosStatus](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RMAPosI3D] [int] NULL,
	[Status] [int] NULL,
	[Datum] [datetime] NULL,
	[BenutzerI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMARepKopf]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMARepKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[Erstelltdatum] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Empfaenger] [varchar](500) NULL,
	[VersandDatum] [datetime] NULL,
	[RetourDatum] [datetime] NULL,
	[Versandart] [int] NULL,
	[Paketnummer] [varchar](50) NULL,
	[Status] [int] NULL,
	[Storno] [int] NULL,
	[LockedByI3D] [int] NULL,
	[ErstellterI3D] [int] NULL,
	[GeändertDatum] [datetime] NULL,
	[LSNummer] [varchar](50) NULL,
	[LSDatum] [datetime] NULL,
	[Info] [varchar](1000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMARepPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMARepPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenRMANummer] [varchar](50) NULL,
	[ArtikelI3D] [int] NULL,
	[RMARepKopfI3D] [int] NULL,
	[Fehlerbeschreibung] [text] NULL,
	[Zubehoer] [text] NULL,
	[KredFehlerbeschreibung] [text] NULL,
	[KredZubehoer] [text] NULL,
	[KreditorRMANummer] [varchar](50) NULL,
	[Menge] [int] NULL,
	[Kosten] [float] NULL,
	[KundeI3D] [int] NULL,
	[ReNrKred] [varchar](50) NULL,
	[ReDatKred] [datetime] NULL,
	[ReKredName] [varchar](50) NULL,
	[RMAPosI3D] [int] NULL,
	[EingangArt] [int] NULL,
	[ErstellDatum] [datetime] NULL,
	[ErstellPersonalI3D] [int] NULL,
	[KostenGemein] [float] NULL,
	[KostenGesamt] [float] NULL,
	[LagerI3D] [int] NULL,
	[Buchung] [int] NULL,
	[BezugI3D] [int] NULL,
	[NumBarcodes] [int] NULL,
	[BarcodeScanen] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMARueckKopf]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMARueckKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[CentronVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[KreditorI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonI3D] [int] NULL,
	[Tel] [varchar](30) NULL,
	[Fax] [varchar](30) NULL,
	[Mail] [varchar](255) NULL,
	[Empfaenger] [varchar](500) NULL,
	[VersandDatum] [datetime] NULL,
	[RetourDatum] [datetime] NULL,
	[VersandArt] [int] NULL,
	[Paketnummer] [varchar](50) NULL,
	[Status] [int] NULL,
	[Storno] [int] NULL,
	[LockedByI3D] [int] NULL,
	[Info] [varchar](1000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMARueckPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMARueckPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenRMANummer] [varchar](50) NULL,
	[ArtikelI3D] [int] NULL,
	[RMARueckKopfI3D] [int] NULL,
	[Fehlerbeschreibung] [text] NULL,
	[Zubehoer] [text] NULL,
	[KredFehlerbeschreibung] [text] NULL,
	[KredZubehoer] [text] NULL,
	[KreditorRMANummer] [varchar](50) NULL,
	[Menge] [int] NULL,
	[Kosten] [float] NULL,
	[KundeI3D] [int] NULL,
	[ReNrKred] [varchar](50) NULL,
	[ReDatKred] [datetime] NULL,
	[ReKredName] [varchar](50) NULL,
	[RMAPosI3D] [int] NULL,
	[EingangArt] [int] NULL,
	[ErstellDatum] [datetime] NULL,
	[ErstellPersonalI3D] [int] NULL,
	[KostenGemein] [float] NULL,
	[KostenGesamt] [float] NULL,
	[LagerI3D] [int] NULL,
	[Buchung] [int] NULL,
	[BezugI3D] [int] NULL,
	[NumBarcodes] [int] NULL,
	[BarcodeScanen] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RmaSendBack]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RmaSendBack](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RmaI3D] [int] NOT NULL,
	[SupplierAccountI3D] [int] NOT NULL,
	[SupplierAccountAddressI3D] [int] NOT NULL,
	[SupplierAccountAddressContactPersonI3D] [int] NOT NULL,
	[SupplierPhoneNumber] [nvarchar](30) NULL,
	[SupplierFaxNumber] [nvarchar](30) NULL,
	[SupplierEMail] [nvarchar](255) NULL,
	[Receiver] [nvarchar](500) NULL,
	[Date] [datetime2](0) NULL,
	[SendDate] [datetime2](0) NULL,
	[ReturnDate] [datetime2](0) NULL,
	[SendKindI3D] [int] NOT NULL,
	[Paketnumber] [nvarchar](50) NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CreatedVersion] [varchar](25) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
	[ChangedVersion] [varchar](25) NOT NULL,
	[Number] [int] NULL,
 CONSTRAINT [PK_RmaSendBack] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RmaSendBackArticles]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RmaSendBackArticles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RmaArticleI3D] [int] NOT NULL,
	[RmaSendBackI3D] [int] NOT NULL,
	[ErrorDescriptionForSupplier] [nvarchar](500) NULL,
	[AccessoriesForSupplier] [nvarchar](500) NULL,
 CONSTRAINT [PK_RmaSendBackArticles] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RmaSendForth]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RmaSendForth](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RmaI3D] [int] NOT NULL,
	[RmaSendBackI3D] [int] NOT NULL,
	[Number] [int] NULL,
	[Date] [datetime2](0) NULL,
	[SendDate] [datetime2](0) NULL,
	[ReturnDate] [datetime2](0) NULL,
	[DeliveryDate] [datetime2](0) NULL,
	[DeliveryNumber] [nvarchar](50) NULL,
	[SupplierAccountI3D] [int] NOT NULL,
	[SupplierAccountAddressI3D] [int] NOT NULL,
	[SupplierAccountAddressContactPersonI3D] [int] NOT NULL,
	[SupplierPhoneNumber] [nvarchar](30) NULL,
	[SupplierEMail] [nvarchar](255) NULL,
	[Receiver] [nvarchar](500) NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[CreatedVersion] [varchar](25) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
	[ChangedVersion] [varchar](25) NOT NULL,
 CONSTRAINT [PK_RmaSendForth] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RmaSendForthArticles]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RmaSendForthArticles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RmaArticleI3D] [int] NOT NULL,
	[RmaSendBackItemI3D] [int] NOT NULL,
	[ErrorDescriptionFromSupplier] [nvarchar](500) NULL,
	[AccessoriesFromSupplier] [nvarchar](500) NULL,
	[OrigForthArticleI3D] [int] NULL,
	[RmaSendForthI3D] [int] NULL,
	[ForthAction] [int] NULL,
	[WarehouseI3D] [int] NULL,
	[Quantity] [int] NULL,
 CONSTRAINT [PK_RmaSendForthArticles] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RMMAgentCommandQueue]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RMMAgentCommandQueue](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CommandType] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[DeviceI3D] [int] NOT NULL,
	[TicketI3D] [int] NULL,
	[ScriptI3D] [int] NULL,
	[ComandValue] [nvarchar](max) NULL,
	[CommandState] [int] NOT NULL,
	[Result] [nvarchar](500) NULL,
	[ExecutedDate] [datetime] NULL,
 CONSTRAINT [PK_RMMAgentCommandQueue] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Roles]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Roles](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[ParentI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RolesToPersonal]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RolesToPersonal](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RoleI3D] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Rueckart]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Rueckart](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](50) NULL,
 CONSTRAINT [PK_Rueckart] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Ruecksendung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Ruecksendung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundeI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](50) NULL,
	[Text] [varchar](300) NULL,
	[SeriennummerI3D] [int] NULL,
	[Seriennummer] [varchar](50) NULL,
	[HerstellerI3D] [int] NULL,
	[HerstellerName] [varchar](50) NULL,
	[Herstellercode] [varchar](50) NULL,
	[Gekauft] [datetime] NULL,
	[Verkauft] [datetime] NULL,
	[KreditorName] [varchar](50) NULL,
	[KreditorI3D] [int] NULL,
	[KreditorAnschriftI3D] [int] NULL,
	[KreditorCode] [varchar](50) NULL,
	[KredLieferschein] [varchar](50) NULL,
	[KredRechnung] [varchar](50) NULL,
	[BestellungI3D] [int] NULL,
	[Warentyp] [int] NULL,
	[RechnungI3D] [int] NULL,
	[LieferscheinI3D] [int] NULL,
	[Garantie] [int] NULL,
	[ReparaturBis] [float] NULL,
	[Kostenvoranschlag] [int] NULL,
	[Fehler] [varchar](300) NULL,
	[Zubehoer] [varchar](300) NULL,
	[Status] [int] NULL,
	[Bearbeiter1] [int] NULL,
	[Datum1] [datetime] NULL,
	[RMANotwendig] [int] NULL,
	[RMANummer] [varchar](50) NULL,
	[Bearbeiter2] [int] NULL,
	[Datum2] [datetime] NULL,
	[Verandart] [int] NULL,
	[VersandAm] [datetime] NULL,
	[Paketnummer] [varchar](50) NULL,
	[Gewicht] [float] NULL,
	[MitgelZubehoer] [varchar](300) NULL,
	[Bearbeiter3] [int] NULL,
	[Datum3] [datetime] NULL,
	[ZurueckArt] [int] NULL,
	[ZurueckDatum] [datetime] NULL,
	[ZurueckBelegnummer] [varchar](50) NULL,
	[ZurueckSeriennummer] [varchar](50) NULL,
	[Bearbeiter4] [int] NULL,
	[Datum4] [datetime] NULL,
	[InfoAnVertrieb1] [int] NULL,
	[Ersatzartikel] [int] NULL,
	[ErsatzartikelI3D] [int] NULL,
	[InfoAnEinkauf] [int] NULL,
	[InfoAnVertrieb2] [int] NULL,
	[Bearbeiter5] [int] NULL,
	[Datum5] [datetime] NULL,
	[AnsprechI3D] [int] NULL,
	[Versandart] [int] NULL,
	[RechnungNummer] [varchar](50) NULL,
	[BestandGebucht] [int] NULL,
	[BestandZuruckGebucht] [int] NULL,
	[KnrBeimKred] [varchar](50) NULL,
	[Vorabaustausch] [int] NULL,
	[VorabSeriennummer] [varchar](50) NULL,
	[RMANichtErteilt] [int] NULL,
	[KundeAnschriftI3D] [int] NULL,
	[ErstellteRechnung] [varchar](50) NULL,
	[ErstellteGutschrift] [varchar](50) NULL,
	[GesendetKreditorI3D] [int] NULL,
	[GesendetKreditorName] [varchar](150) NULL,
	[GesendetKnrBeimKred] [varchar](150) NULL,
 CONSTRAINT [PK_Ruecksendung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RundschrKopf]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RundschrKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Titel] [char](40) NULL,
	[Datum] [datetime] NULL,
	[Typ] [int] NULL,
	[Benutzer] [varchar](10) NULL,
 CONSTRAINT [PK_RundschrKopf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RundschrKunden]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RundschrKunden](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RundschrI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
 CONSTRAINT [PK_RundschrKunden] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RunningWorkFlows]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RunningWorkFlows](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WorkFlowI3D] [int] NULL,
	[ToDoI3D] [int] NULL,
	[JobI3D] [int] NULL,
	[ErstellZeit] [datetime] NULL,
	[Dauer] [int] NULL,
	[Bearbeiter] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_RunningWorkFlows] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[S2PLog]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[S2PLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SNI3D] [int] NULL,
	[PosI3D] [int] NULL,
	[KopfI3D] [int] NULL,
	[KopfNummer] [int] NULL,
	[Datum] [datetime] NULL,
	[ObjektArt] [int] NULL,
	[AktuelleVersion] [int] NULL,
	[Aktuell] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SammelKomm]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SammelKomm](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[Ersteller] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_SammelKomm] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SammelKommAuf]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SammelKommAuf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SammelKommI3D] [int] NULL,
	[AufNummer] [int] NULL,
 CONSTRAINT [PK_SammelKommAuf] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SanctionAddresses]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SanctionAddresses](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OrganisationI3D] [int] NOT NULL,
	[Country] [nvarchar](64) NULL,
	[City] [nvarchar](64) NULL,
	[Street] [nvarchar](64) NULL,
	[Zipcode] [nvarchar](64) NULL,
	[ISONumber] [int] NULL,
 CONSTRAINT [PK_SanctionAddresses] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SanctionOrganisations]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SanctionOrganisations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Program] [nvarchar](64) NOT NULL,
	[Type] [nvarchar](64) NOT NULL,
	[Name] [nvarchar](128) NULL,
 CONSTRAINT [PK_SanctionOrganisations] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SanctionPersons]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SanctionPersons](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OrganisationI3D] [int] NOT NULL,
	[Lastname] [nvarchar](128) NULL,
	[Firstname] [nvarchar](128) NULL,
	[Function] [nvarchar](128) NULL,
 CONSTRAINT [PK_SanctionPersons] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ScanBoxen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ScanBoxen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ScannerI3D] [int] NULL,
	[DocType] [int] NULL,
	[Oben] [int] NULL,
	[Links] [int] NULL,
	[Unten] [int] NULL,
	[Rechts] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Scanner]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Scanner](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DPI] [int] NULL,
	[JPGQualitaet] [int] NULL,
	[LieferscheinErkennung] [varchar](1) NULL,
	[LieferscheinOrdner] [varchar](100) NULL,
	[LieferscheinDrehen] [int] NULL,
	[LieferscheinBild] [image] NULL,
	[AuftragErkennung] [varchar](1) NULL,
	[AuftragOrdner] [varchar](100) NULL,
	[AuftragDrehen] [int] NULL,
	[AuftragBild] [image] NULL,
	[ScannerName] [varchar](50) NULL,
	[Status] [int] NULL,
	[BesuchsberichtErkennung] [varchar](1) NULL,
	[BesuchsberichtOrdner] [varchar](100) NULL,
	[BesuchsberichtDrehen] [int] NULL,
	[BesuchsberichtBild] [image] NULL,
	[PixelType] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SelfCareFormActions]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SelfCareFormActions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketPatternI3D] [int] NOT NULL,
	[ActionType] [int] NOT NULL,
	[Position] [int] NOT NULL,
	[Options] [nvarchar](max) NULL,
	[TriggerI3D] [int] NOT NULL,
	[Caption] [nvarchar](100) NULL,
 CONSTRAINT [PK_SelfCareFormActions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SelfCareFormFieldComboboxItems]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SelfCareFormFieldComboboxItems](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SelfCareFormFieldI3D] [int] NOT NULL,
	[ComboboxItemValue] [nvarchar](200) NOT NULL,
 CONSTRAINT [PK_SelfCareFormFieldComboboxItems] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SelfCareFormFields]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SelfCareFormFields](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SelfCareFormI3D] [int] NOT NULL,
	[Row] [int] NOT NULL,
	[Column] [int] NOT NULL,
	[Label] [nvarchar](300) NOT NULL,
	[VariablesName] [nvarchar](300) NULL,
	[SelfCareFormFieldType] [int] NOT NULL,
	[IsCrypted] [bit] NOT NULL,
	[IsMandatory] [bit] NOT NULL,
	[ReadRight] [int] NULL,
	[ListItems] [nvarchar](max) NULL,
	[SortItemsAlphabetically] [bit] NOT NULL,
	[Description] [nvarchar](max) NULL,
	[AllowedFileTypes] [nvarchar](400) NULL,
	[UseInTicket] [bit] NOT NULL,
	[MetaData] [nvarchar](max) NULL,
 CONSTRAINT [PK_SelfCareFormFields] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SelfCareForms]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SelfCareForms](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FormTemplateName] [nvarchar](300) NOT NULL,
	[IsTemplate] [bit] NOT NULL,
	[HelpdeskI3D] [int] NULL,
	[Position] [int] NULL,
	[HelpdeskVersion] [int] NULL,
	[HelpdeskVersionFormReference] [int] NULL,
	[WebRequestI3D] [int] NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_SelfCareForms] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SelfCareFormScripts]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SelfCareFormScripts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SelfCareFormI3D] [int] NULL,
	[ScriptKind] [int] NOT NULL,
	[Script] [nvarchar](max) NOT NULL,
	[ExecuteAs] [int] NOT NULL,
	[TicketI3D] [int] NULL,
	[SortOrder] [int] NOT NULL,
	[Title] [nvarchar](100) NULL,
	[TicketPatternI3D] [int] NULL,
 CONSTRAINT [PK_SelfCareFormScripts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SelfCareFormStates]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SelfCareFormStates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketPatternI3D] [int] NOT NULL,
	[InfoText] [nvarchar](max) NULL,
	[IsDefault] [bit] NOT NULL,
	[ShowAlways] [bit] NOT NULL,
	[Caption] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_SelfCareFormStates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SelfCareFormTicketPattern]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SelfCareFormTicketPattern](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketPatternI3D] [int] NOT NULL,
	[SelfCareFormI3D] [int] NOT NULL,
 CONSTRAINT [PK_SelfCareFormTicketPattern] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SelfCareFormTriggers]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SelfCareFormTriggers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketPatternI3D] [int] NOT NULL,
	[TriggerType] [int] NOT NULL,
	[Position] [int] NOT NULL,
	[Options] [nvarchar](max) NULL,
	[StateI3D] [int] NOT NULL,
	[Caption] [nvarchar](100) NOT NULL,
 CONSTRAINT [PK_SelfCareFormTriggers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SepaContracts]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SepaContracts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[BankAccountI3D] [int] NOT NULL,
	[State] [tinyint] NOT NULL,
	[WordDocument] [varbinary](max) NULL,
	[DocumentI3D] [int] NULL,
	[Name] [nvarchar](128) NULL,
	[ContactI3D] [int] NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedBy] [int] NULL,
	[ChangedDate] [datetime2](7) NULL,
	[TestMode] [bit] NOT NULL,
	[TestModeMailAddress] [nvarchar](128) NULL,
	[DeclineReason] [nvarchar](max) NULL,
	[MailSubject] [nvarchar](128) NULL,
	[MailBody] [nvarchar](max) NULL,
	[AcceptMailSubject] [nvarchar](128) NULL,
	[AcceptMailBody] [nvarchar](max) NULL,
	[CreatorAcceptMailSubject] [nvarchar](128) NULL,
	[CreatorAcceptMailBody] [nvarchar](max) NULL,
	[DeclinedMailSubject] [nvarchar](128) NULL,
	[DeclinedMailBody] [nvarchar](max) NULL,
	[UseOwnTemplateText] [bit] NOT NULL,
	[AlternativeEmailContactI3D] [int] NULL,
 CONSTRAINT [PK_SepaContracts] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SepaContractTemplates]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SepaContractTemplates](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[WordDocument] [varbinary](max) NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedBy] [int] NULL,
	[ChangedDate] [datetime2](7) NULL,
	[MailSubject] [nvarchar](128) NULL,
	[MailBody] [nvarchar](max) NULL,
	[AcceptMailSubject] [nvarchar](128) NULL,
	[AcceptMailBody] [nvarchar](max) NULL,
	[CreatorAcceptMailSubject] [nvarchar](128) NULL,
	[CreatorAcceptMailBody] [nvarchar](max) NULL,
	[DeclinedMailSubject] [nvarchar](128) NULL,
	[DeclinedMailBody] [nvarchar](max) NULL,
	[UseOwnTemplateText] [bit] NOT NULL,
 CONSTRAINT [PK_SepaContractTemplates] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SerAuftr]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SerAuftr](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[Zeit] [datetime] NULL,
	[TechnikerID] [int] NULL,
	[Status] [int] NULL,
	[KundenID] [int] NOT NULL,
	[AnschriftID] [int] NOT NULL,
	[PersonID] [int] NOT NULL,
	[SN] [varchar](20) NULL,
	[Re] [varchar](20) NULL,
	[Garantie] [int] NULL,
	[VOS] [int] NULL,
	[WV] [int] NULL,
	[Prioritaet] [int] NULL,
	[TerminDatum] [datetime] NULL,
	[TerminZeit] [datetime] NULL,
	[MandantID] [int] NULL,
	[Arbeiten] [text] NULL,
	[Infos] [text] NULL,
	[AuftragsNr] [int] NULL,
	[Material] [text] NULL,
	[Ausgef] [text] NULL,
	[Anfahrt] [int] NULL,
	[BenutzerName] [varchar](20) NULL,
	[Ansprechpartner] [varchar](60) NULL,
	[AnsprechTel] [varchar](20) NULL,
	[AngemeldeterUser] [varchar](8) NULL,
	[Benutzer] [varchar](8) NULL,
 CONSTRAINT [PK_SerAuftr] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SerFirma]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SerFirma](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Firma] [varchar](30) NULL,
 CONSTRAINT [PK_SerFirma] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SeriennummerZuArbeitsauftrag]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SeriennummerZuArbeitsauftrag](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[BarcodeI3D] [int] NULL,
	[ArbeitsschrittI3D] [int] NULL,
	[ArbeitsauftragI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SerTechn]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SerTechn](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nachname] [varchar](50) NULL,
	[Vorname] [varchar](50) NULL,
	[Tel] [varchar](50) NULL,
	[Handy] [varchar](50) NULL,
	[TelPriv] [varchar](50) NULL,
	[Username] [varchar](30) NULL,
	[Passwort] [varchar](30) NULL,
 CONSTRAINT [PK_SerTechn] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ServiceArbeiten]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceArbeiten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AufKopfI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Text] [text] NULL,
	[BeginZeit] [datetime] NULL,
	[EndZeit] [datetime] NULL,
	[Erledigt] [int] NULL,
	[ArbeitArt] [int] NULL,
	[KostenArt] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Bemerkung] [varchar](500) NULL,
	[ArbeitAusAuftrag] [int] NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_ServiceArbeiten] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ServiceArbeitenVorlagen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceArbeitenVorlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[ServiceArbeit] [text] NULL,
	[Pflicht] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ServiceGruppen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
 CONSTRAINT [PK_ServiceGruppen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ServiceLog]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Vorher] [varchar](100) NULL,
	[Nachher] [varchar](100) NULL,
	[GeaendertVon] [nvarchar](50) NULL,
	[GeaendertAm] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ServiceSaetze]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceSaetze](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Monate] [int] NULL,
	[Preisklasse1] [float] NULL,
	[Preisklasse2] [float] NULL,
	[Preisklasse3] [float] NULL,
	[Preisklasse4] [float] NULL,
	[Preisklasse5] [float] NULL,
	[Preisklasse6] [float] NULL,
 CONSTRAINT [PK_ServiceSaetze] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SharedData]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SharedData](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Token] [nvarchar](500) NOT NULL,
	[ReceiptI3D] [int] NOT NULL,
	[ReceiptKind] [int] NOT NULL,
	[DocumentI3D] [int] NOT NULL,
	[SalutationI3D] [int] NULL,
	[SignaturI3D] [int] NULL,
	[ConclusionI3D] [int] NULL,
	[ExpireDate] [datetime2](0) NULL,
	[IsEncrypted] [bit] NULL,
	[AuthenticationKey] [nvarchar](250) NULL,
 CONSTRAINT [PK_SharedData] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SharedDataForAcception]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SharedDataForAcception](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Token] [nvarchar](500) NOT NULL,
	[SharedDataI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[Accept] [bit] NULL,
	[AcceptDate] [datetime2](3) NULL,
	[Comment] [nvarchar](500) NULL,
 CONSTRAINT [PK_SharedDataForAcception] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SharedDataLogs]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SharedDataLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [nvarchar](500) NOT NULL,
	[Kind] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](2) NOT NULL,
	[ReceiverMail] [nvarchar](100) NOT NULL,
	[DocumentKind] [int] NULL,
	[DocumentI3D] [int] NOT NULL,
 CONSTRAINT [PK_SharedDataLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SharedDocumentForAcceptance]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SharedDocumentForAcceptance](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Token] [nvarchar](500) NOT NULL,
	[SharedDocumentI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[HasAccepted] [bit] NULL,
	[AcceptanceDate] [datetime2](3) NULL,
	[Comment] [nvarchar](500) NULL,
 CONSTRAINT [PK_SharedDocumentForAcceptance] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SharedDocumentLogs]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SharedDocumentLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [nvarchar](500) NOT NULL,
	[Kind] [int] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](2) NOT NULL,
	[ReceiverMail] [nvarchar](100) NOT NULL,
	[DocumentKind] [int] NULL,
	[DocumentI3D] [int] NULL,
	[SharedDocumentI3D] [int] NOT NULL,
 CONSTRAINT [PK_SharedDocumentLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SharedDocuments]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SharedDocuments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Token] [nvarchar](500) NOT NULL,
	[ReceiptI3D] [int] NULL,
	[ReceiptKind] [int] NULL,
	[SalutationI3D] [int] NULL,
	[SignatureI3D] [int] NULL,
	[ConclusionI3D] [int] NULL,
	[ExpiredDate] [datetime2](0) NULL,
	[IsEncrypted] [bit] NOT NULL,
	[AuthenticationKey] [nvarchar](250) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[ReceiptNumber] [int] NULL,
	[ReceiverSignatureName] [nvarchar](100) NULL,
	[IsSigned] [bit] NULL,
	[SignedDate] [datetime2](2) NULL,
	[SignedFromIp] [nvarchar](50) NULL,
	[DocumentData] [varbinary](max) NOT NULL,
	[DocumentName] [nvarchar](500) NOT NULL,
	[DocumentI3D] [int] NULL,
	[State] [int] NOT NULL,
	[ReceiptPdfDocumentI3D] [int] NULL,
 CONSTRAINT [PK_SharedDocuments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SichFields]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SichFields](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[FormularID] [int] NOT NULL,
	[ControlName] [varchar](100) NOT NULL,
	[ControlCaption] [varchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SichFieldsAssociated]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SichFieldsAssociated](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ControlI3D] [int] NOT NULL,
	[AssociatedControlName] [varchar](100) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sichgrup]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sichgrup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](60) NULL,
	[Kommentar] [varchar](255) NULL,
	[Status] [int] NULL,
	[Land] [int] NULL,
	[Vertrieb] [int] NULL,
	[Lager] [int] NULL,
	[Produktion] [int] NULL,
	[Service] [int] NULL,
	[BranchI3D] [int] NULL,
 CONSTRAINT [PK_Sichgrup] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sichmemb]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sichmemb](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Gruppe] [int] NULL,
	[Benutzer] [int] NULL,
 CONSTRAINT [PK_Sichmemb] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SichProtokoll]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SichProtokoll](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NULL,
	[Objekt] [varchar](500) NULL,
	[Beschreibung] [varchar](500) NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sichrech]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sichrech](
	[I3D] [int] NOT NULL,
	[Nummer] [int] NULL,
	[FormName] [varchar](255) NULL,
	[FormCont] [varchar](255) NULL,
	[Text] [varchar](255) NULL,
	[OwnerRecht] [int] NULL,
	[NumChildren] [int] NULL,
	[Beschreibung] [text] NULL,
	[Obsolete] [bit] NOT NULL,
 CONSTRAINT [PK_Sichrech] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sichtrus]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sichtrus](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Gruppe] [int] NULL,
	[Recht] [int] NULL
) ON [PRIMARY]
GO
/****** Object:  Index [ixSichRechRecht]    Script Date: 11.11.2025 11:20:29 ******/
CREATE CLUSTERED INDEX [ixSichRechRecht] ON [dbo].[Sichtrus]
(
	[Recht] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SimpleUrls]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SimpleUrls](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[Caption] [varchar](50) NULL,
	[URL] [varchar](2000) NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NULL,
	[ChangedBy] [int] NULL,
	[IsVisible] [bit] NOT NULL,
 CONSTRAINT [PK_SimpleUrls] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Skillgruppe]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Skillgruppe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnungkurz] [varchar](100) NULL,
	[ART] [varchar](50) NULL,
	[ObjektArt] [int] NULL,
	[OwnerDirI3D] [int] NULL,
	[Status] [int] NULL,
	[OwnerI3D] [int] NULL,
 CONSTRAINT [PK_Skilltyp] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Skills]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Skills](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SkillgruppenI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Bezeichnunglang] [varchar](255) NULL,
	[Giltvon] [datetime] NULL,
	[GiltBis] [datetime] NULL,
	[ErstellerI3D] [int] NULL,
	[ErstellerKuerzel] [nvarchar](50) NULL,
	[ErstellDatum] [datetime] NULL,
	[Kommentar] [text] NULL,
	[ObjektArt] [int] NULL,
	[OwnerDirI3D] [int] NULL,
 CONSTRAINT [PK_Skills] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sondervereinbarung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sondervereinbarung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](200) NULL,
	[Status] [int] NULL,
	[Angelegt_am] [datetime] NULL,
	[Angelegt_von] [int] NULL,
	[Geandert_am] [datetime] NULL,
	[Geandert_von] [int] NULL,
	[GueltigVon] [datetime] NULL,
	[GueltigBis] [datetime] NULL,
	[Nummer] [varchar](50) NULL,
	[OnlyArticle] [int] NULL,
	[EKVKAbschlag] [int] NULL,
	[EKAbschlagProzent] [float] NULL,
	[VKAbschlagProzent] [float] NULL,
	[FilialI3D] [int] NULL,
	[IsInternal] [bit] NULL,
	[ConfigID] [nvarchar](100) NULL,
	[SupplierI3D] [int] NULL,
	[IsProjectPrice] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SondervereinbarungsArtikel]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SondervereinbarungsArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtikelI3D] [int] NULL,
	[SondervereinbarungsI3D] [int] NULL,
	[SondervereinbarungsEK] [float] NULL,
	[Status] [int] NULL,
	[HerstCode] [varchar](100) NULL,
	[Artikelbeschr] [varchar](5000) NULL,
	[EKMenge1] [float] NULL,
	[EKPreis1] [float] NULL,
	[EKMenge2] [float] NULL,
	[EKPreis2] [float] NULL,
	[EKMenge3] [float] NULL,
	[EKPreis3] [float] NULL,
	[EKMenge4] [float] NULL,
	[EKPreis4] [float] NULL,
	[EKMenge5] [float] NULL,
	[EKPreis5] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SozialesNetzwerk]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SozialesNetzwerk](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](200) NULL,
	[IstWebsite] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SpecialArticleToContractHead]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SpecialArticleToContractHead](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ContractI3D] [int] NOT NULL,
	[Description] [nvarchar](150) NULL,
	[DescriptionLong] [nvarchar](2000) NULL,
	[BillingDateValidFrom] [datetime] NOT NULL,
	[CreatedByPersonalI3D] [int] NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[InvoiceI3D] [int] NULL,
	[ExternalID] [varchar](200) NULL,
	[IsCentronSpecialPrice] [bit] NULL,
 CONSTRAINT [PK_SpecialArticleToContract] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SpecialArticleToContractImports]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SpecialArticleToContractImports](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ImportKind] [int] NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[Name] [nvarchar](400) NULL,
	[Separator] [int] NULL,
	[DecimalSeparator] [int] NULL,
	[ArticleDescriptionTemplate] [nvarchar](max) NULL,
	[IgnoreImportRetailPrices] [bit] NULL,
	[NoStockChange] [bit] NULL,
	[ColumnNameIndex] [int] NULL,
	[DataStartIndex] [int] NULL,
	[IgnoreImportPurchasePrices] [bit] NULL,
	[ContractKindI3D] [int] NULL,
	[OnlyArticlesWithSpecialPrices] [bit] NULL,
	[FixedInterface] [int] NULL,
	[UseArticleDescriptionForPositionText] [bit] NOT NULL,
	[UseSpecialPriceForArticleIfAvailable] [bit] NOT NULL,
	[UseNegativImportPurchasPriceAndIgnoreArticlePurchasePrice] [bit] NOT NULL,
	[IsMsp] [bit] NULL,
	[IsForeignArticleCode] [bit] NULL,
	[IsForeignCustomerNumber] [bit] NULL,
 CONSTRAINT [PK_SpecialArticleToContractImports] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SpecialArticleToContractPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SpecialArticleToContractPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[HeadI3D] [int] NOT NULL,
	[ArticleI3D] [int] NULL,
	[ArticleDescription] [nvarchar](max) NULL,
	[Quantity] [numeric](18, 5) NULL,
	[Price] [numeric](18, 5) NULL,
	[PurchasePrice] [decimal](18, 5) NULL,
	[Duration] [numeric](9, 5) NULL,
	[ArticleDescriptionPlainText] [nvarchar](100) NULL,
 CONSTRAINT [PK_SpecialArticleToContractPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Sperrung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sperrung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[KurzZeich] [varchar](50) NULL,
	[Art] [varchar](50) NULL,
 CONSTRAINT [PK_Sperrung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[STAMM]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[STAMM](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Angebotsnummer] [float] NULL,
	[Auftragsnummer] [float] NULL,
	[Liefernummer] [float] NULL,
	[Versandnummer] [float] NULL,
	[Ausgabeschein_Nr] [float] NULL,
	[Reparaturannahme_Nr] [float] NULL,
	[Reparaturschein_Nr] [float] NULL,
	[Kundennummer] [float] NULL,
	[Produktgruppe_diverse] [int] NULL,
	[Wareneingangs_Nr] [float] NULL,
	[Kreditoren_Nr] [int] NULL,
	[Artikelfluss_Nr] [float] NULL,
	[Bestellnummer] [float] NULL,
	[Tage_zwischen_M1___M2] [int] NULL,
	[Tage_zwischen_M2___M3] [int] NULL,
	[Kulanztage] [int] NULL,
	[Mwst_Satz_1] [float] NULL,
	[Mwst_1_Text] [varchar](40) NULL,
	[Mwst_Satz_2] [float] NULL,
	[Mwst_2_Text] [varchar](40) NULL,
	[Mwst_Satz_3] [float] NULL,
	[Mwst_3_Text] [varchar](40) NULL,
	[Mwst_Satz_4] [float] NULL,
	[Mwst_4_Text] [varchar](40) NULL,
	[Mwst_Satz_5] [float] NULL,
	[Mwst_5_Text] [varchar](40) NULL,
	[Mwst_Satz_6] [float] NULL,
	[Mwst_6_Text] [varchar](40) NULL,
	[Übernahme_nach_Bezahlt] [varchar](1) NULL,
	[Übernahme_nach_Tagen] [int] NULL,
	[Produktionszeit] [int] NULL,
	[Ãœbernahme_nach_Bezahlt] [varchar](1) NULL,
	[Ãœbernahme_nach_Tagen] [int] NULL,
 CONSTRAINT [PK_STAMM] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StammdatBLOB]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StammdatBLOB](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BlobFeld] [image] NULL,
	[Beschreibung] [varchar](255) NULL,
 CONSTRAINT [PK_StammdatBLOB] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StammdatExterneProgramme]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StammdatExterneProgramme](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](250) NULL,
	[Pfad] [varchar](250) NULL,
	[Parameter] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Stammdatfelder]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Stammdatfelder](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ControlName] [varchar](60) NULL,
	[LabelName] [varchar](60) NULL,
	[AnzeigeText] [varchar](60) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Stammdatfelder] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StammdatProjektVorlage]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StammdatProjektVorlage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Vorlage] [image] NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
	[MailBetreff] [varchar](255) NULL,
	[Bezeichnung] [varchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticAssetDay]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticAssetDay](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BranchI3D] [int] NULL,
	[AssetKind] [int] NOT NULL,
	[Turnover] [float] NOT NULL,
	[TurnoverService] [float] NOT NULL,
	[ContributionMargin] [float] NOT NULL,
	[Date] [datetime] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticAssetDetail]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticAssetDetail](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BranchI3D] [int] NULL,
	[AssetKind] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[Date] [datetime] NOT NULL,
	[Turnover] [float] NOT NULL,
	[TurnoverService] [float] NOT NULL,
	[ContributionMargin] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticAssetYear]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticAssetYear](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BranchI3D] [int] NULL,
	[AssetKind] [int] NOT NULL,
	[Year] [int] NOT NULL,
	[Turnover] [float] NOT NULL,
	[TurnoverService] [float] NOT NULL,
	[ContributionMargin] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticAssetYearMonth]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticAssetYearMonth](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BranchI3D] [int] NULL,
	[Year] [int] NOT NULL,
	[Month] [int] NOT NULL,
	[Turnover] [float] NOT NULL,
	[TurnoverService] [float] NOT NULL,
	[ContributionMargin] [float] NOT NULL,
	[AssetKind] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticHelpdesk]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticHelpdesk](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Date] [datetime] NOT NULL,
	[NewHelpdesks] [int] NOT NULL,
	[ClosedHelpdesks] [int] NOT NULL,
	[OpenHelpdesks] [int] NOT NULL,
	[DueTotal] [int] NOT NULL,
	[DueOpened] [int] NOT NULL,
	[Escalation1] [int] NOT NULL,
	[Escalation2] [int] NOT NULL,
	[Escalation3] [int] NOT NULL,
	[Chargable] [float] NOT NULL,
	[NotChargable] [float] NOT NULL,
	[Charged] [float] NOT NULL,
	[RecordedHours] [float] NOT NULL,
	[FreeHours] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticHelpdeskDetails]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticHelpdeskDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Date] [datetime] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[NewHelpdesks] [int] NOT NULL,
	[ClosedHelpdesks] [int] NOT NULL,
	[OpendHelpdesks] [int] NOT NULL,
	[DueTotal] [int] NOT NULL,
	[DueOpened] [int] NOT NULL,
	[Escalation1] [int] NOT NULL,
	[Escalation2] [int] NOT NULL,
	[Escalation3] [int] NOT NULL,
	[Chargable] [float] NOT NULL,
	[NotChargable] [float] NOT NULL,
	[Charged] [float] NOT NULL,
	[RecordedHours] [float] NOT NULL,
	[FreeHours] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticManagementDay]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticManagementDay](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BranchI3D] [int] NULL,
	[Date] [datetime] NOT NULL,
	[Turnover] [float] NOT NULL,
	[TurnoverService] [float] NOT NULL,
	[ContributionMargin] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticManagementYear]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticManagementYear](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BranchI3D] [int] NULL,
	[Year] [int] NOT NULL,
	[Turnover] [float] NOT NULL,
	[TurnoverService] [float] NOT NULL,
	[ContributionMargin] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticManagementYearMonth]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticManagementYearMonth](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BranchI3D] [int] NULL,
	[Year] [int] NOT NULL,
	[Month] [int] NOT NULL,
	[Turnover] [float] NOT NULL,
	[TurnoverService] [float] NOT NULL,
	[ContributionMargin] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticModuleCustomStatistics]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticModuleCustomStatistics](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NULL,
	[Name] [nvarchar](100) NOT NULL,
	[StatisticType] [int] NOT NULL,
	[LayoutData] [varbinary](max) NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[CreatedVersion] [nvarchar](16) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[ChangedVersion] [nvarchar](16) NOT NULL,
 CONSTRAINT [PK_StatisticModuleCustomStatistics] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticRoles]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticRoles](
	[I3D] [int] NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[ParentI3D] [int] NULL,
	[IdentName] [varchar](56) NULL,
 CONSTRAINT [PK_StatisticRoles] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticRolesStatisticsToEmployee]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticRolesStatisticsToEmployee](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[StatisticRolesStatisticsI3D] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticRolesToEmployee]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticRolesToEmployee](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[StatisticRolesI3D] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[BranchI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticRolesToStatistics]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticRolesToStatistics](
	[I3D] [int] NOT NULL,
	[StatisticRolesI3D] [int] NOT NULL,
	[StatisticsI3D] [int] NOT NULL,
	[StatisticOrder] [int] NOT NULL,
 CONSTRAINT [PK_StatisticRolesToStatistics] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticStock]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticStock](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[NebenlagerI3D] [int] NULL,
	[Date] [datetime] NOT NULL,
	[StockValue] [float] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatisticTypes]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatisticTypes](
	[I3D] [int] NOT NULL,
	[StatisticName] [nvarchar](24) NOT NULL,
	[spName] [nvarchar](56) NOT NULL,
	[spParameters] [nvarchar](256) NULL,
 CONSTRAINT [PK_StatisticTypes] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StatistikTexte]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StatistikTexte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](100) NULL,
 CONSTRAINT [PK_StatistikTexte] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StopwatchNotifications]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StopwatchNotifications](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[HelpdeskI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
 CONSTRAINT [PK_StopwatchNotifications] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SupplierEdiConfigurations]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SupplierEdiConfigurations](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierI3D] [int] NOT NULL,
	[ExportKind] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[EdiDataType] [int] NULL,
	[OrderSender] [nvarchar](50) NULL,
	[Url] [nvarchar](500) NULL,
	[UseAuthentication] [bit] NOT NULL,
	[Username] [nvarchar](255) NULL,
	[Password] [nvarchar](255) NULL,
	[Port] [int] NULL,
	[Mask] [nvarchar](255) NULL,
	[Directory] [nvarchar](255) NULL,
	[DeleteAfterUpload] [bit] NULL,
	[Info] [nvarchar](2000) NULL,
	[Specificity] [int] NULL,
	[SupplierCustomerNumber] [nvarchar](20) NULL,
	[Additional] [nvarchar](500) NULL,
 CONSTRAINT [PK__SupplierEdiConfigurations] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SupplierPdfScanConfigs]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SupplierPdfScanConfigs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierI3D] [int] NOT NULL,
	[Name] [nvarchar](400) NOT NULL,
	[InvoiceNumberPdfScanConfig] [nvarchar](max) NULL,
	[InvoiceDatePdfScanConfig] [nvarchar](max) NULL,
	[OwnPurchaseNumberPdfScanConfig] [nvarchar](max) NULL,
	[NetSumPdfScanConfig] [nvarchar](max) NULL,
	[GrossSumNumberPdfScanConfig] [nvarchar](max) NULL,
	[FreightPdfScanConfig] [nvarchar](max) NULL,
	[InsurancePdfScanConfig] [nvarchar](max) NULL,
	[ExamplePdf] [varbinary](max) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](7) NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime2](7) NOT NULL,
	[ReceiptKind] [int] NOT NULL,
 CONSTRAINT [PK_SupplierPdfScanConfigs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SupplierReceiptDocuments]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SupplierReceiptDocuments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierI3D] [int] NULL,
	[Caption] [nvarchar](400) NOT NULL,
	[FileType] [int] NOT NULL,
	[FileData] [varbinary](max) NOT NULL,
	[IsPrinted] [bit] NOT NULL,
	[ReceiptKind] [int] NOT NULL,
 CONSTRAINT [PK_SupplierReceiptDocuments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SupplierReceiptDocumentsToSupplierBookings]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SupplierReceiptDocumentsToSupplierBookings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SupplierReceiptDocumentI3D] [int] NOT NULL,
	[SupplierBookingI3D] [int] NOT NULL,
	[AttachmentName] [nvarchar](400) NULL,
	[DocumentToBookingAssignmentKind] [int] NOT NULL,
 CONSTRAINT [PK_SupplierReceiptDocumentsToSupplierBookings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SupportLevel]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SupportLevel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](64) NOT NULL,
	[SupportLevel] [int] NOT NULL,
	[DurationInMinutes] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SurveyFolders]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SurveyFolders](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
	[ParentFolderI3D] [int] NULL,
 CONSTRAINT [PK_SurveyFolders] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SurveyProcessProperties]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SurveyProcessProperties](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsTemplate] [bit] NOT NULL,
	[ReleaseDate] [datetime] NULL,
	[ReleasedFromI3D] [int] NULL,
	[SurveyI3D] [int] NOT NULL,
	[Status] [int] NULL,
	[ContactI3D] [int] NULL,
	[ContactPersonI3D] [int] NULL,
	[EMail] [nvarchar](255) NULL,
	[RespondentName] [nvarchar](255) NULL,
	[IsCopy] [bit] NULL,
	[TemplateI3D] [int] NULL,
	[FirstLoadOnWEB] [datetime] NULL,
	[ObjectKind] [int] NULL,
	[ObjectI3D] [int] NULL,
 CONSTRAINT [PK_SurveyProcessProperties] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SurveyQuestionCategories]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SurveyQuestionCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
	[Description] [nvarchar](500) NULL,
	[Color] [nvarchar](10) NULL,
	[IsDeactivated] [bit] NULL,
	[IsDeleted] [bit] NOT NULL,
 CONSTRAINT [PK_SurveyQuestionCategories] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SurveyStepInstructions]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SurveyStepInstructions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[StepI3D] [int] NOT NULL,
	[Text] [nvarchar](max) NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[DestinationEmail] [nvarchar](255) NOT NULL,
	[DestinationKind] [int] NOT NULL,
	[Kind] [int] NOT NULL,
	[MutliChoiceKindChoiceText] [nvarchar](255) NULL,
	[ScaleKindMax] [int] NULL,
	[ScaleKindMin] [int] NULL,
	[YesNoKindYes] [bit] NULL,
 CONSTRAINT [PK_SurveyStepInstructions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[sysuserobjects]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[sysuserobjects](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[pid] [varchar](50) NULL,
	[did] [int] NULL,
	[muser] [int] NULL,
	[founddate] [datetime] NULL,
	[foundmachine] [varchar](250) NULL,
	[foundversion] [varchar](50) NULL,
	[lastdate] [datetime] NULL,
	[lastmachine] [varchar](250) NULL,
	[lastversion] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaetigkeitenHistory]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaetigkeitenHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TaetigkeitsI3D] [int] NULL,
	[KundeI3D] [int] NULL,
	[AnsprechI3D] [int] NULL,
	[TaetigkeitsTYP] [int] NULL,
	[Name] [varchar](255) NULL,
	[Text] [varchar](5000) NULL,
	[TaetDirI3D] [int] NULL,
	[DocI3D] [int] NULL,
	[BearbeitetAm] [datetime] NULL,
	[Datum] [datetime] NULL,
	[Faelligkeitsdatum] [datetime] NULL,
	[WiedervorlageDatum] [datetime] NULL,
	[EndDatum] [datetime] NULL,
	[Status] [int] NULL,
	[ErstellerI3D] [int] NULL,
	[ImageIndex] [int] NULL,
	[EmpfaengerI3D] [int] NULL,
	[NeuKunde] [int] NULL,
	[BesuchsberichtDocI3D] [int] NULL,
	[SonderaktionI3D] [int] NULL,
	[ImageIndexZugehoerig] [int] NULL,
	[CRMProjektI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
	[ObjektNr] [int] NULL,
	[BarcodeI3D] [int] NULL,
	[Bewertung] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaetigkeitenVorlagen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaetigkeitenVorlagen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](240) NULL,
	[Text] [varchar](5000) NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Tage]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Tag] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Tagebuch]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tagebuch](
	[I3D] [int] NULL,
	[Datum] [datetime] NULL,
	[ZeitVon] [datetime] NULL,
	[ZeitBis] [datetime] NULL,
	[Text] [varchar](240) NULL,
	[Username] [varchar](10) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Tags]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tags](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](255) NOT NULL,
	[ShowInSuggestions] [bit] NOT NULL,
 CONSTRAINT [PK_Tags] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Tanss]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tanss](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[XMLData] [varbinary](max) NULL,
	[TanssDeliveryListNumber] [int] NULL,
	[CentronDeliveryListNumber] [int] NULL,
	[CentronInvoiceNumber] [int] NULL,
	[PDF] [varbinary](max) NULL,
	[PDFName] [nvarchar](100) NULL,
	[PDFAttachedToInvoice] [bit] NULL,
 CONSTRAINT [PK_Tanss] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TAPIAnrufer]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TAPIAnrufer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer] [varchar](50) NULL,
	[Text] [varchar](100) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TAPINummern]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TAPINummern](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Nummer1] [varchar](30) NOT NULL,
	[Nummer2] [varchar](30) NULL,
	[Nummer3] [varchar](30) NULL,
	[Nummer4] [varchar](30) NULL,
	[ObjektI3D] [int] NOT NULL,
	[ObjektArt] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TAPIRueckrufe]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TAPIRueckrufe](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TelefonateI3D] [int] NULL,
	[Datum] [datetime] NULL,
	[PersonalI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskChecklistSuggestions]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskChecklistSuggestions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TaskI3D] [int] NOT NULL,
	[ChecklistWorkplanTemplateI3D] [int] NULL,
	[DeviceI3D] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[VirtualObjectI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[CreatedOn] [datetime] NOT NULL,
	[CentronChecklistI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementAction]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementAction](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NULL,
	[PriorityI3D] [int] NULL,
	[TypeI3D] [int] NULL,
	[CategoryI3D] [int] NULL,
	[StatusI3D] [int] NULL,
	[ResponsibleEmployeeI3D] [int] NULL,
	[Important] [bit] NULL,
	[ContractI3D] [int] NULL,
	[MasterDataListI3D] [int] NULL,
	[ActionType] [int] NOT NULL,
	[CreateMultipleTicketsPerCustomer] [bit] NULL,
	[ResponsiblePersonAdviser] [int] NULL,
	[NotificationReceiverI3D] [int] NULL,
	[SubstitutionStart] [date] NULL,
	[SubstitutionEnd] [date] NULL,
	[ContactI3D] [int] NULL,
	[PlannedDurationInHours] [float] NULL,
	[IsOnlyInternalVisible] [bit] NULL,
	[MailBodyAsRtf] [nvarchar](max) NULL,
	[MailSubject] [nvarchar](200) NULL,
	[DueDateOffset] [bigint] NULL,
	[SendSeparateEmails] [bit] NULL,
	[InternalNote] [nvarchar](max) NULL,
	[ArticleWorkItemI3D] [int] NULL,
	[SendMailToSelectedHelpdeskEmployees] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionAdviser]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionAdviser](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Adviser] [int] NOT NULL,
	[TaskManagementActionI3D] [int] NULL,
 CONSTRAINT [PK_TaskManagementActionAdviser] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionChecklist]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionChecklist](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RBChecklistWorkplanI3D] [int] NULL,
	[TaskManagementActionI3D] [int] NULL,
	[CentronChecklistI3D] [int] NULL,
 CONSTRAINT [PK_TaskManagementActionChecklist] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionCustomer]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionCustomer](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[TaskManagementActionI3D] [int] NULL,
 CONSTRAINT [PK_TaskManagementActionCustomer] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionCustomerMailRecipient]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionCustomerMailRecipient](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TaskManagementActionI3D] [int] NULL,
	[ContactPersonI3D] [int] NULL,
	[EmailAddress] [nvarchar](200) NULL,
	[Adviser] [int] NULL,
	[EmployeeI3D] [int] NULL,
	[DepartmentI3D] [int] NULL,
	[TicketProjectMemberType] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionDepartment]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionDepartment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeDepartmentI3D] [int] NOT NULL,
	[TaskManagementActionI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionDevice]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionDevice](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[AssetManagementDeviceI3D] [int] NOT NULL,
	[TaskManagementActionI3D] [int] NULL,
 CONSTRAINT [PK_TaskManagementActionDevice] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionExecutedAt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionExecutedAt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ExecutedAt] [datetime] NOT NULL,
	[TaskManagementActionI3D] [int] NOT NULL,
	[ExecutedFromEmployeeI3D] [int] NULL,
	[TicketI3D] [int] NULL,
 CONSTRAINT [PK_TaskManagementActionExecutedAt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionMember]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionMember](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[TaskManagementActionI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionReport]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionReport](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReportDataI3D] [int] NOT NULL,
	[TaskManagementActionI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementActionSubstitute]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementActionSubstitute](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[TaskManagementActionI3D] [int] NULL,
 CONSTRAINT [PK_TaskManagementActionSubstitute] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementRecurrence]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementRecurrence](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[RecurrenceType] [int] NOT NULL,
	[StartTime] [datetime] NOT NULL,
	[EndTime] [datetime] NULL,
	[AppointmentStart] [datetime] NOT NULL,
	[AppointmentEnd] [datetime] NULL,
	[NumberOfRecurrence] [int] NULL,
	[CountOfRecurrence] [int] NULL,
	[DayInterval] [int] NULL,
	[WeekInterval] [int] NULL,
	[MonthInterval] [int] NULL,
	[EveryWeekday] [bit] NULL,
	[WeekDay] [nvarchar](50) NULL,
	[DayOfMonth] [int] NULL,
	[Month] [int] NULL,
	[ExecuteDaysBefore] [int] NULL,
	[ExecuteAfterTime] [time](7) NULL,
	[NextExecutionDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementRecurrenceWeekDays]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementRecurrenceWeekDays](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Days] [nvarchar](50) NOT NULL,
	[TaskManagementRecurrenceI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TaskManagementTask]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TaskManagementTask](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedByI3D] [int] NOT NULL,
	[Status] [varchar](20) NULL,
	[Description] [nvarchar](max) NULL,
	[Name] [nvarchar](1000) NULL,
	[TaskManagementActionI3D] [int] NOT NULL,
	[ChangedByI3D] [int] NOT NULL,
	[ChangedDate] [datetime] NOT NULL,
	[TaskManagementRecurrenceI3D] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Telefonate]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Telefonate](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[OwnerI3D] [int] NULL,
	[OwnerArt] [int] NULL,
	[CallerName] [varchar](50) NULL,
	[CallerNumber] [varchar](50) NOT NULL,
	[StartTime] [datetime] NOT NULL,
	[Duration] [int] NULL,
	[Text] [varchar](max) NULL,
	[Flags] [int] NULL,
	[ErstellerPersonalI3D] [int] NOT NULL,
	[Outgoing] [int] NULL,
	[WasConnected] [int] NULL,
	[EndTime] [datetime] NULL,
	[Internal] [int] NULL,
	[Erledigt] [int] NULL,
	[CallID] [nvarchar](500) NULL,
	[IsGroupCall] [bit] NOT NULL,
	[CreatorName] [nvarchar](500) NULL,
	[CreatorNumber] [nvarchar](500) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TelemarketingTexte]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TelemarketingTexte](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](255) NULL,
	[Status] [int] NULL,
	[Farbe] [varchar](10) NULL,
	[TelemarketingI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminArt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](255) NULL,
	[Kommentar] [varchar](255) NULL,
	[Gueltig] [int] NULL,
	[Genehmigen] [int] NULL,
	[Erstellung] [int] NULL,
	[ErstellungInfo] [int] NULL,
	[Bearbeitung] [int] NULL,
	[BearbeitungInfo] [int] NULL,
	[Flags] [int] NULL,
	[Finish] [int] NULL,
 CONSTRAINT [PK_TerminArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Termine]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Termine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[DauerTerminI3D] [int] NULL,
	[Datum_von] [datetime] NOT NULL,
	[Datum_bis] [datetime] NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
	[Kommentar] [varchar](255) NULL,
	[ErstellerI3D] [int] NULL,
	[TerminArt] [int] NULL,
	[Status] [int] NULL,
	[ValidDaReCo] [int] NULL,
 CONSTRAINT [PK_Termine] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminObjektArt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminObjektArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](80) NULL,
 CONSTRAINT [PK_TerminObjektArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungArtWebSuite]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungArtWebSuite](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](255) NULL,
	[Active] [int] NULL,
 CONSTRAINT [PK_TerminplanungArtWebSuite] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungGruppen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](254) NULL,
	[PersonalI3D] [int] NULL,
	[Schnellzugriff] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungGruppenPersonen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungGruppenPersonen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TerminplanungGruppenI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungOffeneArbeiten]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungOffeneArbeiten](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenI3D] [int] NULL,
	[AuszufuehrendeArbeiten] [text] NULL,
	[ErstelltvonI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungOffeneArbeitenPerson]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungOffeneArbeitenPerson](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TerminplanungOffeneArbeitenI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungStatus]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungStatus](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](255) NULL,
	[Active] [int] NULL,
 CONSTRAINT [PK_TerminplanungStatus] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungUrlaube]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungUrlaube](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[Status] [int] NULL,
	[ToDoI3D] [int] NULL,
	[Art] [int] NULL,
	[Kommentar] [varchar](500) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungUrlaubstage]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungUrlaubstage](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TerminplanungUrlaubeI3D] [int] NULL,
	[TerminplanungI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungUrlaubstageLog]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungUrlaubstageLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TerminplanungUrlaubstageI3D] [int] NULL,
	[Status] [int] NULL,
	[TerminBeginn] [datetime] NULL,
	[TerminEnde] [datetime] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungWebsuiteKalenderTemp]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungWebsuiteKalenderTemp](
	[nidentid] [int] NOT NULL,
	[nlfdevent] [int] NOT NULL,
	[szelle] [ntext] NOT NULL,
	[nanzbelegt] [int] NOT NULL,
	[ndatum] [nvarchar](56) NOT NULL,
	[nbelegt] [float] NOT NULL,
	[nanzspalten] [int] NOT NULL,
	[nposbelegt] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungZyklischeTermine]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungZyklischeTermine](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[BeginnDatum] [datetime] NULL,
	[EndDatum] [datetime] NULL,
	[ObjektArt] [int] NULL,
	[ObjektI3D] [int] NULL,
	[Intervall] [int] NULL,
	[IntervallZyklus] [int] NULL,
	[DurchDienstAnlegen] [int] NULL,
	[TageZuvorAnlegen] [int] NULL,
	[Text] [varchar](500) NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TerminplanungZyklischeTerminePersonal]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TerminplanungZyklischeTerminePersonal](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TerminplanungZyklischeTermineI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[GeaendertVersion] [varchar](20) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[test]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[test](
	[i3d1] [int] IDENTITY(1,1) NOT NULL,
	[i3d2] [int] NOT NULL,
	[text] [char](10) NULL,
 CONSTRAINT [PK_test] PRIMARY KEY CLUSTERED 
(
	[i3d1] ASC,
	[i3d2] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Textbaustein]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Textbaustein](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [text] NULL,
	[Art] [int] NULL,
	[Status] [int] NULL,
	[SichbenuI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[RichText] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Textformatierung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Textformatierung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Fett] [int] NULL,
	[Groesse] [int] NULL,
	[Stretched] [int] NULL,
	[Drucken] [int] NULL,
	[Ausrichtung] [int] NULL,
	[andereGroesse] [int] NULL,
	[Farbe] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketPattern]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketPattern](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[Caption] [nvarchar](255) NOT NULL,
	[BelongsToObjectI3D] [int] NULL,
	[BelongsToObjectKind] [int] NULL,
	[PriorityI3D] [int] NULL,
	[TypeI3D] [int] NULL,
	[MainCategoryI3D] [int] NULL,
	[SubCategory1I3D] [int] NULL,
	[SubCategory2I3D] [int] NULL,
	[TicketStatusI3D] [int] NULL,
	[FreeFlag1] [bit] NULL,
	[IsRMA] [bit] NULL,
	[ShortDescription] [nvarchar](1000) NULL,
	[CustomerI3D] [int] NULL,
	[AddressI3D] [int] NULL,
	[AddressContactI3D] [int] NULL,
	[ContractI3D] [int] NULL,
	[DepartmentI3D] [int] NULL,
	[CustomerName] [nvarchar](200) NULL,
	[Tags] [nvarchar](1000) NULL,
	[Description] [nvarchar](max) NULL,
	[InternalNote] [nvarchar](max) NULL,
	[ResponsiblePersonI3D] [int] NULL,
	[PatternCategoryI3D] [int] NULL,
	[PatternCategoryName] [nvarchar](1000) NULL,
	[PatternDescription] [nvarchar](2000) NULL,
	[Image] [image] NULL,
	[DefaultMappingRuleType] [int] NULL,
	[IsPublic] [bit] NULL,
	[IsGlobal] [bit] NULL,
	[IsInternal] [bit] NULL,
	[ArticleI3D] [int] NULL,
	[TicketPatternType] [int] NULL,
	[PlannedDurationInHours] [float] NULL,
	[AccountCustomFilterI3D] [int] NULL,
	[RequiredDocumentTypes] [int] NOT NULL,
	[DurationInDays] [int] NOT NULL,
	[MaterialGroupI3D] [int] NULL,
	[SecondaryMaterialGroupI3D] [int] NULL,
	[ReceiptTemplateI3D] [int] NULL,
	[BlockPurchasing] [bit] NULL,
	[AttachReceipt] [bit] NULL,
	[Version] [nvarchar](100) NULL,
	[AdditionalText2] [nvarchar](100) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketPatternCustomerMappings]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketPatternCustomerMappings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketPatternI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[AddressI3D] [int] NULL,
	[AddressContactI3D] [int] NULL,
	[AccountCustomFilterI3D] [int] NULL,
	[RuleType] [int] NOT NULL,
	[DisplayText] [nvarchar](100) NULL,
 CONSTRAINT [PK_TicketPatternCustomerMappings] PRIMARY KEY NONCLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [CL_TicketPatternCustomerMappings]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE CLUSTERED INDEX [CL_TicketPatternCustomerMappings] ON [dbo].[TicketPatternCustomerMappings]
(
	[TicketPatternI3D] ASC,
	[CustomerI3D] ASC,
	[AddressContactI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketPatternRBChecklistWorkplans]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketPatternRBChecklistWorkplans](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketPatternI3D] [int] NOT NULL,
	[RBChecklistWorkplanI3D] [int] NULL,
	[CentronChecklistI3D] [int] NULL,
 CONSTRAINT [PK_TicketPatternRBChecklistWorkplans] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketProcessTemplateFolder]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketProcessTemplateFolder](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
	[ParentFolderI3D] [int] NULL,
 CONSTRAINT [PK_TicketProcessTemplateFolder] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketProjectDependencies]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketProjectDependencies](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Type] [int] NOT NULL,
	[TicketProjectI3D] [int] NOT NULL,
	[PredecessorObjectKind] [int] NOT NULL,
	[PredecessorObjectI3D] [int] NOT NULL,
	[SuccessorObjectKind] [int] NOT NULL,
	[SuccessorObjectI3D] [int] NOT NULL,
 CONSTRAINT [PK_TicketProjectDependencies] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketProjectLogs]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketProjectLogs](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](100) NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[MetaData] [nvarchar](max) NULL,
	[LogLevel] [int] NULL,
	[EventType] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[TicketProjectI3D] [int] NOT NULL,
	[TicketProjectTaskI3D] [int] NULL,
 CONSTRAINT [PK_TicketProjectLogs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketProjectMessages]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketProjectMessages](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketProjectI3D] [int] NOT NULL,
	[ObjectKind] [int] NOT NULL,
	[ObjectI3D] [int] NOT NULL,
	[Message] [nvarchar](4000) NOT NULL,
	[ReadBy] [nvarchar](1000) NULL,
	[SentByEmployeeI3D] [int] NOT NULL,
	[CreatedDate] [datetime2](0) NOT NULL,
	[SentTo] [nvarchar](1000) NULL,
 CONSTRAINT [PK_TicketProjectMessages] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketProjects]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketProjects](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ShortDescription] [nvarchar](1000) NOT NULL,
	[PlannedStartDate] [datetime2](0) NULL,
	[PlannedEndDate] [datetime2](0) NULL,
	[ProgressInPercent] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[OrderI3D] [int] NULL,
	[Status] [int] NOT NULL,
	[IsTemplate] [bit] NOT NULL,
	[CategoryI3D] [int] NULL,
	[Number] [int] NOT NULL,
	[Description] [nvarchar](max) NULL,
 CONSTRAINT [PK_TicketProjects] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketProjectSettings]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketProjectSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketProjectI3D] [int] NULL,
	[EmployeeI3D] [int] NULL,
	[MondayActive] [bit] NOT NULL,
	[MondayStart] [int] NOT NULL,
	[MondayEnd] [int] NOT NULL,
	[TuesdayActive] [bit] NOT NULL,
	[TuesdayStart] [int] NOT NULL,
	[TuesdayEnd] [int] NOT NULL,
	[WednesdayActive] [bit] NOT NULL,
	[WednesdayStart] [int] NOT NULL,
	[WednesdayEnd] [int] NOT NULL,
	[ThursdayActive] [bit] NOT NULL,
	[ThursdayStart] [int] NOT NULL,
	[ThursdayEnd] [int] NOT NULL,
	[FridayActive] [bit] NOT NULL,
	[FridayStart] [int] NOT NULL,
	[FridayEnd] [int] NOT NULL,
	[SaturdayActive] [bit] NOT NULL,
	[SaturdayStart] [int] NOT NULL,
	[SaturdayEnd] [int] NOT NULL,
	[SundayActive] [bit] NOT NULL,
	[SundayStart] [int] NOT NULL,
	[SundayEnd] [int] NOT NULL,
 CONSTRAINT [PK_TicketProjectSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketProjectTasks]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketProjectTasks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Caption] [nvarchar](1000) NOT NULL,
	[StartDate] [datetime2](0) NOT NULL,
	[EndDate] [datetime2](0) NOT NULL,
	[ParentTaskI3D] [int] NULL,
	[ProjectI3D] [int] NOT NULL,
	[PlannedDurationInMinutes] [int] NULL,
	[ProgressInPercent] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[HelpdeskI3D] [int] NULL,
	[IsTemplate] [bit] NOT NULL,
	[IsActive] [bit] NOT NULL,
	[Description] [nvarchar](max) NULL,
 CONSTRAINT [PK_TicketProjectTasks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TicketTags]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TicketTags](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TicketI3D] [int] NOT NULL,
	[TagI3D] [int] NOT NULL,
	[Caption] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_TicketTags] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TimingSettings]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TimingSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[StartTime] [datetime] NULL,
	[EndTime] [datetime] NULL,
	[Interval] [int] NULL,
	[DaySeedOption] [int] NULL,
	[SelectedDayOption] [int] NULL,
	[Repeat] [bit] NULL,
	[Monday] [bit] NULL,
	[Tuesday] [bit] NULL,
	[Wednesday] [bit] NULL,
	[Thursday] [bit] NULL,
	[Friday] [bit] NULL,
	[Saturday] [bit] NULL,
	[Sunday] [bit] NULL,
 CONSTRAINT [PK_TimingSettings] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Titel]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Titel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Titel] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TobitFaxZuordnung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TobitFaxZuordnung](
	[KundenNummer] [int] NULL,
	[KundenName] [varchar](240) NULL,
	[KundenFax] [varchar](22) NULL,
	[AnschriftNummer] [int] NULL,
	[AnschriftStrasse] [varchar](200) NULL,
	[AnschriftPLZ] [varchar](10) NULL,
	[AnschriftOrt] [varchar](30) NULL,
	[AnsprechNummer] [int] NULL,
	[AnsprechName] [varchar](60) NULL,
	[AnsprechFax] [varchar](30) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ToDoListeEmpfanger]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ToDoListeEmpfanger](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Art] [int] NOT NULL,
	[Ersteller] [int] NOT NULL,
	[Empfanger1] [int] NULL,
	[Empfanger2] [int] NULL,
	[Empfanger3] [int] NULL,
	[Kommentar] [varchar](50) NULL,
	[Text1] [varchar](50) NULL,
	[Text2] [varchar](50) NULL,
	[EskalationTage] [int] NULL,
 CONSTRAINT [PK_ToDoListeEmpfanger] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC,
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ToDoListeEmpfangerGrup]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ToDoListeEmpfangerGrup](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ToDoListeEmpfangerI3D] [int] NOT NULL,
	[SichGrupI3D] [int] NULL,
 CONSTRAINT [PK_ToDoListeEmpfangerGrup] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC,
	[ToDoListeEmpfangerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ToDoListeEmpfangerPers]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ToDoListeEmpfangerPers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ToDoListeEmpfangerI3D] [int] NOT NULL,
	[PersonalI3D] [int] NULL,
	[Eskalation] [int] NULL,
 CONSTRAINT [PK_ToDoListeEmpfangerPers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC,
	[ToDoListeEmpfangerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ToDoListeGruppen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ToDoListeGruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ToDoListeI3D] [int] NOT NULL,
	[SichGrupI3D] [int] NULL,
 CONSTRAINT [PK_ToDoListeGruppen] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC,
	[ToDoListeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ToDoListePersonal]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ToDoListePersonal](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ToDoListeI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
 CONSTRAINT [PK_ToDoListePersonal] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TransactionDetailDocuments]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TransactionDetailDocuments](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[TransactionDetailI3D] [int] NOT NULL,
	[Document] [varbinary](max) NOT NULL,
 CONSTRAINT [PK_TransactionDetailDocuments] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TransactionDetails]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TransactionDetails](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Category] [int] NOT NULL,
	[TransactionI3D] [int] NOT NULL,
	[Auto] [int] NULL,
	[Caption] [nvarchar](max) NOT NULL,
	[Price] [decimal](18, 2) NOT NULL,
	[VATI3D] [int] NULL,
	[FacilityName] [nvarchar](4000) NULL,
	[ReceiptNumber] [nvarchar](4000) NOT NULL,
	[CostCenterI3D] [int] NULL,
	[CostObjectI3D] [int] NULL,
	[AccountI3D] [int] NULL,
	[Image] [varbinary](max) NOT NULL,
	[TranDetailStatus] [int] NULL,
	[ReceiptDate] [datetime] NULL,
 CONSTRAINT [PK_TransactionDetails] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Transactions]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Transactions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CreatedBy] [int] NOT NULL,
	[Name] [nvarchar](200) NOT NULL,
	[Comment] [nvarchar](4000) NULL,
	[DateCreated] [datetime] NOT NULL,
	[DateUpdated] [datetime] NULL,
	[Price] [decimal](18, 2) NOT NULL,
	[Status] [int] NOT NULL,
	[TransactionNumber] [int] NOT NULL,
 CONSTRAINT [PK_Transaction] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TravelExpenseCategories]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TravelExpenseCategories](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](200) NULL,
	[Description] [nvarchar](4000) NULL,
	[Icon] [varbinary](max) NULL,
	[Account] [int] NULL,
	[CreatedDate] [datetime] NOT NULL,
	[CreatedBy] [int] NULL,
	[ChangedDate] [datetime] NULL,
	[IsDeactivated] [bit] NOT NULL,
	[ParentCategoryI3D] [int] NULL,
	[DefaultVATI3D] [int] NULL,
 CONSTRAINT [PK_TravelExpenseCategories] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TwoFactorAuthLastLogins]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TwoFactorAuthLastLogins](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[UserKind] [nvarchar](100) NOT NULL,
	[UserI3D] [int] NOT NULL,
	[ApplicationName] [nvarchar](100) NOT NULL,
	[MachineName] [nvarchar](100) NOT NULL,
	[IpAddress] [nvarchar](100) NOT NULL,
	[LastLogin] [datetime2](0) NOT NULL,
 CONSTRAINT [PK_TwoFactorAuthLastLogins] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Umweltschutz]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Umweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](150) NULL,
	[Beschreibung] [text] NULL,
	[Bild] [image] NULL,
 CONSTRAINT [PK_Umweltschutz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Unterwarenaufschlaege]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Unterwarenaufschlaege](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[UnterwarengruppeI3D] [int] NULL,
	[bisEK] [float] NULL,
	[VK1Prozent] [float] NULL,
	[VK2Prozent] [float] NULL,
	[VK3Prozent] [float] NULL,
	[VK4Prozent] [float] NULL,
	[AufschlagEVKProzent] [float] NULL,
	[AufschlagMindestpreisProzent] [float] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Unterweisungen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Unterweisungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Aktiv] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](5000) NULL,
	[BeschreibungMa] [varchar](5000) NULL,
	[Bild] [image] NULL,
	[ErstelltAm] [datetime] NULL,
	[ErstelltVon] [int] NULL,
	[Unterweiser] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[UpdateInfo]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UpdateInfo](
	[I3D] [int] NOT NULL,
	[Art] [int] NULL,
	[Text] [text] NULL,
	[Version] [int] NULL,
 CONSTRAINT [PK_UpdateInfo] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[UserHelpdeskData]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[UserHelpdeskData](
	[HelpdeskI3D] [int] NOT NULL,
	[EmployeeI3D] [int] NOT NULL,
	[WebAccountI3D] [int] NOT NULL,
	[LastSeenComment] [datetime2](0) NULL,
	[LastSeenEmail] [datetime2](0) NULL,
	[ChangedDate] [datetime2](0) NOT NULL,
 CONSTRAINT [PK_UserHelpdeskData] PRIMARY KEY CLUSTERED 
(
	[HelpdeskI3D] ASC,
	[EmployeeI3D] ASC,
	[WebAccountI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Var1AnlageControlling]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Var1AnlageControlling](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Angebot] [int] NULL,
	[Auftrag] [int] NULL,
	[Lieferschein] [int] NULL,
	[Abholschein] [int] NULL,
	[Gutschrift] [int] NULL,
	[Rechnung] [int] NULL,
	[Text] [varchar](500) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Versandart]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Versandart](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_Versandart] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Versandtabelle]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Versandtabelle](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VersandartI3D] [int] NULL,
	[Code] [varchar](50) NULL,
	[GewichtVon] [float] NULL,
	[GewichtBis] [float] NULL,
	[Preis] [float] NULL,
 CONSTRAINT [PK_Versandtabelle] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Vertiebssteuerung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Vertiebssteuerung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Kurztext] [varchar](30) NULL,
	[Langtext] [varchar](250) NULL,
 CONSTRAINT [PK_Vertiebssteuerung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Vertraege]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Vertraege](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundeI3D] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](300) NULL,
	[ArtI3D] [int] NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[Bemerkungen] [text] NULL,
	[Prioritaet] [int] NULL,
	[Pauschal] [int] NULL,
	[SNErforderlich] [int] NULL,
	[Bereich1Std] [int] NULL,
	[Bereich2Std] [int] NULL,
	[Bereich3Std] [int] NULL,
	[StundenGes] [float] NULL,
	[KostenGes] [float] NULL,
	[AnfahrtArtikelI3D] [int] NULL,
	[AnfahrtPreis] [float] NULL,
 CONSTRAINT [PK_Vertraege] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragAenderungsart]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragAenderungsart](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragArtikel]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Preis1] [float] NULL,
	[Preis2] [float] NULL,
	[Preis3] [float] NULL,
	[StundenGes] [float] NULL,
	[KostenGes] [float] NULL,
	[Bereich] [int] NULL,
	[Preis] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragBepreisungArt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragBepreisungArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ItemIndex] [int] NULL,
	[Text] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragBepreisungArtikel]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragBepreisungArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[WarenI3D] [int] NULL,
	[UnterwarenI3D] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheitID] [int] NULL,
	[BSEinheit] [varchar](10) NULL,
	[GewichtProEinheit] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[GewichtGesamt] [varchar](20) NULL,
	[VKKalk] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[EK] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Stk] [float] NULL,
	[Art] [int] NULL,
	[Visible] [int] NULL,
	[MwstSatz] [float] NULL,
	[MwstI3D] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Status] [int] NULL,
	[Text] [varchar](8000) NULL,
	[Aenderungsart] [int] NULL,
	[Aenderungswert] [float] NULL,
	[Aenderungsweise] [int] NULL,
	[EVK] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragBepreisungWaren]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragBepreisungWaren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WarenI3D] [int] NULL,
	[UnterwarenI3D] [int] NULL,
	[Aenderungsart] [int] NULL,
	[Aenderungswert] [float] NULL,
	[Aenderungsweise] [int] NULL,
	[VertragI3D] [int] NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragBepreisungWeise]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragBepreisungWeise](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ItemIndex] [int] NULL,
	[Text] [varchar](10) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragKontingent]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKontingent](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragI3D] [int] NULL,
	[Bezeichnung] [varchar](60) NULL,
	[Rechnungsbestand] [float] NULL,
	[Kontingentart] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragKontingentart]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKontingentart](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragKontingentEinstellungen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKontingentEinstellungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KontingentGegenstandI3D] [int] NULL,
	[Kontingentart] [varchar](50) NULL,
	[Staffelungsart] [int] NULL,
	[Betragaenderung] [float] NULL,
	[Anzahl] [float] NULL,
	[Status] [int] NULL,
	[Aenderungsart] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragKontingentGegenstand]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKontingentGegenstand](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragKontingentI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[Artikelbeschreibung] [varchar](8000) NULL,
	[WarenI3D] [int] NULL,
	[UnterwarenI3D] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheitID] [int] NULL,
	[BSEinheit] [varchar](10) NULL,
	[GewichtProEinheit] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[GewichtGesamt] [varchar](20) NULL,
	[VKKalk] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[EK] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Stk] [float] NULL,
	[Art] [int] NULL,
	[Visible] [int] NULL,
	[MwstSatz] [float] NULL,
	[MwstI3D] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Status] [int] NULL,
	[Text] [varchar](8000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragKopfErweitert]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKopfErweitert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragKopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[MailMusterArt] [int] NULL,
	[Betreff] [varchar](100) NULL,
	[Mailbody] [text] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragKopfErweitertVersions]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKopfErweitertVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragKopfI3D] [int] NULL,
	[Beschreibung] [text] NULL,
	[OriginalI3D] [int] NULL,
	[Version] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragKopfZaehlerFreistueck]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragKopfZaehlerFreistueck](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragKopfI3D] [int] NULL,
	[ZaehlerArtI3D] [int] NULL,
	[Freistueck] [int] NULL,
	[Status] [int] NULL,
	[Preis] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragPosWartung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragPosWartung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungArt] [int] NULL,
	[VertragKopfI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](8000) NULL,
	[Freitext] [varchar](1000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNr] [int] NULL,
	[GutAbholArt] [int] NULL,
	[GutAbholNr] [int] NULL,
	[numGutAbhol] [float] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[StkStaffelpreis] [float] NULL,
	[VKKalkStaffelpreis] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragPosZaehler]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragPosZaehler](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragPosI3D] [int] NULL,
	[AktuellerStand] [int] NULL,
	[AktuellerStandDatum] [datetime] NULL,
	[Freistueck] [int] NULL,
	[FreistueckAdditiv] [int] NULL,
	[GeraeteClickZaehlerI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragPosZaehlerBepreisung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragPosZaehlerBepreisung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragPosI3D] [int] NULL,
	[PreisGueltigAbStk] [int] NULL,
	[Preis] [float] NULL,
	[VertragPosZaehlerI3D] [int] NULL,
	[GeraeteClickZaehlerI3D] [int] NULL,
	[Status] [int] NULL,
	[EK] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragProv]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragProv](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragKopfI3D] [int] NOT NULL,
	[VertragNummer] [int] NOT NULL,
	[PersonalI3D] [int] NOT NULL,
	[Provision] [float] NULL,
	[Standard] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragsArtBepreisungArtikel]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragsArtBepreisungArtikel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragsArtI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[WarenI3D] [int] NULL,
	[UnterwarenI3D] [int] NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheitID] [int] NULL,
	[BSEinheit] [varchar](10) NULL,
	[GewichtProEinheit] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[GewichtsEinheit] [int] NULL,
	[GewichtGesamt] [varchar](20) NULL,
	[VKKalk] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[EK] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Stk] [float] NULL,
	[Art] [int] NULL,
	[Visible] [int] NULL,
	[MwstSatz] [float] NULL,
	[MwstI3D] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Status] [int] NULL,
	[Text] [varchar](8000) NULL,
	[Aenderungsart] [int] NULL,
	[Aenderungswert] [float] NULL,
	[Aenderungsweise] [int] NULL,
	[EVK] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragsArtBepreisungWaren]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragsArtBepreisungWaren](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WarenI3D] [int] NULL,
	[UnterwarenI3D] [int] NULL,
	[Aenderungsart] [int] NULL,
	[Aenderungswert] [float] NULL,
	[Aenderungsweise] [int] NULL,
	[VertragsArtI3D] [int] NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragsArtKategorie]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragsArtKategorie](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](60) NULL,
	[Status] [int] NULL,
	[ErstelltVersion] [varchar](20) NULL,
	[Erstelltdatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[GeandertVersion] [varchar](20) NULL,
	[GeandertDatum] [datetime] NULL,
	[GeandertVonI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragsArtPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragsArtPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VertragArtI3D] [int] NOT NULL,
	[Pos] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[Code] [varchar](60) NULL,
	[HerstCode] [varchar](100) NULL,
	[Text] [varchar](8000) NULL,
	[Freitext] [varchar](5000) NULL,
	[Stk] [float] NULL,
	[EK] [float] NULL,
	[VKKalk] [float] NULL,
	[Rabatt] [float] NULL,
	[SummeKalk] [float] NULL,
	[VKDruck] [float] NULL,
	[SummeDruck] [float] NULL,
	[GrpID] [int] NULL,
	[GrpBegEnd] [int] NULL,
	[Art] [int] NULL,
	[BlockID] [int] NULL,
	[MwstSatz] [float] NULL,
	[Abbuchung] [int] NULL,
	[Ursprung] [int] NULL,
	[UrsprungI3D] [int] NULL,
	[UrsprungArt] [int] NULL,
	[UrsprungNr] [int] NULL,
	[GutAbholArt] [int] NULL,
	[GutAbholNr] [int] NULL,
	[numGutAbhol] [float] NULL,
	[Farbe] [int] NULL,
	[FontStyle] [int] NULL,
	[FontSize] [int] NULL,
	[FontName] [varchar](30) NULL,
	[FontColor] [int] NULL,
	[Expanded] [int] NULL,
	[Visible] [int] NULL,
	[Indent] [int] NULL,
	[StuecklisteI3D] [int] NULL,
	[Import] [int] NULL,
	[MwstI3D] [int] NULL,
	[VertragI3D] [int] NULL,
	[ZeitI3D] [int] NULL,
	[Bestellnummer] [varchar](50) NULL,
	[VertragArt] [int] NULL,
	[LaengePro] [float] NULL,
	[BreitePro] [float] NULL,
	[HoehePro] [float] NULL,
	[NettogewichtPro] [float] NULL,
	[BruttogewichtPro] [float] NULL,
	[SpezGewichtPro] [float] NULL,
	[Beschaffenheit] [int] NULL,
	[Kostenstelle] [int] NULL,
	[Kostentraeger] [int] NULL,
	[NebenlagerI3D] [int] NULL,
	[ErloesKTO] [int] NULL,
	[BestellNr] [varchar](50) NULL,
	[BestellPos] [int] NULL,
	[MengePro] [float] NULL,
	[UrsprungEK] [float] NULL,
	[SondervereinbarungI3D] [int] NULL,
	[EKGrund] [varchar](1000) NULL,
	[BSLaenge] [float] NULL,
	[BSBreite] [float] NULL,
	[BSHoehe] [float] NULL,
	[BSEinheit] [varchar](10) NULL,
	[BSEinheitID] [int] NULL,
	[GeraeteBarcodeI3D] [int] NULL,
	[BSGewicht] [float] NULL,
	[BSGewichtStk] [float] NULL,
	[BSGewichtseinheit] [varchar](10) NULL,
	[BSGewichtseinheitID] [int] NULL,
	[EANCode] [varchar](70) NULL,
	[StkStorno] [float] NULL,
	[SummeKalkStorno] [float] NULL,
	[VertragI3DAutoRechnung] [int] NULL,
	[HelpdeskI3D] [int] NULL,
	[Richtext] [text] NULL,
	[StkStaffelpreis] [float] NULL,
	[VKKalkStaffelpreis] [float] NULL,
	[Lieferdatum] [datetime] NULL,
	[Benachrichtigungsdatum] [datetime] NULL,
	[LieferdatumToDoI3D] [int] NULL,
	[BenachrichtigungsdatumToDoI3D] [int] NULL,
	[SNStueckliste] [int] NULL,
	[SNStuecklistePos] [int] NULL,
	[WEEE] [varchar](100) NULL,
	[WEEEPflicht] [int] NULL,
	[EVK] [float] NULL,
	[EVP] [float] NULL,
	[Produktlinie] [varchar](50) NULL,
	[Listenpreis] [float] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Status] [int] NULL,
	[VKBasisWert] [float] NULL,
	[Artikelpositionsart] [int] NULL,
	[numBarcodes] [int] NULL,
	[EKBasis] [int] NULL,
	[VKBasis] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertragStaffelungsart]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertragStaffelungsart](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](50) NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VertreterPLZ]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VertreterPLZ](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[PLZVon] [varchar](20) NULL,
	[PLZBis] [varchar](20) NULL,
	[AbteilungI3D] [int] NULL,
 CONSTRAINT [PK_VertreterPLZ] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VideoPortalAssignment]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VideoPortalAssignment](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[VideoDirectoryID] [int] NOT NULL,
	[VideoDirectoryName] [nvarchar](50) NOT NULL,
	[EmployeeI3D] [int] NULL,
	[AssignedByEmployeeI3D] [int] NULL,
	[WatchUntilDate] [datetime2](7) NOT NULL,
	[AssignedAt] [datetime2](7) NOT NULL,
	[ChangedByEmployeeI3D] [int] NOT NULL,
	[ChangedAt] [datetime2](7) NOT NULL,
 CONSTRAINT [PK_VideoPortalAssignment] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WahrscheinlichkeitsKlassifizierung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WahrscheinlichkeitsKlassifizierung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](100) NULL,
	[Status] [int] NULL,
	[Value] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Warenaufschlaege]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Warenaufschlaege](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WarengruppeI3D] [int] NULL,
	[bisEK] [float] NULL,
	[VK1Prozent] [float] NULL,
	[Vk2Prozent] [float] NULL,
	[VK3Prozent] [float] NULL,
	[VK4Prozent] [float] NULL,
	[AufschlagEVKProzent] [float] NULL,
	[AufschlagMindestpreisProzent] [float] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WareneingangPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WareneingangPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Materialnr] [char](35) NULL,
	[Herstellercode] [char](35) NULL,
	[Liefmenge] [char](15) NULL,
	[Liefqualifier] [char](10) NULL,
	[Auftragsnr] [char](15) NULL,
	[Auftragspos] [char](6) NULL,
	[Serialnr] [char](20) NULL,
	[Shipunit] [char](20) NULL,
	[BestPosI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Wartung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Wartung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplatzI3D] [int] NULL,
	[FahrzeugI3D] [int] NULL,
	[PrufmittelI3D] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Objekt] [varchar](150) NULL,
	[Wartungsarbeit] [varchar](150) NULL,
	[Version] [int] NULL,
	[Intervall] [int] NULL,
	[IntervallArt] [int] NULL,
	[VorlaufIntervall] [int] NULL,
	[VorlaufIntervallArt] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Zuletzt] [datetime] NULL,
	[Faellig] [datetime] NULL,
	[Beschreibung] [varchar](5000) NULL,
	[AngelegtAm] [datetime] NULL,
	[AngelegtVon] [int] NULL,
	[ZuletztKMStand] [int] NULL,
	[FaelligKMStand] [int] NULL,
	[Intervall2] [int] NULL,
	[Status] [int] NULL,
	[ZuletztBei] [int] NULL,
	[FaelligBei] [int] NULL,
	[ScanDocI3D] [int] NULL,
	[IntervallText] [varchar](50) NULL,
	[Memo] [varchar](500) NULL,
	[RechnungTemplateI3D] [int] NULL,
	[IntervallText1] [varchar](50) NULL,
	[Aktiv] [int] NULL,
	[ToDOListeI3D] [int] NULL,
 CONSTRAINT [PK_Wartung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungArbeitssicherheit]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungArbeitssicherheit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungI3D] [int] NULL,
	[ArbeitssicherheitI3D] [int] NULL,
 CONSTRAINT [PK_WartungArbeitssicherheit] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungHistory]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungHistory](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungI3D] [int] NULL,
	[ArbeitsplatzI3D] [int] NULL,
	[FahrzeugI3D] [int] NULL,
	[PrufmittelI3D] [int] NULL,
	[GeraeteKopfI3D] [int] NULL,
	[Objekt] [varchar](150) NULL,
	[Wartungsarbeit] [varchar](150) NULL,
	[Version] [int] NULL,
	[Intervall] [int] NULL,
	[IntervallArt] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Zuletzt] [datetime] NULL,
	[Faellig] [datetime] NULL,
	[Beschreibung] [text] NULL,
	[Datum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[Memo] [varchar](500) NULL,
	[RechKopfI3D] [int] NULL,
	[Bemerkungen] [varchar](100) NULL,
	[BearbeitetAm] [datetime] NULL,
	[IntervallText] [varchar](50) NULL,
 CONSTRAINT [PK_WartungHistory] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungHistoryArbeitssicherheit]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungHistoryArbeitssicherheit](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungHistoryI3D] [int] NULL,
	[ArbeitssicherheitI3D] [int] NULL,
 CONSTRAINT [PK_WartungHistoryArbeitssicherheit] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungHistoryMesswert]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungHistoryMesswert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungHistoryI3D] [int] NULL,
	[Messwert] [varchar](150) NULL,
	[Ergebnis] [float] NULL,
	[Einheit] [varchar](150) NULL,
	[Vorgabe] [float] NULL,
	[MaxAbweichung] [float] NULL,
 CONSTRAINT [PK_WartungHistoryMesswert] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungHistoryPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungHistoryPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungHistoryI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[ArtikelTextI3D] [int] NULL,
	[ArtikelPreisI3D] [int] NULL,
	[ArtikelEinheitI3D] [int] NULL,
	[Stk] [float] NULL,
	[TatsStk] [float] NULL,
	[ArtikelCode] [varchar](50) NULL,
	[ArtikelBeschreibung] [varchar](300) NULL,
 CONSTRAINT [PK_WartungHistoryPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungHistoryPruflinge]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungHistoryPruflinge](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungHistoryI3D] [int] NULL,
	[PruflingeI3D] [int] NULL,
 CONSTRAINT [PK_WartungHistoryPruflinge] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungHistoryPrufmittel]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungHistoryPrufmittel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungHistoryI3D] [int] NULL,
	[PrufmittelI3D] [int] NULL,
 CONSTRAINT [PK_WartungHistoryPrufmittel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungHistoryUmweltschutz]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungHistoryUmweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungHistoryI3D] [int] NULL,
	[UmweltschutzI3D] [int] NULL,
 CONSTRAINT [PK_WartungHistoryUmweltschutz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungMesswert]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungMesswert](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungI3D] [int] NULL,
	[Messwert] [varchar](150) NULL,
	[Einheit] [varchar](150) NULL,
	[Vorgabe] [float] NULL,
	[MaxAbweichung] [float] NULL,
 CONSTRAINT [PK_WartungMesswert] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungI3D] [int] NULL,
	[ArtikelI3D] [int] NULL,
	[ArtikelTextI3D] [int] NULL,
	[ArtikelPreisI3D] [int] NULL,
	[ArtikelEinheitI3D] [int] NULL,
	[Stk] [float] NULL,
	[ArtikelCode] [varchar](50) NULL,
	[ArtikelBeschreibung] [varchar](300) NULL,
 CONSTRAINT [PK_WartungPos] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungPruflinge]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungPruflinge](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungI3D] [int] NULL,
	[PruflingeI3D] [int] NULL,
 CONSTRAINT [PK_WartungPruflinge] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungPrufmittel]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungPrufmittel](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungI3D] [int] NULL,
	[PrufmittelI3D] [int] NULL,
 CONSTRAINT [PK_WartungPrufmittel] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungsIntervallArt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungsIntervallArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Kurz] [varchar](50) NULL,
 CONSTRAINT [PK_WartungsIntervallArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungUmweltschutz]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungUmweltschutz](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WartungI3D] [int] NULL,
	[UmweltschutzI3D] [int] NULL,
 CONSTRAINT [PK_WartungUmweltschutz] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungUntergruppen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungUntergruppen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WartungVersions]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WartungVersions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArbeitsplatzI3D] [int] NULL,
	[FahrzeugI3D] [int] NULL,
	[Wartungsarbeit] [varchar](50) NULL,
	[Version] [int] NULL,
	[Intervall] [int] NULL,
	[IntervallArt] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Zuletzt] [datetime] NULL,
	[Faellig] [datetime] NULL,
	[Beschreibung] [text] NULL,
 CONSTRAINT [PK_WartungVersions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WasabiCredentials]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WasabiCredentials](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](250) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Email] [nvarchar](150) NOT NULL,
	[AccessKey] [nvarchar](300) NOT NULL,
	[SecretKey] [nvarchar](300) NOT NULL,
 CONSTRAINT [PK_WasabiCredentials] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebAccounts]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebAccounts](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NOT NULL,
	[Type] [int] NOT NULL,
	[TypeI3D] [int] NOT NULL,
	[Username] [varchar](100) NOT NULL,
	[Password] [varchar](100) NOT NULL,
	[LastLoginIP] [varchar](100) NULL,
	[LastLoginDate] [datetime] NULL,
	[KundenI3D] [int] NULL,
	[AnschriftI3D] [int] NULL,
	[PersonenI3D] [int] NULL,
	[AccountI3D] [int] NULL,
	[AccountAddressI3D] [int] NULL,
	[AccountAddressContactI3D] [int] NULL,
	[CreatedByI3D] [int] NULL,
	[CreatedDate] [datetime] NULL,
	[CreatedVersion] [varchar](16) NULL,
	[ChangedByI3D] [int] NULL,
	[ChangedDate] [datetime] NULL,
	[ChangedVersion] [varchar](16) NULL,
	[UseTwoFactorAuthentication] [bit] NOT NULL,
	[TwoFactorValidDurationInDays] [int] NULL,
	[LastTwoFactorValidatedAt] [datetime2](7) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebAccountsRights]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebAccountsRights](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WebAccountsI3D] [int] NULL,
	[WebRightsI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebForms]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebForms](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Guid] [uniqueidentifier] NOT NULL,
	[Title] [nvarchar](255) NULL,
	[Description] [nvarchar](max) NULL,
	[ConfigurationString] [nvarchar](max) NULL,
	[TicketPatternI3D] [int] NULL,
	[AddressContactI3D] [int] NULL,
	[AddressI3D] [int] NULL,
	[CustomerI3D] [int] NULL,
	[Published] [bit] NOT NULL,
	[Active] [bit] NOT NULL,
	[SBOUrl] [nvarchar](255) NULL,
	[CreatedAt] [datetime2](0) NULL,
	[Footer] [nvarchar](max) NULL,
	[SubDescription] [nvarchar](max) NULL,
 CONSTRAINT [PK_WebForms] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebFormsSelfCareForms]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebFormsSelfCareForms](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SelfCareFormI3D] [int] NOT NULL,
	[WebFormI3D] [int] NOT NULL,
 CONSTRAINT [PK_WebFormsSelfCareForms] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebHDQuestions]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebHDQuestions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[customerI3D] [int] NULL,
	[text] [text] NOT NULL,
	[standard] [bit] NULL,
	[customerOrigin] [int] NULL,
 CONSTRAINT [PK_WebHDQuestions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WEBKategorien]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WEBKategorien](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](50) NULL,
 CONSTRAINT [PK_WEBKategorien] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebKunden]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebKunden](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Firma] [varchar](250) NULL,
	[Name] [varchar](250) NULL,
	[Strasse] [varchar](250) NULL,
	[PLZ] [varchar](50) NULL,
	[Ort] [varchar](250) NULL,
	[Telefon] [varchar](250) NULL,
	[Fax] [varchar](250) NULL,
	[EMail] [varchar](250) NULL,
	[WWW] [varchar](250) NULL,
	[ErstelltAm] [datetime] NULL,
	[Ip] [varchar](50) NULL,
 CONSTRAINT [PK_WebKunden] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebLinkActions]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebLinkActions](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WebLinkGroupI3D] [int] NOT NULL,
	[Type] [int] NOT NULL,
	[Options] [nvarchar](max) NULL,
	[Done] [bit] NOT NULL,
	[DoneDate] [datetime] NULL,
 CONSTRAINT [PK_WebLinkActions] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebLinkClicks]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebLinkClicks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WebLinkI3D] [int] NOT NULL,
	[Date] [datetime2](0) NOT NULL,
 CONSTRAINT [PK_WebLinkClicks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebLinkGroups]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebLinkGroups](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NULL,
	[Caption] [nvarchar](400) NOT NULL,
	[ForwardToLink] [nvarchar](2048) NOT NULL,
	[AlternativeLink] [nvarchar](2048) NULL,
	[StartDate] [datetime2](0) NULL,
	[EndDate] [datetime2](0) NULL,
	[State] [int] NOT NULL,
	[WebSiteContent] [nvarchar](max) NULL,
	[Guid] [uniqueidentifier] NOT NULL,
	[IsLandingPage] [bit] NOT NULL,
	[Description] [nvarchar](200) NULL,
 CONSTRAINT [PK_WebLinkGroups] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebLinks]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebLinks](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WebLinkGroupI3D] [int] NOT NULL,
	[Guid] [uniqueidentifier] NOT NULL,
	[ObjectI3D] [int] NULL,
	[ObjectKind] [int] NULL,
	[AccountAddressContactI3D] [int] NULL,
 CONSTRAINT [PK_WebLinks] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebLog]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebLog](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Username] [varchar](100) NULL,
	[Password] [varchar](100) NULL,
	[RemoteIP] [varchar](50) NULL,
	[LoginDate] [datetime] NULL,
	[UserI3D] [int] NULL,
	[Message] [varchar](255) NULL,
	[PersonalI3D] [int] NULL,
	[WebAccountI3D] [int] NULL,
	[Failed] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebMenuConfig]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebMenuConfig](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Position] [int] NOT NULL,
	[Caption] [nvarchar](256) NOT NULL,
	[Target] [nvarchar](256) NOT NULL,
	[ImagePath] [nvarchar](256) NULL,
	[GroupName] [nvarchar](256) NOT NULL,
	[StandardModule] [bit] NOT NULL,
	[StandardNr] [int] NULL,
	[MShow] [bit] NULL,
	[BlockShow] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebReceiptItemChangeRequests]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebReceiptItemChangeRequests](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ReceiptPdfDocumentI3D] [int] NOT NULL,
	[ReceiptItemI3D] [int] NOT NULL,
	[ChangeRequestKind] [int] NOT NULL,
	[NewQuantity] [int] NULL,
	[ChangeDate] [datetime2](7) NOT NULL,
	[ChangedReceiptItemArticlePositionKind] [int] NULL,
 CONSTRAINT [PK_WebReceiptItemChangeRequests] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 85, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebRequestPages]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebRequestPages](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Guid] [uniqueidentifier] NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Description] [nvarchar](max) NULL,
	[TicketPatternI3D] [int] NOT NULL,
	[AddressContactI3D] [int] NOT NULL,
	[AddressI3D] [int] NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[Color1] [nvarchar](7) NULL,
	[Color2] [nvarchar](7) NULL,
	[Color3] [nvarchar](7) NULL,
	[Color4] [nvarchar](7) NULL,
	[Color5] [nvarchar](7) NULL,
	[Title] [nvarchar](255) NULL,
	[SubTitle] [nvarchar](255) NULL,
	[TitleTop] [int] NOT NULL,
	[TitleLeft] [int] NOT NULL,
	[DescriptionWidth] [int] NULL,
	[FormsWidth] [int] NULL,
	[ShowFormTitles] [bit] NOT NULL,
	[ShowFormDescriptions] [bit] NOT NULL,
	[Logo] [varbinary](max) NULL,
	[Published] [bit] NOT NULL,
	[Active] [bit] NOT NULL,
	[ConfigurationString] [nvarchar](max) NULL,
 CONSTRAINT [PK_WebRequestPages] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebRights]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebRights](
	[I3D] [int] NULL,
	[WebRightsCategoriesI3D] [int] NULL,
	[Type] [int] NULL,
	[Caption] [varchar](250) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebRightsCategories]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebRightsCategories](
	[I3D] [int] NOT NULL,
	[Type] [int] NULL,
	[Caption] [varchar](250) NULL,
 CONSTRAINT [PK_WebRightsCategories] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebSettings]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebSettings](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[WebAccountsI3D] [int] NULL,
	[Startseite] [varchar](128) NULL,
	[AnzahlEintraege] [int] NULL,
	[Helpdesk] [int] NULL,
	[Serviceberichte] [int] NULL,
	[Warenkorb] [int] NULL,
	[Nagios] [int] NULL,
	[Administration] [int] NULL,
	[EMailSignatur] [text] NULL,
	[CCNichtAnzeigen] [int] NULL,
	[BCCNichtAnzeigen] [int] NULL,
	[UpdateAutoCheck] [int] NULL,
	[Reisekosten] [int] NULL,
	[HdFilter] [varchar](8000) NULL,
	[Telemarketing] [int] NULL,
	[Taetigkeiten] [int] NULL,
	[Extras] [int] NULL,
	[Kundensuche] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebSettingsGlobal]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebSettingsGlobal](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[name] [varchar](255) NOT NULL,
	[value] [varchar](255) NOT NULL,
	[description] [varchar](255) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebShopEinstellungen]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebShopEinstellungen](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](100) NULL,
	[WebShopFormat] [int] NULL,
	[Status] [int] NULL,
	[FTPServer] [varchar](100) NULL,
	[FTPVerzeichnis] [varchar](100) NULL,
	[Port] [int] NULL,
	[Passive] [int] NULL,
	[LoginUser] [varchar](100) NULL,
	[LoginPasswort] [varchar](255) NULL,
	[LokalerPfad] [varchar](100) NULL,
	[ErstelltDatum] [datetime] NULL,
	[ErstelltVonI3D] [int] NULL,
	[GeaendertDatum] [datetime] NULL,
	[GeaendertVonI3D] [int] NULL,
	[WebShopArtikel] [int] NULL,
	[ArtikelMitBestand] [int] NULL,
	[ArtikelMitOffenenBestand] [int] NULL,
	[ArtikelMitDistriBestand] [int] NULL,
	[VerkaufspreisI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebShopKopf]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebShopKopf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[Order_ID] [int] NULL,
	[Cust_Order_ID] [varchar](30) NULL,
	[Vorname] [varchar](50) NULL,
	[Nachname] [varchar](50) NULL,
	[TelBuero] [varchar](50) NULL,
	[TelMobil] [varchar](50) NULL,
	[Fax] [varchar](50) NULL,
	[Mail] [varchar](50) NULL,
	[LiefName] [varchar](50) NULL,
	[LiefName2] [varchar](50) NULL,
	[LiefAnrede] [varchar](50) NULL,
	[LiefAnsprechpartner] [varchar](50) NULL,
	[LiefAbteilung] [varchar](50) NULL,
	[LiefStrasse] [varchar](50) NULL,
	[LiefPLZ] [varchar](10) NULL,
	[LiefOrt] [varchar](50) NULL,
	[LiefLand] [varchar](50) NULL,
	[RechName] [varchar](50) NULL,
	[RechName2] [varchar](50) NULL,
	[RechAnrede] [varchar](50) NULL,
	[RechAnsprechpartner] [varchar](50) NULL,
	[RechAbteilung] [varchar](50) NULL,
	[RechStrasse] [varchar](50) NULL,
	[RechPLZ] [varchar](10) NULL,
	[RechOrt] [varchar](50) NULL,
	[RechLand] [varchar](50) NULL,
	[CalcType] [varchar](6) NULL,
	[Waehrung] [varchar](3) NULL,
	[Zahlungsbedingung] [varchar](50) NULL,
	[Lieferbedingung] [varchar](50) NULL,
	[Bemerkung] [varchar](1024) NULL,
	[WebShopArt] [int] NULL,
	[LiefAPVorname] [varchar](50) NULL,
	[RechAPVorname] [varchar](50) NULL,
	[LiefAPNachname] [varchar](50) NULL,
	[RechAPNachname] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebShopPos]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebShopPos](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[Order_ID] [int] NULL,
	[Line_Item_ID] [int] NULL,
	[Menge] [int] NULL,
	[Bemerkung] [varchar](1024) NULL,
	[Shop_Aid] [varchar](50) NULL,
	[ERP_Aid] [varchar](50) NULL,
	[Beschreibung] [varchar](1024) NULL,
	[Hersteller] [varchar](50) NULL,
	[Herstellercode] [varchar](50) NULL,
	[Kreditorcode] [varchar](50) NULL,
	[EK] [float] NULL,
	[VK] [float] NULL,
	[Mwst] [float] NULL,
	[WebShopArt] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebShopZuordnung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebShopZuordnung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ObjektI3D] [int] NULL,
	[ObjektArt] [int] NULL,
	[WebShopEinstellungenI3D] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebSUpdateProt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebSUpdateProt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[UpdateDateTime] [datetime] NULL,
	[UpdateUser] [varchar](50) NULL,
	[UpdateIP] [varchar](50) NULL,
	[AuftragID] [int] NULL,
	[ArbeitenAlt] [text] NULL,
	[ArbeitenNeu] [text] NULL,
	[InfosAlt] [text] NULL,
	[InfosNeu] [text] NULL,
	[AusgefAlt] [text] NULL,
	[AusgefNeu] [text] NULL,
 CONSTRAINT [PK_WebSUpdateProt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WEBUsers]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WEBUsers](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenID] [int] NOT NULL,
	[Passwort] [varchar](50) NULL,
	[Status] [int] NULL,
 CONSTRAINT [PK_WEBUsers] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebUsers_Temp]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebUsers_Temp](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[SessionID] [int] NULL,
	[TimeOut] [datetime] NULL,
	[IPAdress] [varchar](16) NULL,
	[UserID] [int] NULL,
 CONSTRAINT [PK_WebUsers_Temp] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WebZeiterfassung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebZeiterfassung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[PersonalI3D] [int] NULL,
	[KundenI3D] [int] NULL,
	[ProjektI3D] [int] NULL,
	[AuftragI3D] [int] NULL,
	[ErstelltAm] [datetime] NULL,
	[Beginn] [datetime] NULL,
	[Ende] [datetime] NULL,
	[Intern] [int] NULL,
	[Verrechenbar] [int] NULL,
	[Bezeichnung] [varchar](250) NULL,
	[Beschreibung] [text] NULL,
 CONSTRAINT [PK_Zeiterfassung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WerkzeugKlassifizierung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WerkzeugKlassifizierung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Werkzeugverwaltung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Werkzeugverwaltung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](100) NULL,
	[Beschreibung] [varchar](300) NULL,
	[Klassifizierung] [int] NULL,
	[GeraeteNr_SN] [varchar](50) NULL,
	[Soll] [float] NULL,
	[Ist] [float] NULL,
	[Tolleranzgrenze] [float] NULL,
	[Abnutzungsgrad] [float] NULL,
	[Bild] [image] NULL,
	[kundI3D] [int] NULL,
	[KundAnschriftI3D] [int] NULL,
	[KundPersonI3D] [int] NULL,
	[KundEmpfaenger] [varchar](500) NULL,
	[Start] [datetime] NULL,
	[Lebensdauer] [int] NULL,
	[Nummer] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Workflow]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Workflow](
	[I3D] [int] NOT NULL,
	[Name] [varchar](50) NULL,
 CONSTRAINT [PK_Workflow] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkFlow_Alt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WorkFlow_Alt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Ausloeser] [int] NULL,
	[Bezeichnung] [varchar](50) NULL,
 CONSTRAINT [PK_WorkFlow_Alt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkflowBaustein]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WorkflowBaustein](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[BausteinID] [int] NULL,
	[Bedingung] [int] NULL,
	[PosLeft] [int] NULL,
	[PosTop] [int] NULL,
	[PosWidth] [int] NULL,
	[PosHeight] [int] NULL,
	[BausteinCaption] [varchar](100) NULL,
	[WorkflowProcessI3D] [int] NULL,
	[Guid] [uniqueidentifier] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkflowBausteinParameter]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WorkflowBausteinParameter](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[WorkflowBausteinI3D] [int] NULL,
	[Art] [int] NULL,
	[ParamInt] [int] NULL,
	[ParamString] [varchar](100) NULL,
	[ParamText] [text] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkflowBausteinZuordnung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WorkflowBausteinZuordnung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Status] [int] NULL,
	[VerweisVonI3D] [int] NULL,
	[VerweisNachI3D] [int] NULL,
	[VerweisVonArt] [int] NULL,
	[VerweisNachArt] [int] NULL,
	[SourceConnectionPoint] [int] NULL,
	[TargetConnectionPoint] [int] NULL,
	[BausteinID] [int] NULL,
	[Kind] [int] NULL,
	[ConnectorType] [int] NULL,
	[Caption] [nvarchar](max) NULL,
	[WorkflowProcessI3D] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkflowJobs]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WorkflowJobs](
	[I3D] [int] NOT NULL,
	[WorkflowI3D] [int] NULL,
	[ParentJobI3D] [int] NULL,
	[Name] [varchar](50) NULL,
	[Decision] [int] NULL,
	[Art] [int] NULL,
	[PosX] [int] NULL,
	[PosY] [int] NULL,
	[Shape] [int] NULL,
 CONSTRAINT [PK_WorkflowJobs] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkFlowJobs_Alt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WorkFlowJobs_Alt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[WorkFlowI3D] [int] NULL,
	[JobI3D] [int] NULL,
	[Text] [varchar](50) NULL,
 CONSTRAINT [PK_WorkFlowJobs_Alt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkflowMissingEmailCheck]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WorkflowMissingEmailCheck](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CustomerI3D] [int] NOT NULL,
	[ContractI3D] [int] NULL,
	[TimeSpanInHours] [int] NOT NULL,
	[LastReceived] [datetime] NULL,
	[IsActive] [bit] NOT NULL,
	[FromEmail] [nvarchar](255) NULL,
	[Subject] [nvarchar](4000) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[WorkflowProzess]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WorkflowProzess](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](100) NULL,
	[PersonalI3D] [int] NULL,
	[Art] [int] NULL,
	[Status] [int] NULL,
	[Aktiv] [int] NULL,
	[ObjectI3D] [int] NULL,
	[ObjectArt] [int] NULL,
	[IsDeleted] [bit] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[XMLLockList]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[XMLLockList](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](30) NULL,
	[Status] [int] NULL,
	[LastUser] [varchar](20) NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ZaehlerArt]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ZaehlerArt](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Text] [varchar](150) NULL,
	[ArtikelI3D] [int] NULL,
	[Status] [int] NULL,
	[RefID] [int] NULL,
	[RefDescription] [nvarchar](100) NULL,
 CONSTRAINT [PK_ZaehlerArt] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ZahKondWebToCentron]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ZahKondWebToCentron](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[CentronZahlKondI3D] [int] NULL,
	[WebZahlKondName] [varchar](100) NULL,
	[Art] [int] NULL,
	[Status] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Zahktext]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Zahktext](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Zahkond] [int] NULL,
	[Land] [int] NULL,
	[Text] [varchar](4000) NULL,
 CONSTRAINT [PK_Zahktext] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ZahlungsLauf]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ZahlungsLauf](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[Datum] [datetime] NULL,
	[BearbeiterI3D] [int] NULL,
	[KalkKopfI3D] [int] NULL,
	[Bezahlt] [float] NULL,
	[Status] [int] NULL,
	[ZahlLaufNr] [int] NULL,
	[GutschriftBetrag] [float] NULL,
	[Bank] [varchar](60) NULL,
	[BLZ] [varchar](40) NULL,
	[Konto] [varchar](40) NULL,
	[Inhaber] [varchar](27) NULL,
	[IBAN] [varchar](40) NULL,
	[BIC] [varchar](40) NULL,
	[DTAusErstellt] [int] NULL,
	[DTAusDatum] [datetime] NULL,
	[DTAusBearbeiter] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Zeiterfassung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Zeiterfassung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[ArtI3D] [int] NULL,
	[PersonalI3D] [int] NULL,
	[Status] [int] NULL,
	[Beschreibung] [varchar](500) NULL,
	[Zeitvon] [datetime] NULL,
	[ZeitBis] [datetime] NULL,
	[AnlageArt] [int] NULL,
	[AnlageI3D] [int] NULL,
	[Berechenbar] [int] NULL,
 CONSTRAINT [PK_Zeiterfassung_1] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ZeitPlanung]    Script Date: 11.11.2025 11:20:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ZeitPlanung](
	[I3D] [int] IDENTITY(1,1) NOT NULL,
	[KundenID] [int] NULL,
	[AuftragsNummer] [int] NULL,
	[KundenName] [varchar](240) NULL,
	[Text] [varchar](500) NULL,
	[Von] [datetime] NULL,
	[Bis] [datetime] NULL,
	[MitarbeiterI3D] [int] NULL,
	[Bruder] [int] NULL,
	[Status] [int] NULL,
	[Art] [int] NULL,
	[Priority] [int] NULL,
	[Clipboard] [int] NULL,
	[Urlaub] [int] NULL,
	[Ort] [int] NULL,
	[TaetigkeitI3D] [int] NULL,
	[Kostenstelle] [int] NULL,
	[OutlookEntryID] [varchar](500) NULL,
	[AuftragsI3D] [int] NULL,
	[Betreff] [varchar](255) NULL,
	[OrtText] [varchar](255) NULL,
	[TerminStatus] [int] NULL,
	[TerminPrioritaet] [int] NULL,
 CONSTRAINT [PK_ZeitPlanung] PRIMARY KEY CLUSTERED 
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopf_AnschriftID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopf_AnschriftID] ON [dbo].[AbholKopf]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopf_KundenID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopf_KundenID] ON [dbo].[AbholKopf]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAbholKopf_AussendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholKopf_AussendienstID] ON [dbo].[AbholKopf]
(
	[AussendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAbholKopf_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholKopf_Datum] ON [dbo].[AbholKopf]
(
	[Datum] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAbholKopf_InnendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholKopf_InnendienstID] ON [dbo].[AbholKopf]
(
	[InnendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAbholKopf_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholKopf_Nummer] ON [dbo].[AbholKopf]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAbholKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholKopf_Techniker2ID] ON [dbo].[AbholKopf]
(
	[Techniker2ID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAbholKopf_TechnikerID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholKopf_TechnikerID] ON [dbo].[AbholKopf]
(
	[TechnikerID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfErweitert_AbholkopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfErweitert_AbholkopfI3D] ON [dbo].[AbholKopfErweitert]
(
	[AbholkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfErweitert_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfErweitert_Status] ON [dbo].[AbholKopfErweitert]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfErweitertVersions_AbholkopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfErweitertVersions_AbholkopfI3D] ON [dbo].[AbholKopfErweitertVersions]
(
	[AbholkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfErweitertVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfErweitertVersions_Status] ON [dbo].[AbholKopfErweitertVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_AnschriftID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_AnschriftID] ON [dbo].[AbholKopfVersions]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_AussendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_AussendienstID] ON [dbo].[AbholKopfVersions]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_Datum] ON [dbo].[AbholKopfVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_InnendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_InnendienstID] ON [dbo].[AbholKopfVersions]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_KundenID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_KundenID] ON [dbo].[AbholKopfVersions]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AbholKopfVersions_KurzZeich]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_KurzZeich] ON [dbo].[AbholKopfVersions]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_Nummer] ON [dbo].[AbholKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_Status] ON [dbo].[AbholKopfVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_Techniker2ID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_Techniker2ID] ON [dbo].[AbholKopfVersions]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholKopfVersions_TechnikerID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholKopfVersions_TechnikerID] ON [dbo].[AbholKopfVersions]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AbholPos_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPos_EANCode] ON [dbo].[AbholPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPos_GeraeteBarcodeI3D] ON [dbo].[AbholPos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPos_Ursprung]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPos_Ursprung] ON [dbo].[AbholPos]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ix_AbholPos_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ix_AbholPos_Art] ON [dbo].[AbholPos]
(
	[Art] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAbholPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholPos_ArtikelI3D] ON [dbo].[AbholPos]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixAbholPos_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholPos_Code] ON [dbo].[AbholPos]
(
	[Code] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixAbholPos_HerstCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAbholPos_HerstCode] ON [dbo].[AbholPos]
(
	[HerstCode] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPosVersions_AbholKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_AbholKopfI3D] ON [dbo].[AbholPosVersions]
(
	[AbholKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPosVersions_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_Art] ON [dbo].[AbholPosVersions]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPosVersions_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_ArtikelI3D] ON [dbo].[AbholPosVersions]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AbholPosVersions_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_Code] ON [dbo].[AbholPosVersions]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AbholPosVersions_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_EANCode] ON [dbo].[AbholPosVersions]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPosVersions_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_GeraeteBarcodeI3D] ON [dbo].[AbholPosVersions]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AbholPosVersions_HerstCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_HerstCode] ON [dbo].[AbholPosVersions]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPosVersions_KopfVersionsI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_KopfVersionsI3D] ON [dbo].[AbholPosVersions]
(
	[KopfVersionsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPosVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_Status] ON [dbo].[AbholPosVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbholPosVersions_UrsprungI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbholPosVersions_UrsprungI3D] ON [dbo].[AbholPosVersions]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbtTaetigkeiten_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbtTaetigkeiten_ArtikelI3D] ON [dbo].[AbtTaetigkeiten]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbtTaetigkeiten_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbtTaetigkeiten_Status] ON [dbo].[AbtTaetigkeiten]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbtTaetigkeitenZuordnung_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbtTaetigkeitenZuordnung_Status] ON [dbo].[AbtTaetigkeitenZuordnung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbweichendeAnschrift_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbweichendeAnschrift_KundenI3D] ON [dbo].[AbweichendeAnschrift]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AbweichendeAnschrift_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AbweichendeAnschrift_Status] ON [dbo].[AbweichendeAnschrift]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountActivities_ActivityContact]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountActivities_ActivityContact] ON [dbo].[AccountActivities]
(
	[AccountI3D] ASC,
	[AccountAddressContactI3D] ASC,
	[ActivityKind] ASC,
	[IsDone] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountActivities_ActivitySearch]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountActivities_ActivitySearch] ON [dbo].[AccountActivities]
(
	[AccountI3D] ASC,
	[ActivityKind] ASC,
	[IsDone] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountActivities_OldReferenceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountActivities_OldReferenceI3D] ON [dbo].[AccountActivities]
(
	[OldReferenceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_AccountAddressContacts_OldReferenceI3D_DefaultTicket]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_AccountAddressContacts_OldReferenceI3D_DefaultTicket] ON [dbo].[AccountAddressContacts]
(
	[OldReferenceI3D] ASC
)
INCLUDE([DefaultTicket]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountAddressContacts_AddressI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountAddressContacts_AddressI3D] ON [dbo].[AccountAddressContacts]
(
	[AccountAddressI3D] ASC,
	[IsActive] ASC,
	[IsDefault] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountAddressContacts_OldReference]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountAddressContacts_OldReference] ON [dbo].[AccountAddressContacts]
(
	[OldReferenceKind] ASC,
	[OldReferenceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountAddresses_AccountI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountAddresses_AccountI3D] ON [dbo].[AccountAddresses]
(
	[AccountI3D] ASC,
	[IsActive] ASC,
	[IsDefault] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountAddresses_OldReference]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountAddresses_OldReference] ON [dbo].[AccountAddresses]
(
	[OldReferenceKind] ASC,
	[OldReferenceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_AccountArticleSpecialPricesImportSettings_UniqueSettings]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE NONCLUSTERED INDEX [idx_AccountArticleSpecialPricesImportSettings_UniqueSettings] ON [dbo].[AccountArticleSpecialPricesImportSettings]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountDeviceLogs_AccountDeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountDeviceLogs_AccountDeviceI3D] ON [dbo].[AccountDeviceLogs]
(
	[AccountDeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountDevices_AccountI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountDevices_AccountI3D] ON [dbo].[AccountDevices]
(
	[AccountI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountDevicesToTickets_AccountDeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountDevicesToTickets_AccountDeviceI3D] ON [dbo].[AccountDevicesToTickets]
(
	[AccountDeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountDevicesToTickets_TicketI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountDevicesToTickets_TicketI3D] ON [dbo].[AccountDevicesToTickets]
(
	[TicketI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountDeviceUris_AccountDeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountDeviceUris_AccountDeviceI3D] ON [dbo].[AccountDeviceUris]
(
	[AccountDeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountOrderProcessingContracts_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountOrderProcessingContracts_CustomerI3D] ON [dbo].[AccountOrderProcessingContracts]
(
	[CustomerI3D] ASC,
	[State] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountRelationships_AccountI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountRelationships_AccountI3D] ON [dbo].[AccountRelationships]
(
	[AccountI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_Accounts_Number]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Accounts_Number] ON [dbo].[Accounts]
(
	[Number] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountTypeToAccounts_AccountCustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountTypeToAccounts_AccountCustomerI3D] ON [dbo].[AccountTypeToAccounts]
(
	[AccountCustomerI3D] ASC
)
INCLUDE([AccountI3D]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountTypeToAccounts_AccountSupplierI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountTypeToAccounts_AccountSupplierI3D] ON [dbo].[AccountTypeToAccounts]
(
	[AccountSupplierI3D] ASC
)
INCLUDE([AccountI3D]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountTypeToAccounts_AccountType]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountTypeToAccounts_AccountType] ON [dbo].[AccountTypeToAccounts]
(
	[AccountTypeI3D] ASC,
	[AccountI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountTypeToAccounts_Customers]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountTypeToAccounts_Customers] ON [dbo].[AccountTypeToAccounts]
(
	[AccountI3D] ASC,
	[AccountCustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AccountTypeToAccounts_Suppliers]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AccountTypeToAccounts_Suppliers] ON [dbo].[AccountTypeToAccounts]
(
	[AccountI3D] ASC,
	[AccountSupplierI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ActImport_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ActImport_Status] ON [dbo].[ActImport]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AddressToAsset_AddressKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AddressToAsset_AddressKind] ON [dbo].[AddressToAsset]
(
	[AddressKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AddressToAsset_AssetI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AddressToAsset_AssetI3D] ON [dbo].[AddressToAsset]
(
	[AssetI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AddressToAsset_AssetKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AddressToAsset_AssetKind] ON [dbo].[AddressToAsset]
(
	[AssetKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AddressToAsset_AssetVersion]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AddressToAsset_AssetVersion] ON [dbo].[AddressToAsset]
(
	[AssetVersion] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AGArbeitssicherheit_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AGArbeitssicherheit_Status] ON [dbo].[AGArbeitssicherheit]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AGLohngruppe_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AGLohngruppe_Status] ON [dbo].[AGLohngruppe]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AGMaterial_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AGMaterial_ArtikelI3D] ON [dbo].[AGMaterial]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AGMaterial_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AGMaterial_Status] ON [dbo].[AGMaterial]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AGPrufvorschrift_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AGPrufvorschrift_Status] ON [dbo].[AGPrufvorschrift]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AGUmweltschutz_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AGUmweltschutz_Status] ON [dbo].[AGUmweltschutz]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AktionArt_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AktionArt_Status] ON [dbo].[AktionArt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfahrtZonen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfahrtZonen_Status] ON [dbo].[AnfahrtZonen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrKopf_AktuelleVersion]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrKopf_AktuelleVersion] ON [dbo].[AnfrKopf]
(
	[AktuelleVersion] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrKopf_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrKopf_Datum] ON [dbo].[AnfrKopf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrKopf_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrKopf_Nummer] ON [dbo].[AnfrKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrKopf_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrKopf_Status] ON [dbo].[AnfrKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrKopfVersions_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrKopfVersions_Datum] ON [dbo].[AnfrKopfVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrKopfVersions_I3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrKopfVersions_I3D] ON [dbo].[AnfrKopfVersions]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrKopfVersions_Nummer] ON [dbo].[AnfrKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrKopfVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrKopfVersions_Status] ON [dbo].[AnfrKopfVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPos_AnfrKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPos_AnfrKopfI3D] ON [dbo].[AnfrPos]
(
	[AnfrKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AnfrPos_Artikelcode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPos_Artikelcode] ON [dbo].[AnfrPos]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPos_ArtikelI3D] ON [dbo].[AnfrPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AnfrPos_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPos_EANCode] ON [dbo].[AnfrPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPos_EKAusAufPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPos_EKAusAufPosI3D] ON [dbo].[AnfrPos]
(
	[EKAusAufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AnfrPos_Hersteller]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPos_Hersteller] ON [dbo].[AnfrPos]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPos_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPos_Status] ON [dbo].[AnfrPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPosVersions_AnfrKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPosVersions_AnfrKopfI3D] ON [dbo].[AnfrPosVersions]
(
	[AnfrKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPosVersions_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPosVersions_Art] ON [dbo].[AnfrPosVersions]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AnfrPosVersions_Artikelcode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPosVersions_Artikelcode] ON [dbo].[AnfrPosVersions]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPosVersions_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPosVersions_ArtikelI3D] ON [dbo].[AnfrPosVersions]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPosVersions_I3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPosVersions_I3D] ON [dbo].[AnfrPosVersions]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnfrPosVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnfrPosVersions_Status] ON [dbo].[AnfrPosVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngebotBewertung_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngebotBewertung_Datum] ON [dbo].[AngebotBewertung]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngebotBewertung_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngebotBewertung_Status] ON [dbo].[AngebotBewertung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngebotBewertungEinstellungen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngebotBewertungEinstellungen_Status] ON [dbo].[AngebotBewertungEinstellungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngebotVerloren_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngebotVerloren_Status] ON [dbo].[AngebotVerloren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopf_AnschriftID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopf_AnschriftID] ON [dbo].[AngKopf]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopf_KundenID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopf_KundenID] ON [dbo].[AngKopf]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AngKopf_KurzZeich]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopf_KurzZeich] ON [dbo].[AngKopf]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAngKopf_AussendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngKopf_AussendienstID] ON [dbo].[AngKopf]
(
	[AussendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAngKopf_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngKopf_Datum] ON [dbo].[AngKopf]
(
	[Datum] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAngKopf_InnendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngKopf_InnendienstID] ON [dbo].[AngKopf]
(
	[InnendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAngKopf_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngKopf_Nummer] ON [dbo].[AngKopf]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAngKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngKopf_Techniker2ID] ON [dbo].[AngKopf]
(
	[Techniker2ID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAngKopf_TechnikerID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngKopf_TechnikerID] ON [dbo].[AngKopf]
(
	[TechnikerID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfErweitert_AngkopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfErweitert_AngkopfI3D] ON [dbo].[AngKopfErweitert]
(
	[AngkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfErweitert_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfErweitert_Status] ON [dbo].[AngKopfErweitert]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfErweitertVersions_AngkopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfErweitertVersions_AngkopfI3D] ON [dbo].[AngKopfErweitertVersions]
(
	[AngkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfErweitertVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfErweitertVersions_Status] ON [dbo].[AngKopfErweitertVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_AnschriftID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_AnschriftID] ON [dbo].[AngKopfVersions]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_AussendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_AussendienstID] ON [dbo].[AngKopfVersions]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_Datum] ON [dbo].[AngKopfVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_InnendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_InnendienstID] ON [dbo].[AngKopfVersions]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_KundenID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_KundenID] ON [dbo].[AngKopfVersions]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_Nummer] ON [dbo].[AngKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_Status] ON [dbo].[AngKopfVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_Techniker2ID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_Techniker2ID] ON [dbo].[AngKopfVersions]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngKopfVersions_TechnikerID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngKopfVersions_TechnikerID] ON [dbo].[AngKopfVersions]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AngPos_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPos_EANCode] ON [dbo].[AngPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngPos_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPos_Status] ON [dbo].[AngPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ix_AngPos_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ix_AngPos_Art] ON [dbo].[AngPos]
(
	[Art] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAngPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngPos_ArtikelI3D] ON [dbo].[AngPos]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixAngPos_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngPos_Code] ON [dbo].[AngPos]
(
	[Code] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixAngPos_HerstCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAngPos_HerstCode] ON [dbo].[AngPos]
(
	[HerstCode] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngPosVersions_AngKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPosVersions_AngKopfI3D] ON [dbo].[AngPosVersions]
(
	[AngKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngPosVersions_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPosVersions_Art] ON [dbo].[AngPosVersions]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngPosVersions_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPosVersions_ArtikelI3D] ON [dbo].[AngPosVersions]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AngPosVersions_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPosVersions_Code] ON [dbo].[AngPosVersions]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AngPosVersions_HerstCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPosVersions_HerstCode] ON [dbo].[AngPosVersions]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngPosVersions_KopfVersionsI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPosVersions_KopfVersionsI3D] ON [dbo].[AngPosVersions]
(
	[KopfVersionsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngPosVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngPosVersions_Status] ON [dbo].[AngPosVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngProv_AngKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngProv_AngKopfI3D] ON [dbo].[AngProv]
(
	[AngKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AngProv_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AngProv_Status] ON [dbo].[AngProv]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageFreigabenGesetzt_AnlageI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageFreigabenGesetzt_AnlageI3D] ON [dbo].[AnlageFreigabenGesetzt]
(
	[AnlageI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageFreigabenGesetzt_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageFreigabenGesetzt_Status] ON [dbo].[AnlageFreigabenGesetzt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageFreigabenWarengruppen_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageFreigabenWarengruppen_Art] ON [dbo].[AnlageFreigabenWarengruppen]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageFreigabenWarengruppen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageFreigabenWarengruppen_Status] ON [dbo].[AnlageFreigabenWarengruppen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageFreigabenWarengruppen_Warengruppe]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageFreigabenWarengruppen_Warengruppe] ON [dbo].[AnlageFreigabenWarengruppen]
(
	[Warengruppe] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageFreigabenWarengruppenBenoetigt_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageFreigabenWarengruppenBenoetigt_Art] ON [dbo].[AnlageFreigabenWarengruppenBenoetigt]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageFreigabenWarengruppenBenoetigt_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageFreigabenWarengruppenBenoetigt_Status] ON [dbo].[AnlageFreigabenWarengruppenBenoetigt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageFreigabenWarengruppenBenoetigt_Warengruppe]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageFreigabenWarengruppenBenoetigt_Warengruppe] ON [dbo].[AnlageFreigabenWarengruppenBenoetigt]
(
	[Warengruppe] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageGrund_ObjektArt]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageGrund_ObjektArt] ON [dbo].[AnlageGrund]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageGrund_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageGrund_Status] ON [dbo].[AnlageGrund]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageLog_AnlageArt]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageLog_AnlageArt] ON [dbo].[AnlageLog]
(
	[AnlageArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageLog_AnlageI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageLog_AnlageI3D] ON [dbo].[AnlageLog]
(
	[AnlageI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageLog_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageLog_Art] ON [dbo].[AnlageLog]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageLog_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageLog_Datum] ON [dbo].[AnlageLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnlageLog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnlageLog_Status] ON [dbo].[AnlageLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxAnlageLogReceiptSearchOpt]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idxAnlageLogReceiptSearchOpt] ON [dbo].[AnlageLog]
(
	[AnlageArt] ASC,
	[AnlageI3D] ASC,
	[Art] ASC,
	[Datum] DESC
)
INCLUDE([AnlageVersion]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Anrede_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Anrede_Status] ON [dbo].[Anrede]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Anschrif_Kreditor]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Anschrif_Kreditor] ON [dbo].[Anschrif]
(
	[Kreditor] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Anschrif_Kunde]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Anschrif_Kunde] ON [dbo].[Anschrif]
(
	[Kunde] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Anschrif_Land]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Anschrif_Land] ON [dbo].[Anschrif]
(
	[Land] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Anschrif_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Anschrif_Status] ON [dbo].[Anschrif]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnschriftSonderartikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnschriftSonderartikel_ArtikelI3D] ON [dbo].[AnschriftSonderartikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnschriftSonderartikel_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnschriftSonderartikel_Status] ON [dbo].[AnschriftSonderartikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnsprechpartnerBeziehung_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnsprechpartnerBeziehung_Status] ON [dbo].[AnsprechpartnerBeziehung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AnsprechpartnerBeziehungText_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AnsprechpartnerBeziehungText_Status] ON [dbo].[AnsprechpartnerBeziehungText]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanArbeitsplatz_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanArbeitsplatz_Art] ON [dbo].[APlanArbeitsplatz]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanArbeitsplatz_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanArbeitsplatz_Status] ON [dbo].[APlanArbeitsplatz]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanArbeitsschutz_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanArbeitsschutz_Art] ON [dbo].[APlanArbeitsschutz]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanArbeitsschutz_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanArbeitsschutz_Status] ON [dbo].[APlanArbeitsschutz]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanArtikel_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanArtikel_Art] ON [dbo].[APlanArtikel]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanArtikel_ArtikelI3D] ON [dbo].[APlanArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanArtikel_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanArtikel_Status] ON [dbo].[APlanArtikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanKalkulation_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanKalkulation_Art] ON [dbo].[APlanKalkulation]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanKalkulation_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanKalkulation_ArtikelI3D] ON [dbo].[APlanKalkulation]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanKalkulation_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanKalkulation_Status] ON [dbo].[APlanKalkulation]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanLohnGruppe_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanLohnGruppe_Art] ON [dbo].[APlanLohnGruppe]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanLohnGruppe_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanLohnGruppe_Status] ON [dbo].[APlanLohnGruppe]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanMaterial_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanMaterial_Art] ON [dbo].[APlanMaterial]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanMaterial_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanMaterial_ArtikelI3D] ON [dbo].[APlanMaterial]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanMaterial_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanMaterial_Status] ON [dbo].[APlanMaterial]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanMaterialListe_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanMaterialListe_Art] ON [dbo].[APlanMaterialListe]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanMaterialListe_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanMaterialListe_ArtikelI3D] ON [dbo].[APlanMaterialListe]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanMaterialListe_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanMaterialListe_Status] ON [dbo].[APlanMaterialListe]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanUmweltschutz_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanUmweltschutz_Art] ON [dbo].[APlanUmweltschutz]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanUmweltschutz_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanUmweltschutz_Status] ON [dbo].[APlanUmweltschutz]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanWerkzeug_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanWerkzeug_Art] ON [dbo].[APlanWerkzeug]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanWerkzeug_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanWerkzeug_ArtikelI3D] ON [dbo].[APlanWerkzeug]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [APlanWerkzeug_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [APlanWerkzeug_Status] ON [dbo].[APlanWerkzeug]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Arbeitsauftrag_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitsauftrag_Datum] ON [dbo].[Arbeitsauftrag]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Arbeitsauftrag_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitsauftrag_Status] ON [dbo].[Arbeitsauftrag]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsplanArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsplanArtikel_ArtikelI3D] ON [dbo].[ArbeitsplanArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsplanArtikel_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsplanArtikel_Status] ON [dbo].[ArbeitsplanArtikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsplanVorlage_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsplanVorlage_Status] ON [dbo].[ArbeitsplanVorlage]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsplanVorlageArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsplanVorlageArtikel_ArtikelI3D] ON [dbo].[ArbeitsplanVorlageArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsplanVorlageArtikel_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsplanVorlageArtikel_Status] ON [dbo].[ArbeitsplanVorlageArtikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Arbeitsplatz_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitsplatz_Nummer] ON [dbo].[Arbeitsplatz]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Arbeitsplatz_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitsplatz_Status] ON [dbo].[Arbeitsplatz]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsplatzGruppen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsplatzGruppen_Status] ON [dbo].[ArbeitsplatzGruppen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsplatzStandorte_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsplatzStandorte_Status] ON [dbo].[ArbeitsplatzStandorte]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsschrittHistorie_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsschrittHistorie_Datum] ON [dbo].[ArbeitsschrittHistorie]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsschrittHistorie_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsschrittHistorie_Status] ON [dbo].[ArbeitsschrittHistorie]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArbeitsschrittVorlage_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArbeitsschrittVorlage_Status] ON [dbo].[ArbeitsschrittVorlage]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Arbeitssicherheit_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitssicherheit_Status] ON [dbo].[Arbeitssicherheit]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArticleImportLogs_ImportState]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArticleImportLogs_ImportState] ON [dbo].[ArticleImportLogs]
(
	[ArticleImportI3D] ASC,
	[State] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IDX_ArticleWorkItems_I3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IDX_ArticleWorkItems_I3D] ON [dbo].[ArticleWorkItems]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ARTIK_BarcodeScanen]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIK_BarcodeScanen] ON [dbo].[ARTIK]
(
	[BarcodeScanen] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ARTIK_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIK_EANCode] ON [dbo].[ARTIK]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ARTIK_Hersteller]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIK_Hersteller] ON [dbo].[ARTIK]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ARTIK_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIK_Status] ON [dbo].[ARTIK]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ARTIK_Warengruppe]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIK_Warengruppe] ON [dbo].[ARTIK]
(
	[Warengruppe] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ARTIK0]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE NONCLUSTERED INDEX [ARTIK0] ON [dbo].[ARTIK]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxArtik_ArticleCountOptimized]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idxArtik_ArticleCountOptimized] ON [dbo].[ARTIK]
(
	[BarcodeScanen] ASC
)
INCLUDE([Menge]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_ARTIK_ParentArticleI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_ARTIK_ParentArticleI3D] ON [dbo].[ARTIK]
(
	[ParentArticleI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ARTIKArbeitssicherheit_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIKArbeitssicherheit_Status] ON [dbo].[ARTIKArbeitssicherheit]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikDistributorCode_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikDistributorCode_ArtikelI3D] ON [dbo].[ArtikDistributorCode]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ArtikDistributorCode_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikDistributorCode_Code] ON [dbo].[ArtikDistributorCode]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikDistributorCode_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikDistributorCode_Status] ON [dbo].[ArtikDistributorCode]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikDistributorVKStaffelpreise_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikDistributorVKStaffelpreise_Status] ON [dbo].[ArtikDistributorVKStaffelpreise]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ArtikEAN_EANCODE]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikEAN_EANCODE] ON [dbo].[ArtikEAN]
(
	[EANCODE] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ArtikEAN_EANCODEBasis]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikEAN_EANCODEBasis] ON [dbo].[ArtikEAN]
(
	[EANCODEBasis] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikEAN_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikEAN_Status] ON [dbo].[ArtikEAN]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idx_ArtikEAN_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_ArtikEAN_EANCode] ON [dbo].[ArtikEAN]
(
	[EANCODE] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelAGArbeitssicherheit_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelAGArbeitssicherheit_Status] ON [dbo].[ArtikelAGArbeitssicherheit]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelAGLohngruppe_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelAGLohngruppe_Status] ON [dbo].[ArtikelAGLohngruppe]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelAGMaterial_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelAGMaterial_ArtikelI3D] ON [dbo].[ArtikelAGMaterial]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelAGMaterial_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelAGMaterial_Status] ON [dbo].[ArtikelAGMaterial]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelAGPrufvorschrift_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelAGPrufvorschrift_Status] ON [dbo].[ArtikelAGPrufvorschrift]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelAGUmweltschutz_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelAGUmweltschutz_Status] ON [dbo].[ArtikelAGUmweltschutz]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelAlternativartikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelAlternativartikel_ArtikelI3D] ON [dbo].[ArtikelAlternativartikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelAlternativartikel_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelAlternativartikel_Status] ON [dbo].[ArtikelAlternativartikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelArbeitsgang_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelArbeitsgang_ArtikelI3D] ON [dbo].[ArtikelArbeitsgang]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelArbeitsgang_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelArbeitsgang_Status] ON [dbo].[ArtikelArbeitsgang]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelArbeitsplan_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelArbeitsplan_ArtikelI3D] ON [dbo].[ArtikelArbeitsplan]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelArbeitsplan_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelArbeitsplan_Status] ON [dbo].[ArtikelArbeitsplan]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelBilder_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelBilder_ArtikelI3D] ON [dbo].[ArtikelBilder]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelBilder_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelBilder_Status] ON [dbo].[ArtikelBilder]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelBranchErloeskonto_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelBranchErloeskonto_ArtikelI3D] ON [dbo].[ArtikelBranchErloeskonto]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelBranchErloeskonto_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelBranchErloeskonto_Status] ON [dbo].[ArtikelBranchErloeskonto]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelErsatzteile_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelErsatzteile_ArtikelI3D] ON [dbo].[ArtikelErsatzteile]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelErsatzteile_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelErsatzteile_Status] ON [dbo].[ArtikelErsatzteile]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelMaschienenplan_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelMaschienenplan_ArtikelI3D] ON [dbo].[ArtikelMaschienenplan]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelMaschienenplan_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelMaschienenplan_Status] ON [dbo].[ArtikelMaschienenplan]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelMasse_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelMasse_ArtikelI3D] ON [dbo].[ArtikelMasse]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelMasse_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelMasse_Status] ON [dbo].[ArtikelMasse]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelSpezifikationen_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelSpezifikationen_ArtikelI3D] ON [dbo].[ArtikelSpezifikationen]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelSpezifikationen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelSpezifikationen_Status] ON [dbo].[ArtikelSpezifikationen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelToSpez_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelToSpez_ArtikelI3D] ON [dbo].[ArtikelToSpez]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelToSpez_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelToSpez_Status] ON [dbo].[ArtikelToSpez]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ArtikelVar_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelVar_Nummer] ON [dbo].[ArtikelVar]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelVar_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelVar_Status] ON [dbo].[ArtikelVar]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelVerfolgung_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelVerfolgung_Status] ON [dbo].[ArtikelVerfolgung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelWartungsartikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelWartungsartikel_ArtikelI3D] ON [dbo].[ArtikelWartungsartikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelWartungsartikel_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelWartungsartikel_Status] ON [dbo].[ArtikelWartungsartikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelZubehoer_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelZubehoer_ArtikelI3D] ON [dbo].[ArtikelZubehoer]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikelZubehoer_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikelZubehoer_Status] ON [dbo].[ArtikelZubehoer]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikLagerStkListe_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikLagerStkListe_ArtikelI3D] ON [dbo].[ArtikLagerStkListe]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikLagerStkListe_AufKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikLagerStkListe_AufKopfI3D] ON [dbo].[ArtikLagerStkListe]
(
	[AufKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikLagerStkListe_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikLagerStkListe_Status] ON [dbo].[ArtikLagerStkListe]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ARTIKlog_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIKlog_Art] ON [dbo].[ARTIKlog]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ARTIKlog_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIKlog_ArtikelI3D] ON [dbo].[ARTIKlog]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ARTIKlog_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIKlog_Datum] ON [dbo].[ARTIKlog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ARTIKlog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIKlog_Status] ON [dbo].[ARTIKlog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_ARTIKlog_ArtikelI3D_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_ARTIKlog_ArtikelI3D_Datum] ON [dbo].[ARTIKlog]
(
	[ArtikelI3D] DESC,
	[Datum] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idx_ARTIKlog_Wert]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_ARTIKlog_Wert] ON [dbo].[ARTIKlog]
(
	[Wert] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikStaffelpreise_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikStaffelpreise_ArtikelI3D] ON [dbo].[ArtikStaffelpreise]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikStaffelpreise_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikStaffelpreise_Status] ON [dbo].[ArtikStaffelpreise]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikStkListe_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikStkListe_ArtikelI3D] ON [dbo].[ArtikStkListe]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ArtikStkListe_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikStkListe_Code] ON [dbo].[ArtikStkListe]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikStkListe_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikStkListe_Status] ON [dbo].[ArtikStkListe]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ArtikTexte_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ArtikTexte_Status] ON [dbo].[ArtikTexte]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ARTIKUmweltschutz_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ARTIKUmweltschutz_Status] ON [dbo].[ARTIKUmweltschutz]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementActiveDirectories_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementActiveDirectories_CustomerI3D] ON [dbo].[AssetManagementActiveDirectories]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementActiveDirectories_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementActiveDirectories_Name] ON [dbo].[AssetManagementActiveDirectories]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementActiveDirectories_Type]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementActiveDirectories_Type] ON [dbo].[AssetManagementActiveDirectories]
(
	[Type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementActiveDirectoryGroups_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementActiveDirectoryGroups_CustomerI3D] ON [dbo].[AssetManagementActiveDirectoryGroups]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementActiveDirectoryUsers_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementActiveDirectoryUsers_CustomerI3D] ON [dbo].[AssetManagementActiveDirectoryUsers]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementActiveDirectoryUsers_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementActiveDirectoryUsers_Name] ON [dbo].[AssetManagementActiveDirectoryUsers]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementActiveDirectoryUsers_UserName]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementActiveDirectoryUsers_UserName] ON [dbo].[AssetManagementActiveDirectoryUsers]
(
	[UserName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementADBuiltInDomains_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADBuiltInDomains_CustomerI3D] ON [dbo].[AssetManagementADBuiltInDomains]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementADBuiltInDomains_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADBuiltInDomains_Name] ON [dbo].[AssetManagementADBuiltInDomains]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementADComputers_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADComputers_CustomerI3D] ON [dbo].[AssetManagementADComputers]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementADComputers_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADComputers_Name] ON [dbo].[AssetManagementADComputers]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementADContacts_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADContacts_CustomerI3D] ON [dbo].[AssetManagementADContacts]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementADContacts_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADContacts_Name] ON [dbo].[AssetManagementADContacts]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementADForeignSecurityPrincipals_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADForeignSecurityPrincipals_CustomerI3D] ON [dbo].[AssetManagementADForeignSecurityPrincipals]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementADForeignSecurityPrincipals_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADForeignSecurityPrincipals_Name] ON [dbo].[AssetManagementADForeignSecurityPrincipals]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementADGroups_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADGroups_CustomerI3D] ON [dbo].[AssetManagementADGroups]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementADInetOrgPersons_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADInetOrgPersons_CustomerI3D] ON [dbo].[AssetManagementADInetOrgPersons]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementADInetOrgPersons_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADInetOrgPersons_Name] ON [dbo].[AssetManagementADInetOrgPersons]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementADUsers_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADUsers_CustomerI3D] ON [dbo].[AssetManagementADUsers]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementADUsers_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADUsers_Name] ON [dbo].[AssetManagementADUsers]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementADVolumes_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADVolumes_CustomerI3D] ON [dbo].[AssetManagementADVolumes]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementADVolumes_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementADVolumes_Name] ON [dbo].[AssetManagementADVolumes]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementCheckConfigurations_DeviceId]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementCheckConfigurations_DeviceId] ON [dbo].[AssetManagementCheckConfigurations]
(
	[DeviceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementCheckConfigurations_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementCheckConfigurations_Status] ON [dbo].[AssetManagementCheckConfigurations]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementCheckErrorLogs_DeviceId]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementCheckErrorLogs_DeviceId] ON [dbo].[AssetManagementCheckErrorLogs]
(
	[DeviceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_AssetManagementCheckResults_CheckConfigurationID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_AssetManagementCheckResults_CheckConfigurationID] ON [dbo].[AssetManagementCheckResults]
(
	[CheckConfigurationID] ASC
)
INCLUDE([Date]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementChecks_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementChecks_Name] ON [dbo].[AssetManagementChecks]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementCheckStatusReports_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AssetManagementCheckStatusReports_CustomerI3D] ON [dbo].[AssetManagementCheckStatusReports]
(
	[CustomerI3D] ASC
)
INCLUDE([DeviceI3D],[TransactionTime]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementCheckStatusReports_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AssetManagementCheckStatusReports_DeviceI3D] ON [dbo].[AssetManagementCheckStatusReports]
(
	[DeviceI3D] ASC
)
INCLUDE([CheckStatus]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementCustomDeviceCategories_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementCustomDeviceCategories_Name] ON [dbo].[AssetManagementCustomDeviceCategories]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementCustomInventories_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementCustomInventories_CustomerI3D] ON [dbo].[AssetManagementCustomInventories]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementCustomInventories_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementCustomInventories_Name] ON [dbo].[AssetManagementCustomInventories]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDeviceChecks_I3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDeviceChecks_I3D] ON [dbo].[AssetManagementDeviceChecks]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDeviceDependenyMappings_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDeviceDependenyMappings_CustomerI3D] ON [dbo].[AssetManagementDeviceDependenyMappings]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDeviceRating_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDeviceRating_CustomerI3D] ON [dbo].[AssetManagementDeviceRating]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementDevices_DeviceId]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDevices_DeviceId] ON [dbo].[AssetManagementDevices]
(
	[DeviceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDevices_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDevices_KundenI3D] ON [dbo].[AssetManagementDevices]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementDevices_Deleted]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AssetManagementDevices_Deleted] ON [dbo].[AssetManagementDevices]
(
	[Deleted] ASC
)
INCLUDE([KundenI3D],[DeviceClass]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementDevices_IsSystemCralwerInstalled]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AssetManagementDevices_IsSystemCralwerInstalled] ON [dbo].[AssetManagementDevices]
(
	[IsSystemCralwerInstalled] ASC
)
INCLUDE([I3D],[KundenI3D]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDeviceToOrgUnits_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDeviceToOrgUnits_DeviceI3D] ON [dbo].[AssetManagementDeviceToOrgUnits]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDeviceToOrgUnits_OrgUnitI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDeviceToOrgUnits_OrgUnitI3D] ON [dbo].[AssetManagementDeviceToOrgUnits]
(
	[OrgUnitI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDHCPDetails_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDHCPDetails_CustomerI3D] ON [dbo].[AssetManagementDHCPDetails]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDHCPServerConfigurations_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDHCPServerConfigurations_CustomerI3D] ON [dbo].[AssetManagementDHCPServerConfigurations]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDNSInformations_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDNSInformations_CustomerI3D] ON [dbo].[AssetManagementDNSInformations]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementDNSInformations_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDNSInformations_Name] ON [dbo].[AssetManagementDNSInformations]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementDNSInformations_Type]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDNSInformations_Type] ON [dbo].[AssetManagementDNSInformations]
(
	[Type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementDNSInformations_Value]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDNSInformations_Value] ON [dbo].[AssetManagementDNSInformations]
(
	[Value] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDNSServers_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDNSServers_CustomerI3D] ON [dbo].[AssetManagementDNSServers]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementDomain_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementDomain_CustomerI3D] ON [dbo].[AssetManagementDomain]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementEmergencyPlan_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementEmergencyPlan_Status] ON [dbo].[AssetManagementEmergencyPlan]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementEWSMailBoxes_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementEWSMailBoxes_CustomerI3D] ON [dbo].[AssetManagementEWSMailBoxes]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementEWSPermissions_UserName]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementEWSPermissions_UserName] ON [dbo].[AssetManagementEWSPermissions]
(
	[UserName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementEWSStatistics_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementEWSStatistics_CustomerI3D] ON [dbo].[AssetManagementEWSStatistics]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementEWSStatistics_UserName]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementEWSStatistics_UserName] ON [dbo].[AssetManagementEWSStatistics]
(
	[UserName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementExMailboxDatabases_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementExMailboxDatabases_Name] ON [dbo].[AssetManagementExMailboxDatabases]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementExMailboxPermissions_UserName]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementExMailboxPermissions_UserName] ON [dbo].[AssetManagementExMailboxPermissions]
(
	[UserName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementExMailboxs_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementExMailboxs_Name] ON [dbo].[AssetManagementExMailboxs]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementExServers_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementExServers_CustomerI3D] ON [dbo].[AssetManagementExServers]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementExServers_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementExServers_Name] ON [dbo].[AssetManagementExServers]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementFolderForShare_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementFolderForShare_DeviceI3D] ON [dbo].[AssetManagementFolderForShare]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementFolderInformations_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AssetManagementFolderInformations_CustomerI3D] ON [dbo].[AssetManagementFolderInformations]
(
	[CustomerI3D] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_AssetManagementFolderInformations_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_AssetManagementFolderInformations_DeviceI3D] ON [dbo].[AssetManagementFolderInformations]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementHVPortDetails_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementHVPortDetails_Name] ON [dbo].[AssetManagementHVPortDetails]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementHVSystemServices_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementHVSystemServices_CustomerI3D] ON [dbo].[AssetManagementHVSystemServices]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementHVVirtualSwitchs_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementHVVirtualSwitchs_Name] ON [dbo].[AssetManagementHVVirtualSwitchs]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementHVVirtualSwitchs_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementHVVirtualSwitchs_Status] ON [dbo].[AssetManagementHVVirtualSwitchs]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementIISApplicationPools_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementIISApplicationPools_CustomerI3D] ON [dbo].[AssetManagementIISApplicationPools]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementIISServers_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementIISServers_CustomerI3D] ON [dbo].[AssetManagementIISServers]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementIISWebsiteFilters_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementIISWebsiteFilters_Name] ON [dbo].[AssetManagementIISWebsiteFilters]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementIISWebsites_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementIISWebsites_Name] ON [dbo].[AssetManagementIISWebsites]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementLogicalDevice_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementLogicalDevice_DeviceI3D] ON [dbo].[AssetManagementLogicalDevice]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementMappedDrive_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementMappedDrive_DeviceI3D] ON [dbo].[AssetManagementMappedDrive]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementMediaAccessDevice_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementMediaAccessDevice_DeviceI3D] ON [dbo].[AssetManagementMediaAccessDevice]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementMemory_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementMemory_DeviceI3D] ON [dbo].[AssetManagementMemory]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementMemory_Type]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementMemory_Type] ON [dbo].[AssetManagementMemory]
(
	[Type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementMobilePhones_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementMobilePhones_CustomerI3D] ON [dbo].[AssetManagementMobilePhones]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementMotherboard_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementMotherboard_DeviceI3D] ON [dbo].[AssetManagementMotherboard]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementNetworkAdapter_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementNetworkAdapter_DeviceI3D] ON [dbo].[AssetManagementNetworkAdapter]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementNotification_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementNotification_CustomerI3D] ON [dbo].[AssetManagementNotification]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementNotification_DeviceID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementNotification_DeviceID] ON [dbo].[AssetManagementNotification]
(
	[DeviceID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementOS_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementOS_DeviceI3D] ON [dbo].[AssetManagementOS]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementPartnerItems_ObjectI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementPartnerItems_ObjectI3D] ON [dbo].[AssetManagementPartnerItems]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementPartnerItems_ObjectKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementPartnerItems_ObjectKind] ON [dbo].[AssetManagementPartnerItems]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementPartnerItems_PartnerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementPartnerItems_PartnerI3D] ON [dbo].[AssetManagementPartnerItems]
(
	[PartnerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementPartners_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementPartners_CustomerI3D] ON [dbo].[AssetManagementPartners]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementPatch_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementPatch_DeviceI3D] ON [dbo].[AssetManagementPatch]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementPhysicalDrive_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementPhysicalDrive_DeviceI3D] ON [dbo].[AssetManagementPhysicalDrive]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementPort_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementPort_DeviceI3D] ON [dbo].[AssetManagementPort]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementPrinter_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementPrinter_Name] ON [dbo].[AssetManagementPrinter]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementProcessor_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementProcessor_DeviceI3D] ON [dbo].[AssetManagementProcessor]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementProcessor_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementProcessor_Name] ON [dbo].[AssetManagementProcessor]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementRAIDController_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementRAIDController_DeviceI3D] ON [dbo].[AssetManagementRAIDController]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementSecurityIssues_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSecurityIssues_CustomerI3D] ON [dbo].[AssetManagementSecurityIssues]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementService_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementService_DeviceI3D] ON [dbo].[AssetManagementService]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementSNMPDetails_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSNMPDetails_CustomerI3D] ON [dbo].[AssetManagementSNMPDetails]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementSNMPOidClasses_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSNMPOidClasses_Name] ON [dbo].[AssetManagementSNMPOidClasses]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementSNMPOidClasses_Value]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSNMPOidClasses_Value] ON [dbo].[AssetManagementSNMPOidClasses]
(
	[Value] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementSNMPOidInformations_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSNMPOidInformations_Name] ON [dbo].[AssetManagementSNMPOidInformations]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementSNMPWMIInformations_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSNMPWMIInformations_Name] ON [dbo].[AssetManagementSNMPWMIInformations]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementSNMPWMIInformations_Value]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSNMPWMIInformations_Value] ON [dbo].[AssetManagementSNMPWMIInformations]
(
	[Value] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementSocustomer_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSocustomer_DeviceI3D] ON [dbo].[AssetManagementSocustomer]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementSQLInformation_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSQLInformation_CustomerI3D] ON [dbo].[AssetManagementSQLInformation]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementSQLServers_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementSQLServers_CustomerI3D] ON [dbo].[AssetManagementSQLServers]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementUSBDevice_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementUSBDevice_DeviceI3D] ON [dbo].[AssetManagementUSBDevice]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementUSBDevice_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementUSBDevice_Status] ON [dbo].[AssetManagementUSBDevice]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementVendors_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementVendors_CustomerI3D] ON [dbo].[AssetManagementVendors]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementVendors_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementVendors_Status] ON [dbo].[AssetManagementVendors]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementVideoController_DeviceI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementVideoController_DeviceI3D] ON [dbo].[AssetManagementVideoController]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementVideoController_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementVideoController_Name] ON [dbo].[AssetManagementVideoController]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementVisioWorkflows_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementVisioWorkflows_CustomerI3D] ON [dbo].[AssetManagementVisioWorkflows]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementVMHosts_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementVMHosts_CustomerI3D] ON [dbo].[AssetManagementVMHosts]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AssetManagementWindowsSystems_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementWindowsSystems_CustomerI3D] ON [dbo].[AssetManagementWindowsSystems]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementWindowsSystems_Type]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementWindowsSystems_Type] ON [dbo].[AssetManagementWindowsSystems]
(
	[Type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementWizardMappings_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementWizardMappings_Name] ON [dbo].[AssetManagementWizardMappings]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AssetManagementWizardMappings_Value]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AssetManagementWizardMappings_Value] ON [dbo].[AssetManagementWizardMappings]
(
	[Value] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufBarcodes_AufPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufBarcodes_AufPosI3D] ON [dbo].[AufBarcodes]
(
	[AufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufBarcodes_BarcodeI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufBarcodes_BarcodeI3D] ON [dbo].[AufBarcodes]
(
	[BarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufBarcodes_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufBarcodes_Status] ON [dbo].[AufBarcodes]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Main]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Main] ON [dbo].[AufBarcodes]
(
	[I3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopf_AnschriftID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopf_AnschriftID] ON [dbo].[AufKopf]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopf_hlpdsk_requestsI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopf_hlpdsk_requestsI3D] ON [dbo].[AufKopf]
(
	[hlpdsk_requestsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopf_KundenID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopf_KundenID] ON [dbo].[AufKopf]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AufKopf_KurzZeich]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopf_KurzZeich] ON [dbo].[AufKopf]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAufKopf_AussendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufKopf_AussendienstID] ON [dbo].[AufKopf]
(
	[AussendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAufKopf_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufKopf_Datum] ON [dbo].[AufKopf]
(
	[Datum] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAufKopf_InnendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufKopf_InnendienstID] ON [dbo].[AufKopf]
(
	[InnendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAufKopf_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufKopf_Nummer] ON [dbo].[AufKopf]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAufKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufKopf_Techniker2ID] ON [dbo].[AufKopf]
(
	[Techniker2ID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAufKopf_TechnikerID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufKopf_TechnikerID] ON [dbo].[AufKopf]
(
	[TechnikerID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfErweitert_AufkopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfErweitert_AufkopfI3D] ON [dbo].[AufKopfErweitert]
(
	[AufkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfErweitert_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfErweitert_Status] ON [dbo].[AufKopfErweitert]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfErweitertVersions_AufkopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfErweitertVersions_AufkopfI3D] ON [dbo].[AufKopfErweitertVersions]
(
	[AufkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfErweitertVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfErweitertVersions_Status] ON [dbo].[AufKopfErweitertVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_AnschriftID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_AnschriftID] ON [dbo].[AufKopfVersions]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_AussendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_AussendienstID] ON [dbo].[AufKopfVersions]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_Datum] ON [dbo].[AufKopfVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_InnendienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_InnendienstID] ON [dbo].[AufKopfVersions]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_KundenID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_KundenID] ON [dbo].[AufKopfVersions]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_Nummer] ON [dbo].[AufKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_Status] ON [dbo].[AufKopfVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_Techniker2ID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_Techniker2ID] ON [dbo].[AufKopfVersions]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufKopfVersions_TechnikerID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufKopfVersions_TechnikerID] ON [dbo].[AufKopfVersions]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AufPos_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPos_EANCode] ON [dbo].[AufPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPos_GeraeteBarcodeI3D] ON [dbo].[AufPos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPos_UrsprungI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPos_UrsprungI3D] ON [dbo].[AufPos]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPos_UrsprungPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPos_UrsprungPosI3D] ON [dbo].[AufPos]
(
	[UrsprungPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ix_AufPos_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ix_AufPos_Art] ON [dbo].[AufPos]
(
	[Art] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixAufPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufPos_ArtikelI3D] ON [dbo].[AufPos]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixAufPos_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufPos_Code] ON [dbo].[AufPos]
(
	[Code] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixAufPos_HerstCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixAufPos_HerstCode] ON [dbo].[AufPos]
(
	[HerstCode] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPosVersions_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_Art] ON [dbo].[AufPosVersions]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPosVersions_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_ArtikelI3D] ON [dbo].[AufPosVersions]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPosVersions_AufKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_AufKopfI3D] ON [dbo].[AufPosVersions]
(
	[AufKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AufPosVersions_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_Code] ON [dbo].[AufPosVersions]
(
	[Code] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AufPosVersions_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_EANCode] ON [dbo].[AufPosVersions]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPosVersions_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_GeraeteBarcodeI3D] ON [dbo].[AufPosVersions]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [AufPosVersions_HerstCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_HerstCode] ON [dbo].[AufPosVersions]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPosVersions_KopfVersionsI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_KopfVersionsI3D] ON [dbo].[AufPosVersions]
(
	[KopfVersionsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPosVersions_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_Status] ON [dbo].[AufPosVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPosVersions_UrsprungI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_UrsprungI3D] ON [dbo].[AufPosVersions]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufPosVersions_UrsprungPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufPosVersions_UrsprungPosI3D] ON [dbo].[AufPosVersions]
(
	[UrsprungPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufProv_AufKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufProv_AufKopfI3D] ON [dbo].[AufProv]
(
	[AufKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AufProv_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [AufProv_Status] ON [dbo].[AufProv]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Auswertung_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Auswertung_Art] ON [dbo].[Auswertung]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Auswertung_AussenDienstId]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Auswertung_AussenDienstId] ON [dbo].[Auswertung]
(
	[AussenDienstId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Auswertung_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Auswertung_Datum] ON [dbo].[Auswertung]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Auswertung_InnenDienstID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Auswertung_InnenDienstID] ON [dbo].[Auswertung]
(
	[InnenDienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Auswertung_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Auswertung_KundenI3D] ON [dbo].[Auswertung]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Auswertung_ObjektI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Auswertung_ObjektI3D] ON [dbo].[Auswertung]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Auswertung_warengruppe]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Auswertung_warengruppe] ON [dbo].[Auswertung]
(
	[warengruppe] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Barcode_AufPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Barcode_AufPosI3D] ON [dbo].[Barcode]
(
	[AufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Barcode_Auftragsnummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Barcode_Auftragsnummer] ON [dbo].[Barcode]
(
	[Auftragsnummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Barcode_LagerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Barcode_LagerI3D] ON [dbo].[Barcode]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Barcode_LiefPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Barcode_LiefPosI3D] ON [dbo].[Barcode]
(
	[LiefPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Barcode_RechPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Barcode_RechPosI3D] ON [dbo].[Barcode]
(
	[RechPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxBarcode_BarcodeCountOptimized]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idxBarcode_BarcodeCountOptimized] ON [dbo].[Barcode]
(
	[Status] ASC
)
INCLUDE([ArtikelI3D],[LagerI3D]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxBarcode_CommonSearchFields]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idxBarcode_CommonSearchFields] ON [dbo].[Barcode]
(
	[LagerI3D] ASC,
	[ArtikelI3D] ASC,
	[Status] ASC
)
INCLUDE([Barcode]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxBestPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idxBestPosI3D] ON [dbo].[Barcode]
(
	[BestPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixBarcode_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixBarcode_ArtikelI3D] ON [dbo].[Barcode]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixBarcode_Barcode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ixBarcode_Barcode] ON [dbo].[Barcode]
(
	[Barcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BelegArten_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BelegArten_Status] ON [dbo].[BelegArten]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestKopf_AnschriftID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf_AnschriftID] ON [dbo].[BestKopf]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestKopf_AufKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf_AufKopfI3D] ON [dbo].[BestKopf]
(
	[AufKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [BestKopf_KurzZeich]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf_KurzZeich] ON [dbo].[BestKopf]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestKopf_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf_Nummer] ON [dbo].[BestKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestKopf_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf_Status] ON [dbo].[BestKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestKopf2_AktuelleVersion]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf2_AktuelleVersion] ON [dbo].[BestKopf2]
(
	[AktuelleVersion] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestKopf2_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf2_Datum] ON [dbo].[BestKopf2]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestKopf2_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf2_Nummer] ON [dbo].[BestKopf2]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestKopf2_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestKopf2_Status] ON [dbo].[BestKopf2]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos_ArtikelI3D] ON [dbo].[BestPos]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos_BestKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos_BestKopfI3D] ON [dbo].[BestPos]
(
	[BestKopfI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [BestPos_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos_Code] ON [dbo].[BestPos]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos_NebenlagerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos_NebenlagerI3D] ON [dbo].[BestPos]
(
	[NebenlagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos_Status] ON [dbo].[BestPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos2_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_Art] ON [dbo].[BestPos2]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [BestPos2_Artikelcode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_Artikelcode] ON [dbo].[BestPos2]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos2_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_ArtikelI3D] ON [dbo].[BestPos2]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos2_AufPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_AufPosI3D] ON [dbo].[BestPos2]
(
	[AufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos2_BestKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_BestKopfI3D] ON [dbo].[BestPos2]
(
	[BestKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [BestPos2_EANCode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_EANCode] ON [dbo].[BestPos2]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos2_EKAusAufPosI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_EKAusAufPosI3D] ON [dbo].[BestPos2]
(
	[EKAusAufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [BestPos2_Hersteller]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_Hersteller] ON [dbo].[BestPos2]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BestPos2_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BestPos2_Status] ON [dbo].[BestPos2]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BMEcatAufschlaege_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BMEcatAufschlaege_Status] ON [dbo].[BMEcatAufschlaege]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [BMEcatEinstellungen_Land]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BMEcatEinstellungen_Land] ON [dbo].[BMEcatEinstellungen]
(
	[Land] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BMEcatEinstellungen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BMEcatEinstellungen_Status] ON [dbo].[BMEcatEinstellungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [BookKeepingExport_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BookKeepingExport_Name] ON [dbo].[BookKeepingExport]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Branch_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Branch_Status] ON [dbo].[Branch]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Branche_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Branche_Name] ON [dbo].[Branche]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Branche_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Branche_Status] ON [dbo].[Branche]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BranchToStock_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BranchToStock_Status] ON [dbo].[BranchToStock]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BuchhaltungsExpDebPerson_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BuchhaltungsExpDebPerson_Status] ON [dbo].[BuchhaltungsExpDebPerson]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BuchhaltungsExpKredPerson_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BuchhaltungsExpKredPerson_Status] ON [dbo].[BuchhaltungsExpKredPerson]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BuchhaltungsExport_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BuchhaltungsExport_Status] ON [dbo].[BuchhaltungsExport]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BuchhaltungsExportSageKHK_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BuchhaltungsExportSageKHK_Status] ON [dbo].[BuchhaltungsExportSageKHK]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Budget_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Budget_Status] ON [dbo].[Budget]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Bundesland_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Bundesland_Status] ON [dbo].[Bundesland]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BundeslandFeiertage_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BundeslandFeiertage_Datum] ON [dbo].[BundeslandFeiertage]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [BundeslandFeiertage_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [BundeslandFeiertage_Status] ON [dbo].[BundeslandFeiertage]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IDX_CachedTableStatistics_TableName]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IDX_CachedTableStatistics_TableName] ON [dbo].[CachedTableStatistics]
(
	[TableName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IDX_CacheMspArticleStatistics_ArticleCodeGrouped]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IDX_CacheMspArticleStatistics_ArticleCodeGrouped] ON [dbo].[CacheMspArticleStatistics]
(
	[ArticleCodeGrouped] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IDX_CacheMspArticleStatistics_ArticleI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IDX_CacheMspArticleStatistics_ArticleI3D] ON [dbo].[CacheMspArticleStatistics]
(
	[ArticleI3D] ASC,
	[ContractI3D] ASC
)
INCLUDE([ArticleCodeGrouped],[ArticleCaptionGrouped]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheOrderStatistic_CustomerNumber]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheOrderStatistic_CustomerNumber] ON [dbo].[CacheOrderStatistic]
(
	[CustomerNumber] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheOrderStatistic_Date_BranchI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheOrderStatistic_Date_BranchI3D] ON [dbo].[CacheOrderStatistic]
(
	[Date] DESC,
	[BranchI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheOrderStatistic_Date_CustomerNumber]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheOrderStatistic_Date_CustomerNumber] ON [dbo].[CacheOrderStatistic]
(
	[Date] DESC,
	[CustomerNumber] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idx_CacheOrderStatistic_MaterialGroup_Date]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheOrderStatistic_MaterialGroup_Date] ON [dbo].[CacheOrderStatistic]
(
	[MaterialGroup] ASC,
	[Date] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idx_CacheOrderStatistic_ServiceArticleEmployee_Date]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheOrderStatistic_ServiceArticleEmployee_Date] ON [dbo].[CacheOrderStatistic]
(
	[ServiceArticleEmployee] ASC,
	[Date] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheSalesStatistic_CustomerNumber]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheSalesStatistic_CustomerNumber] ON [dbo].[CacheSalesStatistic]
(
	[CustomerNumber] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheSalesStatistic_Date_BranchI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheSalesStatistic_Date_BranchI3D] ON [dbo].[CacheSalesStatistic]
(
	[Date] DESC,
	[BranchI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheSalesStatistic_Date_CustomerNumber]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheSalesStatistic_Date_CustomerNumber] ON [dbo].[CacheSalesStatistic]
(
	[Date] DESC,
	[CustomerNumber] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idx_CacheSalesStatistic_MaterialGroup_Date_IsContractInvoice]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheSalesStatistic_MaterialGroup_Date_IsContractInvoice] ON [dbo].[CacheSalesStatistic]
(
	[MaterialGroup] ASC,
	[Date] DESC,
	[IsContractInvoice] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idx_CacheSalesStatistic_ServiceArticleEmployee_Date]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheSalesStatistic_ServiceArticleEmployee_Date] ON [dbo].[CacheSalesStatistic]
(
	[ServiceArticleEmployee] ASC,
	[Date] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheTicketStatistic_ChangedDate]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheTicketStatistic_ChangedDate] ON [dbo].[CacheTicketStatistic]
(
	[ChangedDate] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheTicketStatistic_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheTicketStatistic_CustomerI3D] ON [dbo].[CacheTicketStatistic]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_CacheTicketStatistic_Number]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idx_CacheTicketStatistic_Number] ON [dbo].[CacheTicketStatistic]
(
	[Number] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CallTrackingHelpdeskKategorieVorlagen_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CallTrackingHelpdeskKategorieVorlagen_Art] ON [dbo].[CallTrackingHelpdeskKategorieVorlagen]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CallTrackingHelpdeskKategorieVorlagen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CallTrackingHelpdeskKategorieVorlagen_Status] ON [dbo].[CallTrackingHelpdeskKategorieVorlagen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CampaignEmployees_Campaign]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CampaignEmployees_Campaign] ON [dbo].[CampaignEmployees]
(
	[CampaignI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CampaignEmployees_CampaignParticipant]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CampaignEmployees_CampaignParticipant] ON [dbo].[CampaignEmployees]
(
	[CampaignParticipantI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CampaignParticipantContactPerson_CampaignParticipant]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CampaignParticipantContactPerson_CampaignParticipant] ON [dbo].[CampaignParticipantContactPerson]
(
	[CampaignParticipantI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronChecklistCustomerMappings_AddressContactI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronChecklistCustomerMappings_AddressContactI3D] ON [dbo].[CentronChecklistCustomerMappings]
(
	[AddressContactI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronChecklistCustomerMappings_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronChecklistCustomerMappings_CustomerI3D] ON [dbo].[CentronChecklistCustomerMappings]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronChecklistItems_ChecklistI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronChecklistItems_ChecklistI3D] ON [dbo].[CentronChecklistItems]
(
	[ChecklistI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronChecklistItems_ChecklistI3D_ParentChecklistItemI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronChecklistItems_ChecklistI3D_ParentChecklistItemI3D] ON [dbo].[CentronChecklistItems]
(
	[ChecklistI3D] ASC,
	[ParentChecklistItemI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronChecklistItems_ParentChecklistItemI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronChecklistItems_ParentChecklistItemI3D] ON [dbo].[CentronChecklistItems]
(
	[ParentChecklistItemI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronChecklists_IsTemplate_IsActive]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronChecklists_IsTemplate_IsActive] ON [dbo].[CentronChecklists]
(
	[IsTemplate] ASC,
	[IsActive] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronChecklists_ObjectI3D_ObjectKind_IsActive]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronChecklists_ObjectI3D_ObjectKind_IsActive] ON [dbo].[CentronChecklists]
(
	[ObjectI3D] ASC,
	[ObjectKind] ASC,
	[IsActive] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronChecklists_ObjectI3D_ObjectKind_IsTemplate_IsActive]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronChecklists_ObjectI3D_ObjectKind_IsTemplate_IsActive] ON [dbo].[CentronChecklists]
(
	[ObjectI3D] ASC,
	[ObjectKind] ASC,
	[IsTemplate] ASC,
	[IsActive] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CentronConstant_ConstantName]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronConstant_ConstantName] ON [dbo].[CentronConstant]
(
	[ConstantName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronConstant_ConstantTypeI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronConstant_ConstantTypeI3D] ON [dbo].[CentronConstant]
(
	[ConstantTypeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronConstant_Value]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronConstant_Value] ON [dbo].[CentronConstant]
(
	[Value] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronErinnerung_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronErinnerung_Datum] ON [dbo].[CentronErinnerung]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronErinnerung_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronErinnerung_Status] ON [dbo].[CentronErinnerung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronLog_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronLog_Datum] ON [dbo].[CentronLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronLog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronLog_Status] ON [dbo].[CentronLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronNews_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronNews_Status] ON [dbo].[CentronNews]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronNewsGelesen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronNewsGelesen_Status] ON [dbo].[CentronNewsGelesen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_CentronNotifications_ObjectKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IX_CentronNotifications_ObjectKind] ON [dbo].[CentronNotifications]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronWebLog_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronWebLog_Datum] ON [dbo].[CentronWebLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CentronWebLog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CentronWebLog_Status] ON [dbo].[CentronWebLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CITNachnamen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CITNachnamen_Status] ON [dbo].[CITNachnamen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CITTagName_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CITTagName_Name] ON [dbo].[CITTagName]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CITTagName_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CITTagName_Status] ON [dbo].[CITTagName]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CITTagText_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CITTagText_Status] ON [dbo].[CITTagText]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CITVornamen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CITVornamen_Status] ON [dbo].[CITVornamen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ClickKopf_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ClickKopf_KundenI3D] ON [dbo].[ClickKopf]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ClickKopf_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ClickKopf_Name] ON [dbo].[ClickKopf]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ClickKopf_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ClickKopf_Nummer] ON [dbo].[ClickKopf]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ClickKopf_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ClickKopf_Status] ON [dbo].[ClickKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ClickPos_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ClickPos_Status] ON [dbo].[ClickPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ClickRechnung_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ClickRechnung_Status] ON [dbo].[ClickRechnung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManCPU_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManCPU_Status] ON [dbo].[CManCPU]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManEventLog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManEventLog_Status] ON [dbo].[CManEventLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManEventLogHiding_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManEventLogHiding_Status] ON [dbo].[CManEventLogHiding]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManExternalServices_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManExternalServices_KundenI3D] ON [dbo].[CManExternalServices]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManExternalServices_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManExternalServices_Status] ON [dbo].[CManExternalServices]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManHarddrive_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManHarddrive_Status] ON [dbo].[CManHarddrive]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManIntegrityDirectory_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManIntegrityDirectory_KundenI3D] ON [dbo].[CManIntegrityDirectory]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManIntegrityDirectory_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManIntegrityDirectory_Status] ON [dbo].[CManIntegrityDirectory]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManIntegrityFile_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManIntegrityFile_KundenI3D] ON [dbo].[CManIntegrityFile]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManIntegrityFile_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManIntegrityFile_Status] ON [dbo].[CManIntegrityFile]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManIntegrityServer_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManIntegrityServer_KundenI3D] ON [dbo].[CManIntegrityServer]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManIntegrityServer_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManIntegrityServer_Status] ON [dbo].[CManIntegrityServer]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManLANResources_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManLANResources_KundenI3D] ON [dbo].[CManLANResources]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManLANResources_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManLANResources_Status] ON [dbo].[CManLANResources]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CManMachine_ComputerID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManMachine_ComputerID] ON [dbo].[CManMachine]
(
	[ComputerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManMachine_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManMachine_KundenI3D] ON [dbo].[CManMachine]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManMachine_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManMachine_Status] ON [dbo].[CManMachine]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManMachineGroups_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManMachineGroups_KundenI3D] ON [dbo].[CManMachineGroups]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManMachineGroups_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManMachineGroups_Status] ON [dbo].[CManMachineGroups]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManMachineInformation_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManMachineInformation_Status] ON [dbo].[CManMachineInformation]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManMachineToGroup_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManMachineToGroup_Status] ON [dbo].[CManMachineToGroup]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CManNetInfo_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManNetInfo_Name] ON [dbo].[CManNetInfo]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManNetInfo_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManNetInfo_Status] ON [dbo].[CManNetInfo]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManNotifications_DeviceID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManNotifications_DeviceID] ON [dbo].[CManNotifications]
(
	[DeviceID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManNotifications_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManNotifications_Status] ON [dbo].[CManNotifications]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManOS_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManOS_Status] ON [dbo].[CManOS]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManPartition_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManPartition_Status] ON [dbo].[CManPartition]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CManPhysicalMemory_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManPhysicalMemory_Name] ON [dbo].[CManPhysicalMemory]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CManPhysicalMemory_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManPhysicalMemory_Status] ON [dbo].[CManPhysicalMemory]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManSerialNumbers_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManSerialNumbers_Status] ON [dbo].[CManSerialNumbers]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CManService_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManService_Name] ON [dbo].[CManService]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CManService_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManService_Status] ON [dbo].[CManService]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManSoftware_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManSoftware_Status] ON [dbo].[CManSoftware]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManThreshold_DeviceID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManThreshold_DeviceID] ON [dbo].[CManThreshold]
(
	[DeviceID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManThreshold_ObjektArt]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManThreshold_ObjektArt] ON [dbo].[CManThreshold]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManThreshold_ObjektI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManThreshold_ObjektI3D] ON [dbo].[CManThreshold]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManThreshold_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManThreshold_Status] ON [dbo].[CManThreshold]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CManVideoController_DeviceID]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManVideoController_DeviceID] ON [dbo].[CManVideoController]
(
	[DeviceID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CManVideoController_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManVideoController_Name] ON [dbo].[CManVideoController]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManVideoController_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManVideoController_Status] ON [dbo].[CManVideoController]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CManVisioMap_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CManVisioMap_Status] ON [dbo].[CManVisioMap]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idx_ConnectionTickets_UniqueLogin]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE NONCLUSTERED INDEX [idx_ConnectionTickets_UniqueLogin] ON [dbo].[ConnectionTickets]
(
	[LicenseGUID] ASC,
	[DeviceID] ASC,
	[AppUserI3D] ASC,
	[WebAccountI3D] ASC,
	[MonitoringTokenI3D] ASC,
	[ApplicationID] ASC
)
INCLUDE([TicketID]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [NCI_ConnectionTickets_ExpireDate]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [NCI_ConnectionTickets_ExpireDate] ON [dbo].[ConnectionTickets]
(
	[ExpireDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ControllingAuswertung_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ControllingAuswertung_KundenI3D] ON [dbo].[ControllingAuswertung]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ControllingAuswertung_RechKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ControllingAuswertung_RechKopfI3D] ON [dbo].[ControllingAuswertung]
(
	[RechKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ControllingAuswertung_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ControllingAuswertung_Status] ON [dbo].[ControllingAuswertung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ControllingAuswertung_Warengruppe]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ControllingAuswertung_Warengruppe] ON [dbo].[ControllingAuswertung]
(
	[Warengruppe] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjekt_KundenI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjekt_KundenI3D] ON [dbo].[CRMProjekt]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CRMProjekt_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjekt_Name] ON [dbo].[CRMProjekt]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjekt_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjekt_Nummer] ON [dbo].[CRMProjekt]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjekt_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjekt_Status] ON [dbo].[CRMProjekt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjektart_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjektart_Nummer] ON [dbo].[CRMProjektart]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjektart_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjektart_Status] ON [dbo].[CRMProjektart]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjektBetrag_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjektBetrag_Status] ON [dbo].[CRMProjektBetrag]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjektObjekt_ObjektArt]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjektObjekt_ObjektArt] ON [dbo].[CRMProjektObjekt]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjektObjekt_ObjektI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjektObjekt_ObjektI3D] ON [dbo].[CRMProjektObjekt]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjektObjekt_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjektObjekt_Status] ON [dbo].[CRMProjektObjekt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjektStatus_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjektStatus_Nummer] ON [dbo].[CRMProjektStatus]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMProjektStatus_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMProjektStatus_Status] ON [dbo].[CRMProjektStatus]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMWahrscheinlichkeit_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMWahrscheinlichkeit_Nummer] ON [dbo].[CRMWahrscheinlichkeit]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CRMWahrscheinlichkeit_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CRMWahrscheinlichkeit_Status] ON [dbo].[CRMWahrscheinlichkeit]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [csi_InfoMail_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [csi_InfoMail_Status] ON [dbo].[csi_InfoMail]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Arbeitsplan_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitsplan_Art] ON [dbo].[CSK_Arbeitsplan]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Arbeitsplan_ArtikelI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitsplan_ArtikelI3D] ON [dbo].[CSK_Arbeitsplan]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Arbeitsplan_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitsplan_Status] ON [dbo].[CSK_Arbeitsplan]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Arbeitsschritt_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Arbeitsschritt_Status] ON [dbo].[CSK_Arbeitsschritt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CTRCallRecipientGroups_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRCallRecipientGroups_Status] ON [dbo].[CTRCallRecipientGroups]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CTRCallRecipients_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRCallRecipients_Status] ON [dbo].[CTRCallRecipients]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CTRCalls_Artikelcode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRCalls_Artikelcode] ON [dbo].[CTRCalls]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CTRCalls_Nummer]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRCalls_Nummer] ON [dbo].[CTRCalls]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CTRCallTypes_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRCallTypes_Status] ON [dbo].[CTRCallTypes]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CTRGeschaeftspartner_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRGeschaeftspartner_Name] ON [dbo].[CTRGeschaeftspartner]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CTRGeschaeftspartner_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRGeschaeftspartner_Status] ON [dbo].[CTRGeschaeftspartner]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CTRTypes_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRTypes_Art] ON [dbo].[CTRTypes]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CTRTypes_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRTypes_CustomerI3D] ON [dbo].[CTRTypes]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CTRTypes_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CTRTypes_Status] ON [dbo].[CTRTypes]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CustomerLog_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomerLog_CustomerI3D] ON [dbo].[CustomerLog]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CustomerLog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomerLog_Status] ON [dbo].[CustomerLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CustomerMonitoringSettings_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomerMonitoringSettings_CustomerI3D] ON [dbo].[CustomerMonitoringSettings]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CustomerMonitoringSettings_ObjectI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomerMonitoringSettings_ObjectI3D] ON [dbo].[CustomerMonitoringSettings]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CustomerMonitoringSettings_ObjectKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomerMonitoringSettings_ObjectKind] ON [dbo].[CustomerMonitoringSettings]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CustomerSettings_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomerSettings_CustomerI3D] ON [dbo].[CustomerSettings]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [CustomerSettings_Kind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomerSettings_Kind] ON [dbo].[CustomerSettings]
(
	[Kind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CustomerToMonitoringClient_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomerToMonitoringClient_CustomerI3D] ON [dbo].[CustomerToMonitoringClient]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [CustomSearchResults_Type]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [CustomSearchResults_Type] ON [dbo].[CustomSearchResults]
(
	[Type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DauerTermin_I3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DauerTermin_I3D] ON [dbo].[DauerTermin]
(
	[I3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DauerTermin_ObjektArt]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DauerTermin_ObjektArt] ON [dbo].[DauerTermin]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DauerTermin_ObjektI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DauerTermin_ObjektI3D] ON [dbo].[DauerTermin]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DauerTermin_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DauerTermin_Status] ON [dbo].[DauerTermin]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DBUpdate_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DBUpdate_Datum] ON [dbo].[DBUpdate]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DBUpdate_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DBUpdate_Status] ON [dbo].[DBUpdate]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DeviceClickCounterImported_Barcode]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DeviceClickCounterImported_Barcode] ON [dbo].[DeviceClickCounterImported]
(
	[Barcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DeviceClickCounterImported_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DeviceClickCounterImported_CustomerI3D] ON [dbo].[DeviceClickCounterImported]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DeviceClickCounterTypeMappings_Code]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DeviceClickCounterTypeMappings_Code] ON [dbo].[DeviceClickCounterTypeMappings]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DirectoryReference_ObjectI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DirectoryReference_ObjectI3D] ON [dbo].[DirectoryReference]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DirectoryReference_ObjectKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DirectoryReference_ObjectKind] ON [dbo].[DirectoryReference]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Directorys_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Directorys_Name] ON [dbo].[Directorys]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Directorys_OwnerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Directorys_OwnerI3D] ON [dbo].[Directorys]
(
	[OwnerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Directorys_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Directorys_Status] ON [dbo].[Directorys]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocMails_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocMails_Status] ON [dbo].[DocMails]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Documentation_ObjectI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Documentation_ObjectI3D] ON [dbo].[Documentation]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Documentation_ObjectKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Documentation_ObjectKind] ON [dbo].[Documentation]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Documentation_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Documentation_Status] ON [dbo].[Documentation]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationCategory_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationCategory_Status] ON [dbo].[DocumentationCategory]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationVersion_ObjectI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationVersion_ObjectI3D] ON [dbo].[DocumentationVersion]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationVersion_ObjectKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationVersion_ObjectKind] ON [dbo].[DocumentationVersion]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationVersion_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationVersion_Status] ON [dbo].[DocumentationVersion]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationWizard_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizard_CustomerI3D] ON [dbo].[DocumentationWizard]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocumentationWizard_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizard_Name] ON [dbo].[DocumentationWizard]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationWizard_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizard_Status] ON [dbo].[DocumentationWizard]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationWizardEntry_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizardEntry_Status] ON [dbo].[DocumentationWizardEntry]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocumentationWizardTemplate_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizardTemplate_Name] ON [dbo].[DocumentationWizardTemplate]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationWizardTemplate_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizardTemplate_Status] ON [dbo].[DocumentationWizardTemplate]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocumentationWizardTemplateDataBackup_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizardTemplateDataBackup_Name] ON [dbo].[DocumentationWizardTemplateDataBackup]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocumentationWizardTemplateDataMachine_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizardTemplateDataMachine_Name] ON [dbo].[DocumentationWizardTemplateDataMachine]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocumentationWizardTemplateDataMachine_Type]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizardTemplateDataMachine_Type] ON [dbo].[DocumentationWizardTemplateDataMachine]
(
	[Type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocumentationWizardTemplateEntry_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizardTemplateEntry_Name] ON [dbo].[DocumentationWizardTemplateEntry]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocumentationWizardTemplateEntry_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocumentationWizardTemplateEntry_Status] ON [dbo].[DocumentationWizardTemplateEntry]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IDX_DocumentFulltextIndex_TextValue]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [IDX_DocumentFulltextIndex_TextValue] ON [dbo].[DocumentFulltextIndex]
(
	[TextValue] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Documents_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Documents_Name] ON [dbo].[Documents]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Documents_OwnerDirI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Documents_OwnerDirI3D] ON [dbo].[Documents]
(
	[OwnerDirI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Documents_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Documents_Status] ON [dbo].[Documents]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idxDocuments_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [idxDocuments_Name] ON [dbo].[Documents]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocuWizard_CustomerI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizard_CustomerI3D] ON [dbo].[DocuWizard]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocuWizard_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizard_Name] ON [dbo].[DocuWizard]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocuWizard_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizard_Status] ON [dbo].[DocuWizard]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocuWizardBackupAndRestoreData_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizardBackupAndRestoreData_Name] ON [dbo].[DocuWizardBackupAndRestoreData]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocuWizardMachineData_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizardMachineData_Name] ON [dbo].[DocuWizardMachineData]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocuWizardMachineData_Type]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizardMachineData_Type] ON [dbo].[DocuWizardMachineData]
(
	[Type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocuWizardNetworkComponentData_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizardNetworkComponentData_Name] ON [dbo].[DocuWizardNetworkComponentData]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [DocuWizardNetworkComponentDataNetworkIP_I3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizardNetworkComponentDataNetworkIP_I3D] ON [dbo].[DocuWizardNetworkComponentDataNetworkIP]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocuWizardNetworkComponentDataSSID_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizardNetworkComponentDataSSID_Name] ON [dbo].[DocuWizardNetworkComponentDataSSID]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [DocuWizardNetworkStructureData_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [DocuWizardNetworkStructureData_Name] ON [dbo].[DocuWizardNetworkStructureData]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDI1Kopf_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDI1Kopf_Datum] ON [dbo].[EDI1Kopf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDI1Kopf_KalkKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDI1Kopf_KalkKopfI3D] ON [dbo].[EDI1Kopf]
(
	[KalkKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDI1Kopf_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDI1Kopf_Status] ON [dbo].[EDI1Kopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDI1Kopf_WareKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDI1Kopf_WareKopfI3D] ON [dbo].[EDI1Kopf]
(
	[WareKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDI1Pos_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDI1Pos_Status] ON [dbo].[EDI1Pos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDI1SN_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDI1SN_Status] ON [dbo].[EDI1SN]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIABKopf_BestKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIABKopf_BestKopfI3D] ON [dbo].[EDIABKopf]
(
	[BestKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIABKopf_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIABKopf_Status] ON [dbo].[EDIABKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIABPos_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIABPos_Status] ON [dbo].[EDIABPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIABTermine_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIABTermine_Status] ON [dbo].[EDIABTermine]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIActebisKopf_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIActebisKopf_Datum] ON [dbo].[EDIActebisKopf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIActebisKopf_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIActebisKopf_Status] ON [dbo].[EDIActebisKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIActebisPos_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIActebisPos_Status] ON [dbo].[EDIActebisPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIActebisSN_I3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIActebisSN_I3D] ON [dbo].[EDIActebisSN]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIActebisSN_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIActebisSN_Status] ON [dbo].[EDIActebisSN]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDILog_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDILog_Art] ON [dbo].[EDILog]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDILog_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDILog_Datum] ON [dbo].[EDILog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDILog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDILog_Status] ON [dbo].[EDILog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [EDIRechKopf_KalkKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIRechKopf_KalkKopfI3D] ON [dbo].[EDIRechKopf]
(
	[KalkKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIRechKopf_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIRechKopf_Status] ON [dbo].[EDIRechKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIRechKopf_WareKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIRechKopf_WareKopfI3D] ON [dbo].[EDIRechKopf]
(
	[WareKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIRechKopfBueroRing_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIRechKopfBueroRing_Status] ON [dbo].[EDIRechKopfBueroRing]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIRechPos_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIRechPos_Status] ON [dbo].[EDIRechPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIRechPosBueroRing_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIRechPosBueroRing_Status] ON [dbo].[EDIRechPosBueroRing]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIRechPosBueroRing_WareKopfI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIRechPosBueroRing_WareKopfI3D] ON [dbo].[EDIRechPosBueroRing]
(
	[WareKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDIRechSN_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDIRechSN_Status] ON [dbo].[EDIRechSN]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDISchnittstellenKonfiguration_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDISchnittstellenKonfiguration_Art] ON [dbo].[EDISchnittstellenKonfiguration]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDISchnittstellenKonfiguration_ObjektI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDISchnittstellenKonfiguration_ObjektI3D] ON [dbo].[EDISchnittstellenKonfiguration]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDISchnittstellenKonfiguration_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDISchnittstellenKonfiguration_Status] ON [dbo].[EDISchnittstellenKonfiguration]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDISchnittstellenLOGDetails_ObjektArt]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDISchnittstellenLOGDetails_ObjektArt] ON [dbo].[EDISchnittstellenLOGDetails]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDISchnittstellenLOGDetails_ObjektI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDISchnittstellenLOGDetails_ObjektI3D] ON [dbo].[EDISchnittstellenLOGDetails]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EDISchnittstellenLOGDetails_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EDISchnittstellenLOGDetails_Status] ON [dbo].[EDISchnittstellenLOGDetails]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Einheiten_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Einheiten_Art] ON [dbo].[Einheiten]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Einheiten_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Einheiten_Status] ON [dbo].[Einheiten]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EmployeeFavorites_ObjectI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EmployeeFavorites_ObjectI3D] ON [dbo].[EmployeeFavorites]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EmployeeFavorites_ObjectKind]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EmployeeFavorites_ObjectKind] ON [dbo].[EmployeeFavorites]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IDX_EmployeeRfidTokens_RfidTokenEncrypted]    Script Date: 11.11.2025 11:20:29 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IDX_EmployeeRfidTokens_RfidTokenEncrypted] ON [dbo].[EmployeeRfidTokens]
(
	[RfidTokenEncrypted] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EmployeeStatistic_I3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EmployeeStatistic_I3D] ON [dbo].[EmployeeStatistic]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [EmployeeTeam_Name]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EmployeeTeam_Name] ON [dbo].[EmployeeTeam]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Eskalationen_ObjektI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Eskalationen_ObjektI3D] ON [dbo].[Eskalationen]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Eskalationen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [Eskalationen_Status] ON [dbo].[Eskalationen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EskalationStatistik_Art]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EskalationStatistik_Art] ON [dbo].[EskalationStatistik]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EskalationStatistik_ObjektArt]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EskalationStatistik_ObjektArt] ON [dbo].[EskalationStatistik]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EskalationStatistik_ObjektI3D]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EskalationStatistik_ObjektI3D] ON [dbo].[EskalationStatistik]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EskalationStatistik_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EskalationStatistik_Status] ON [dbo].[EskalationStatistik]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [EskalationTypen_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [EskalationTypen_Status] ON [dbo].[EskalationTypen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ExceptionLog_Datum]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ExceptionLog_Datum] ON [dbo].[ExceptionLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ExceptionLog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ExceptionLog_Status] ON [dbo].[ExceptionLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ExceptionLog_UserName]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ExceptionLog_UserName] ON [dbo].[ExceptionLog]
(
	[UserName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ExportLog_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [ExportLog_Status] ON [dbo].[ExportLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FahrkTXT_Land]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [FahrkTXT_Land] ON [dbo].[FahrkTXT]
(
	[Land] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FahrkTXT_Status]    Script Date: 11.11.2025 11:20:29 ******/
CREATE NONCLUSTERED INDEX [FahrkTXT_Status] ON [dbo].[FahrkTXT]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FahrzeugArt_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FahrzeugArt_Status] ON [dbo].[FahrzeugArt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FahrzeugBetankung_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FahrzeugBetankung_Datum] ON [dbo].[FahrzeugBetankung]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FahrzeugBetankung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FahrzeugBetankung_Status] ON [dbo].[FahrzeugBetankung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Fahrzeuge_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Fahrzeuge_Status] ON [dbo].[Fahrzeuge]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FahrzeuzgMotorart_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FahrzeuzgMotorart_Status] ON [dbo].[FahrzeuzgMotorart]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FertigungsPlanung_AufPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FertigungsPlanung_AufPosI3D] ON [dbo].[FertigungsPlanung]
(
	[AufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FertigungsPlanung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FertigungsPlanung_Status] ON [dbo].[FertigungsPlanung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FibuExportBuchungstextEinstellungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FibuExportBuchungstextEinstellungen_Status] ON [dbo].[FibuExportBuchungstextEinstellungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Filiale_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Filiale_KundenI3D] ON [dbo].[Filiale]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Filiale_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Filiale_Status] ON [dbo].[Filiale]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FilialeLeiter_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FilialeLeiter_Status] ON [dbo].[FilialeLeiter]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FilialeToLager_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FilialeToLager_LagerI3D] ON [dbo].[FilialeToLager]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FilialeToLager_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FilialeToLager_Status] ON [dbo].[FilialeToLager]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FirmenStrukturen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FirmenStrukturen_Status] ON [dbo].[FirmenStrukturen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FormularInformationen_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FormularInformationen_I3D] ON [dbo].[FormularInformationen]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FremdArtikelImportLog_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdArtikelImportLog_Datum] ON [dbo].[FremdArtikelImportLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FremdArtikelImportLog_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdArtikelImportLog_Status] ON [dbo].[FremdArtikelImportLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [FremdherstellerZuKreditor_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdherstellerZuKreditor_Hersteller] ON [dbo].[FremdherstellerZuKreditor]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FremdherstellerZuKreditor_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdherstellerZuKreditor_Status] ON [dbo].[FremdherstellerZuKreditor]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FremdImport_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdImport_Code] ON [dbo].[FremdImport]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FremdImport_EANCODE]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdImport_EANCODE] ON [dbo].[FremdImport]
(
	[EANCODE] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FremdImport_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdImport_Hersteller] ON [dbo].[FremdImport]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [FremdImport_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdImport_Name] ON [dbo].[FremdImport]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [FremdImport_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [FremdImport_Status] ON [dbo].[FremdImport]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteClickZaehler_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteClickZaehler_ArtikelI3D] ON [dbo].[GeraeteClickZaehler]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteClickZaehler_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteClickZaehler_Status] ON [dbo].[GeraeteClickZaehler]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteClickZaehlerHistory_RechPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteClickZaehlerHistory_RechPosI3D] ON [dbo].[GeraeteClickZaehlerHistory]
(
	[RechPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteClickZaehlerHistory_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteClickZaehlerHistory_Status] ON [dbo].[GeraeteClickZaehlerHistory]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeraeteCMan_ComputerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCMan_ComputerID] ON [dbo].[GeraeteCMan]
(
	[ComputerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCMan_DeviceID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCMan_DeviceID] ON [dbo].[GeraeteCMan]
(
	[DeviceID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCMan_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCMan_KundenI3D] ON [dbo].[GeraeteCMan]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCMan_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCMan_Status] ON [dbo].[GeraeteCMan]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManAttribut_DeviceID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManAttribut_DeviceID] ON [dbo].[GeraeteCManAttribut]
(
	[DeviceID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManAttribut_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManAttribut_Status] ON [dbo].[GeraeteCManAttribut]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeraeteCManClientSettings_ComputerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManClientSettings_ComputerID] ON [dbo].[GeraeteCManClientSettings]
(
	[ComputerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManClientSettings_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManClientSettings_KundenI3D] ON [dbo].[GeraeteCManClientSettings]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManClientSettings_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManClientSettings_Status] ON [dbo].[GeraeteCManClientSettings]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManDevice_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManDevice_Status] ON [dbo].[GeraeteCManDevice]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeraeteCManEventLog_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManEventLog_Code] ON [dbo].[GeraeteCManEventLog]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeraeteCManEventLog_ComputerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManEventLog_ComputerID] ON [dbo].[GeraeteCManEventLog]
(
	[ComputerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManEventLog_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManEventLog_Datum] ON [dbo].[GeraeteCManEventLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManEventLog_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManEventLog_Status] ON [dbo].[GeraeteCManEventLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManServerSettings_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManServerSettings_KundenI3D] ON [dbo].[GeraeteCManServerSettings]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteCManServerSettings_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteCManServerSettings_Status] ON [dbo].[GeraeteCManServerSettings]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_AnschriftID] ON [dbo].[GeraeteKopf]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_AussendienstID] ON [dbo].[GeraeteKopf]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeraeteKopf_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_Code] ON [dbo].[GeraeteKopf]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_Datum] ON [dbo].[GeraeteKopf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_InnendienstID] ON [dbo].[GeraeteKopf]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_KundenI3D] ON [dbo].[GeraeteKopf]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeraeteKopf_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_KurzZeich] ON [dbo].[GeraeteKopf]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_Nummer] ON [dbo].[GeraeteKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_Status] ON [dbo].[GeraeteKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_Techniker2ID] ON [dbo].[GeraeteKopf]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteKopf_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteKopf_TechnikerID] ON [dbo].[GeraeteKopf]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraetePos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraetePos_ArtikelI3D] ON [dbo].[GeraetePos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeraetePos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraetePos_EANCode] ON [dbo].[GeraetePos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraetePos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraetePos_GeraeteBarcodeI3D] ON [dbo].[GeraetePos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeraetePos_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraetePos_HerstCode] ON [dbo].[GeraetePos]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraetePos_RechPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraetePos_RechPosI3D] ON [dbo].[GeraetePos]
(
	[RechPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraetePos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraetePos_Status] ON [dbo].[GeraetePos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraetePos_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraetePos_Ursprung] ON [dbo].[GeraetePos]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraetePos_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraetePos_UrsprungI3D] ON [dbo].[GeraetePos]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteWartung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteWartung_Status] ON [dbo].[GeraeteWartung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteWartung_ToDoListeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteWartung_ToDoListeI3D] ON [dbo].[GeraeteWartung]
(
	[ToDoListeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteWartungHistory_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteWartungHistory_Datum] ON [dbo].[GeraeteWartungHistory]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteWartungHistory_RechKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteWartungHistory_RechKopfI3D] ON [dbo].[GeraeteWartungHistory]
(
	[RechKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeraeteWartungHistory_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeraeteWartungHistory_Status] ON [dbo].[GeraeteWartungHistory]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeschaeftspartnerTextbausteine_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeschaeftspartnerTextbausteine_KundenI3D] ON [dbo].[GeschaeftspartnerTextbausteine]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeschaeftspartnerTextbausteine_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeschaeftspartnerTextbausteine_Status] ON [dbo].[GeschaeftspartnerTextbausteine]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GeschaeftspartnerTextbausteineGruppen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeschaeftspartnerTextbausteineGruppen_Name] ON [dbo].[GeschaeftspartnerTextbausteineGruppen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GeschaeftspartnerTextbausteineGruppen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GeschaeftspartnerTextbausteineGruppen_Status] ON [dbo].[GeschaeftspartnerTextbausteineGruppen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [gi_Grid_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [gi_Grid_Name] ON [dbo].[gi_Grid]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [gi_GridColumn_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [gi_GridColumn_Name] ON [dbo].[gi_GridColumn]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GlobalLog_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GlobalLog_Datum] ON [dbo].[GlobalLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GlobalLog_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GlobalLog_ObjektArt] ON [dbo].[GlobalLog]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GlobalLog_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GlobalLog_ObjektI3D] ON [dbo].[GlobalLog]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GlobalLog_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GlobalLog_Status] ON [dbo].[GlobalLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GroupwareEntryIDs_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GroupwareEntryIDs_ObjektArt] ON [dbo].[GroupwareEntryIDs]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GroupwareEntryIDs_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GroupwareEntryIDs_ObjektI3D] ON [dbo].[GroupwareEntryIDs]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GroupwareEntryIDs_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GroupwareEntryIDs_Status] ON [dbo].[GroupwareEntryIDs]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopf_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopf_AnschriftID] ON [dbo].[GutKopf]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopf_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopf_KundenID] ON [dbo].[GutKopf]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixGutKopf_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutKopf_AussendienstID] ON [dbo].[GutKopf]
(
	[AussendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixGutKopf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutKopf_Datum] ON [dbo].[GutKopf]
(
	[Datum] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixGutKopf_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutKopf_InnendienstID] ON [dbo].[GutKopf]
(
	[InnendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixGutKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutKopf_Nummer] ON [dbo].[GutKopf]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixGutKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutKopf_Techniker2ID] ON [dbo].[GutKopf]
(
	[Techniker2ID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixGutKopf_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutKopf_TechnikerID] ON [dbo].[GutKopf]
(
	[TechnikerID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfErweitert_GutkopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfErweitert_GutkopfI3D] ON [dbo].[GutKopfErweitert]
(
	[GutkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfErweitert_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfErweitert_Status] ON [dbo].[GutKopfErweitert]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfErweitertVersions_GutkopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfErweitertVersions_GutkopfI3D] ON [dbo].[GutKopfErweitertVersions]
(
	[GutkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfErweitertVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfErweitertVersions_Status] ON [dbo].[GutKopfErweitertVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_AnschriftID] ON [dbo].[GutKopfVersions]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_AussendienstID] ON [dbo].[GutKopfVersions]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_Datum] ON [dbo].[GutKopfVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_InnendienstID] ON [dbo].[GutKopfVersions]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_KundenID] ON [dbo].[GutKopfVersions]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_Nummer] ON [dbo].[GutKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_Status] ON [dbo].[GutKopfVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_Techniker2ID] ON [dbo].[GutKopfVersions]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutKopfVersions_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutKopfVersions_TechnikerID] ON [dbo].[GutKopfVersions]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GutPos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPos_EANCode] ON [dbo].[GutPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPos_GeraeteBarcodeI3D] ON [dbo].[GutPos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPos_Status] ON [dbo].[GutPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPos_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPos_Ursprung] ON [dbo].[GutPos]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ix_GutPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ix_GutPos_Art] ON [dbo].[GutPos]
(
	[Art] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_GutPos_UrsprungI3D_UrsprungArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_GutPos_UrsprungI3D_UrsprungArt] ON [dbo].[GutPos]
(
	[UrsprungI3D] ASC,
	[UrsprungArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixGutPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutPos_ArtikelI3D] ON [dbo].[GutPos]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixGutPos_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutPos_Code] ON [dbo].[GutPos]
(
	[Code] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixGutPos_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixGutPos_HerstCode] ON [dbo].[GutPos]
(
	[HerstCode] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPosVersions_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_Art] ON [dbo].[GutPosVersions]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPosVersions_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_ArtikelI3D] ON [dbo].[GutPosVersions]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GutPosVersions_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_Code] ON [dbo].[GutPosVersions]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GutPosVersions_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_EANCode] ON [dbo].[GutPosVersions]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPosVersions_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_GeraeteBarcodeI3D] ON [dbo].[GutPosVersions]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPosVersions_GutKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_GutKopfI3D] ON [dbo].[GutPosVersions]
(
	[GutKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [GutPosVersions_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_HerstCode] ON [dbo].[GutPosVersions]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPosVersions_KopfVersionsI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_KopfVersionsI3D] ON [dbo].[GutPosVersions]
(
	[KopfVersionsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutPosVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutPosVersions_Status] ON [dbo].[GutPosVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutProv_GutKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutProv_GutKopfI3D] ON [dbo].[GutProv]
(
	[GutKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutscheinZuRechnung_SNI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutscheinZuRechnung_SNI3D] ON [dbo].[GutscheinZuRechnung]
(
	[SNI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [GutscheinZuRechnung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [GutscheinZuRechnung_Status] ON [dbo].[GutscheinZuRechnung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_HelpdeskFavorites_EmployeeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_HelpdeskFavorites_EmployeeI3D] ON [dbo].[HelpdeskFavorites]
(
	[EmployeeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HelpdeskTimeRecording_Kind]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HelpdeskTimeRecording_Kind] ON [dbo].[HelpdeskTimeRecording]
(
	[Kind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_HelpdeskTimeRecording_Guid]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_HelpdeskTimeRecording_Guid] ON [dbo].[HelpdeskTimeRecording]
(
	[Guid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Hersteller_AnsprechI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Hersteller_AnsprechI3D] ON [dbo].[Hersteller]
(
	[AnsprechI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Hersteller_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Hersteller_Hersteller] ON [dbo].[Hersteller]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [HerstellerArtik_CODE]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerArtik_CODE] ON [dbo].[HerstellerArtik]
(
	[Code] ASC
)
INCLUDE([I3D],[VerfuegbarkeitStk]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [HerstellerArtik_EANCODE]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerArtik_EANCODE] ON [dbo].[HerstellerArtik]
(
	[EANCODE] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [idxHerstellerArtik_KreditorNr]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idxHerstellerArtik_KreditorNr] ON [dbo].[HerstellerArtik]
(
	[KreditorNr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerArtikAktionspreis_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerArtikAktionspreis_ArtikelI3D] ON [dbo].[HerstellerArtikAktionspreis]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [HerstellerArtikAktionspreis_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerArtikAktionspreis_Hersteller] ON [dbo].[HerstellerArtikAktionspreis]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerArtikAktionspreis_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerArtikAktionspreis_Status] ON [dbo].[HerstellerArtikAktionspreis]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerArtikStaffelpreise_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerArtikStaffelpreise_Status] ON [dbo].[HerstellerArtikStaffelpreise]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [HerstellerImport_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerImport_Name] ON [dbo].[HerstellerImport]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerImport_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerImport_Status] ON [dbo].[HerstellerImport]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerImportDateien_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerImportDateien_Status] ON [dbo].[HerstellerImportDateien]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerImportMultiDistributoren_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerImportMultiDistributoren_Status] ON [dbo].[HerstellerImportMultiDistributoren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerImportZuweisung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerImportZuweisung_Status] ON [dbo].[HerstellerImportZuweisung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerVerfuegbarToCentron_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerVerfuegbarToCentron_Status] ON [dbo].[HerstellerVerfuegbarToCentron]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerWaren_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerWaren_Status] ON [dbo].[HerstellerWaren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [HerstellerWaren_UWG1]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerWaren_UWG1] ON [dbo].[HerstellerWaren]
(
	[UWG1] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [HerstellerWaren_UWG2]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerWaren_UWG2] ON [dbo].[HerstellerWaren]
(
	[UWG2] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [HerstellerWaren_WG]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerWaren_WG] ON [dbo].[HerstellerWaren]
(
	[WG] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerWarenZuWaren_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerWarenZuWaren_Status] ON [dbo].[HerstellerWarenZuWaren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [HerstellerWarenZuWaren_Warengruppe]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [HerstellerWarenZuWaren_Warengruppe] ON [dbo].[HerstellerWarenZuWaren]
(
	[Warengruppe] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [hlpdsk_8DReport_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_8DReport_Code] ON [dbo].[hlpdsk_8DReport]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_8DReport_hlpdsk_requestsI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_8DReport_hlpdsk_requestsI3D] ON [dbo].[hlpdsk_8DReport]
(
	[hlpdsk_requestsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_8DReport_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_8DReport_Status] ON [dbo].[hlpdsk_8DReport]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_8DReportTexte_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_8DReportTexte_Art] ON [dbo].[hlpdsk_8DReportTexte]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_8DReportTexte_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_8DReportTexte_Datum] ON [dbo].[hlpdsk_8DReportTexte]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [hlpdsk_8DReportTexte_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_8DReportTexte_Name] ON [dbo].[hlpdsk_8DReportTexte]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_8DReportTexte_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_8DReportTexte_Status] ON [dbo].[hlpdsk_8DReportTexte]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_cmanage_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_cmanage_Status] ON [dbo].[hlpdsk_cmanage]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_history_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_history_Datum] ON [dbo].[hlpdsk_history]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [hlpdsk_history_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_history_Nummer] ON [dbo].[hlpdsk_history]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_history_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_history_Status] ON [dbo].[hlpdsk_history]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_hlpdsk_history_RequestI3DDate]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_hlpdsk_history_RequestI3DDate] ON [dbo].[hlpdsk_history]
(
	[RequestI3D] ASC,
	[Datum] DESC
)
INCLUDE([Aktion]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_history_empfaenger_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_history_empfaenger_Status] ON [dbo].[hlpdsk_history_empfaenger]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_kategorien_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_kategorien_Nummer] ON [dbo].[hlpdsk_kategorien]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_kategorien_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_kategorien_Status] ON [dbo].[hlpdsk_kategorien]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_loesungen_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_loesungen_Nummer] ON [dbo].[hlpdsk_loesungen]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_loesungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_loesungen_Status] ON [dbo].[hlpdsk_loesungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [hlpdsk_nable_link_DeviceID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_nable_link_DeviceID] ON [dbo].[hlpdsk_nable_link]
(
	[DeviceID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_prioritaeten_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_prioritaeten_Status] ON [dbo].[hlpdsk_prioritaeten]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_request_bearbeiter_PersonalI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_request_bearbeiter_PersonalI3D] ON [dbo].[hlpdsk_request_bearbeiter]
(
	[PersonalI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_request_bearbeiter_RequestI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_request_bearbeiter_RequestI3D] ON [dbo].[hlpdsk_request_bearbeiter]
(
	[RequestI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_request_bearbeiter_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_request_bearbeiter_Status] ON [dbo].[hlpdsk_request_bearbeiter]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_requests_LizenzKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_requests_LizenzKopfI3D] ON [dbo].[hlpdsk_requests]
(
	[LizenzKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_requests_nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_requests_nummer] ON [dbo].[hlpdsk_requests]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_requests_RechPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_requests_RechPosI3D] ON [dbo].[hlpdsk_requests]
(
	[RechPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_hlpdsk_requests_GeaendertDatum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idx_hlpdsk_requests_GeaendertDatum] ON [dbo].[hlpdsk_requests]
(
	[GeaendertDatum] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxHlpdsk_requests_KundeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idxHlpdsk_requests_KundeI3D] ON [dbo].[hlpdsk_requests]
(
	[KundeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_status_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_status_Status] ON [dbo].[hlpdsk_status]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [hlpdsk_templatekopf_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_templatekopf_Name] ON [dbo].[hlpdsk_templatekopf]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_templatekopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_templatekopf_Status] ON [dbo].[hlpdsk_templatekopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_templatepos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_templatepos_Status] ON [dbo].[hlpdsk_templatepos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_timer_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_timer_ArtikelI3D] ON [dbo].[hlpdsk_timer]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_timer_AufPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_timer_AufPosI3D] ON [dbo].[hlpdsk_timer]
(
	[AufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_timer_LiefPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_timer_LiefPosI3D] ON [dbo].[hlpdsk_timer]
(
	[LiefPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_timer_RechPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_timer_RechPosI3D] ON [dbo].[hlpdsk_timer]
(
	[RechPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_timer_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_timer_Status] ON [dbo].[hlpdsk_timer]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_hlpdsk_timer_RequestI3DBerechenbar]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_hlpdsk_timer_RequestI3DBerechenbar] ON [dbo].[hlpdsk_timer]
(
	[RequestI3D] ASC,
	[Berechenbar] ASC
)
INCLUDE([Timer],[PausedTime],[LunchTime]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_timer_log_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_timer_log_Status] ON [dbo].[hlpdsk_timer_log]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_timer_typen_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_timer_typen_Nummer] ON [dbo].[hlpdsk_timer_typen]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_timer_typen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_timer_typen_Status] ON [dbo].[hlpdsk_timer_typen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_typen_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_typen_Nummer] ON [dbo].[hlpdsk_typen]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [hlpdsk_typen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [hlpdsk_typen_Status] ON [dbo].[hlpdsk_typen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Hotline_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Hotline_KundenID] ON [dbo].[Hotline]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Hotline_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Hotline_Status] ON [dbo].[Hotline]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Hotline_Username]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Hotline_Username] ON [dbo].[Hotline]
(
	[Username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [I3D_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [I3D_Status] ON [dbo].[I3D]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ICUConfig_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ICUConfig_Status] ON [dbo].[ICUConfig]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ImportLog_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ImportLog_Status] ON [dbo].[ImportLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Imports_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Imports_Status] ON [dbo].[Imports]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [InfoMail_PersonalI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InfoMail_PersonalI3D] ON [dbo].[InfoMail]
(
	[PersonalI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InfoMail_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InfoMail_Status] ON [dbo].[InfoMail]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Interesse_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Interesse_Name] ON [dbo].[Interesse]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Interesse_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Interesse_Status] ON [dbo].[Interesse]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurArtikel_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurArtikel_Status] ON [dbo].[InventurArtikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_InventurArtikel]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_InventurArtikel] ON [dbo].[InventurArtikel]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurArtikels_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurArtikels_ArtikelI3D] ON [dbo].[InventurArtikels]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurArtikels_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurArtikels_LagerI3D] ON [dbo].[InventurArtikels]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurArtikels_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurArtikels_Status] ON [dbo].[InventurArtikels]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurBuchungen_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurBuchungen_Art] ON [dbo].[InventurBuchungen]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurBuchungen_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurBuchungen_ArtikelI3D] ON [dbo].[InventurBuchungen]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurBuchungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurBuchungen_Status] ON [dbo].[InventurBuchungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurLieferscheine_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurLieferscheine_ArtikelI3D] ON [dbo].[InventurLieferscheine]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurLieferscheine_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurLieferscheine_Status] ON [dbo].[InventurLieferscheine]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [InventurSeriennummern_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [InventurSeriennummern_Status] ON [dbo].[InventurSeriennummern]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixInventurSeriennummern_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixInventurSeriennummern_ArtikelI3D] ON [dbo].[InventurSeriennummern]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [iSeminare_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [iSeminare_Name] ON [dbo].[iSeminare]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [iSeminare_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [iSeminare_Status] ON [dbo].[iSeminare]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [iSeminareModeratoren_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [iSeminareModeratoren_Name] ON [dbo].[iSeminareModeratoren]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [iSeminareModeratoren_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [iSeminareModeratoren_Status] ON [dbo].[iSeminareModeratoren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [iSeminareModZuordnung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [iSeminareModZuordnung_Status] ON [dbo].[iSeminareModZuordnung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ITScopeTexte_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ITScopeTexte_Status] ON [dbo].[ITScopeTexte]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Jobs_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Jobs_Status] ON [dbo].[Jobs]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KalkKopf_AktuelleVersion]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkKopf_AktuelleVersion] ON [dbo].[KalkKopf]
(
	[AktuelleVersion] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KalkKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkKopf_Nummer] ON [dbo].[KalkKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxKalkPos_UebernommenAusI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idxKalkPos_UebernommenAusI3D] ON [dbo].[KalkPos]
(
	[UebernommenAusI3D] ASC,
	[UebernommenAusArt] ASC
)
INCLUDE([KalkKopfI3D]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KalkPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkPos_Art] ON [dbo].[KalkPos]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KalkPos_Artikelcode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkPos_Artikelcode] ON [dbo].[KalkPos]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KalkPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkPos_ArtikelI3D] ON [dbo].[KalkPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KalkPos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkPos_EANCode] ON [dbo].[KalkPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KalkPos_EKAusAufPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkPos_EKAusAufPosI3D] ON [dbo].[KalkPos]
(
	[EKAusAufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KalkPos_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkPos_Hersteller] ON [dbo].[KalkPos]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KalkPos_KalkKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KalkPos_KalkKopfI3D] ON [dbo].[KalkPos]
(
	[KalkKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kassenbuch_AnlageArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kassenbuch_AnlageArt] ON [dbo].[Kassenbuch]
(
	[AnlageArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kassenbuch_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kassenbuch_Art] ON [dbo].[Kassenbuch]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kassenbuch_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kassenbuch_Datum] ON [dbo].[Kassenbuch]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kassenbuch_RechKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kassenbuch_RechKopfI3D] ON [dbo].[Kassenbuch]
(
	[RechKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kassenbuch_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kassenbuch_Status] ON [dbo].[Kassenbuch]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KassenbuchAbschluss_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KassenbuchAbschluss_Datum] ON [dbo].[KassenbuchAbschluss]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KassenbuchAbschluss_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KassenbuchAbschluss_Status] ON [dbo].[KassenbuchAbschluss]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KassenBuchChangeLog_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KassenBuchChangeLog_Datum] ON [dbo].[KassenBuchChangeLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KassenBuchChangeLog_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KassenBuchChangeLog_Status] ON [dbo].[KassenBuchChangeLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KassenbuchZaehlHilfeLog_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KassenbuchZaehlHilfeLog_Datum] ON [dbo].[KassenbuchZaehlHilfeLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KassenbuchZaehlHilfeLog_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KassenbuchZaehlHilfeLog_Status] ON [dbo].[KassenbuchZaehlHilfeLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KassendisplayFilialEinstellungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KassendisplayFilialEinstellungen_Status] ON [dbo].[KassendisplayFilialEinstellungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KdDivers_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KdDivers_Status] ON [dbo].[KdDivers]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KdDivers0]    Script Date: 11.11.2025 11:20:30 ******/
CREATE UNIQUE NONCLUSTERED INDEX [KdDivers0] ON [dbo].[KdDivers]
(
	[Kundennummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Kontakte_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kontakte_Name] ON [dbo].[Kontakte]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kontakte_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kontakte_Nummer] ON [dbo].[Kontakte]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kontakte_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kontakte_Status] ON [dbo].[Kontakte]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KontaktePersonen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KontaktePersonen_Name] ON [dbo].[KontaktePersonen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KontaktePersonen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KontaktePersonen_Status] ON [dbo].[KontaktePersonen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kostenart_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kostenart_Status] ON [dbo].[Kostenart]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kostenstelle_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kostenstelle_Status] ON [dbo].[Kostenstelle]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Kostenstellen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kostenstellen_Name] ON [dbo].[Kostenstellen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Kostenstellen_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kostenstellen_Nummer] ON [dbo].[Kostenstellen]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Kostentraeger_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kostentraeger_Nummer] ON [dbo].[Kostentraeger]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kreditor_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kreditor_Hersteller] ON [dbo].[Kreditor]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kreditor_Kunde]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kreditor_Kunde] ON [dbo].[Kreditor]
(
	[Kunde] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Kreditor_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kreditor_Name] ON [dbo].[Kreditor]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kreditor_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kreditor_Status] ON [dbo].[Kreditor]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KreditorCodes_ArtikelCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KreditorCodes_ArtikelCode] ON [dbo].[KreditorCodes]
(
	[ArtikelCode] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KreditorCodes_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KreditorCodes_ArtikelI3D] ON [dbo].[KreditorCodes]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KreditorCodes_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KreditorCodes_Code] ON [dbo].[KreditorCodes]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KreditorCodes_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KreditorCodes_Status] ON [dbo].[KreditorCodes]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KreditorSonderposition_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KreditorSonderposition_Status] ON [dbo].[KreditorSonderposition]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KuendigungsArt_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KuendigungsArt_Status] ON [dbo].[KuendigungsArt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_Kunden_VertriebsgebietI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idx_Kunden_VertriebsgebietI3D] ON [dbo].[Kunden]
(
	[VertriebsgebietI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_Kunden_Status_Gesperrt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_Kunden_Status_Gesperrt] ON [dbo].[Kunden]
(
	[Status] ASC,
	[Gesperrt] ASC
)
INCLUDE([I3D],[Name],[TechnikerID],[Techniker2ID]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixTechniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixTechniker2ID] ON [dbo].[Kunden]
(
	[Techniker2ID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixTechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixTechnikerID] ON [dbo].[Kunden]
(
	[TechnikerID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kunden_Kreditor]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kunden_Kreditor] ON [dbo].[Kunden]
(
	[Kreditor] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kunden_KundenNummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kunden_KundenNummer] ON [dbo].[Kunden]
(
	[KundenNummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kunden_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kunden_LagerI3D] ON [dbo].[Kunden]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Kunden_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Kunden_Status] ON [dbo].[Kunden]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Main]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Main] ON [dbo].[Kunden]
(
	[I3D] ASC,
	[Name] ASC
)WITH (PAD_INDEX = ON, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixKundenBenachrichtigung_AnsprechI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixKundenBenachrichtigung_AnsprechI3D] ON [dbo].[KundenBenachrichtigung]
(
	[AnsprechI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixKundenBenachrichtigung_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixKundenBenachrichtigung_KundenI3D] ON [dbo].[KundenBenachrichtigung]
(
	[KundenI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenBenachrichtigung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenBenachrichtigung_Status] ON [dbo].[KundenBenachrichtigung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenBranche_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenBranche_KundenI3D] ON [dbo].[KundenBranche]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenBranche_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenBranche_Status] ON [dbo].[KundenBranche]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KundenDirectories_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenDirectories_Name] ON [dbo].[KundenDirectories]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenDirectories_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenDirectories_Status] ON [dbo].[KundenDirectories]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenFertigungskonfiguration_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenFertigungskonfiguration_KundenI3D] ON [dbo].[KundenFertigungskonfiguration]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenFertigungskonfiguration_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenFertigungskonfiguration_Status] ON [dbo].[KundenFertigungskonfiguration]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenHardlock_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenHardlock_KundenI3D] ON [dbo].[KundenHardlock]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenHardlock_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenHardlock_Status] ON [dbo].[KundenHardlock]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenHerkunft_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenHerkunft_Status] ON [dbo].[KundenHerkunft]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenInteresse_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenInteresse_KundenI3D] ON [dbo].[KundenInteresse]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenInteresse_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenInteresse_Status] ON [dbo].[KundenInteresse]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KundenKlassifizierung_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenKlassifizierung_Name] ON [dbo].[KundenKlassifizierung]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenKlassifizierung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenKlassifizierung_Status] ON [dbo].[KundenKlassifizierung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenKostenstelle_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenKostenstelle_KundenI3D] ON [dbo].[KundenKostenstelle]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KundenKostenstelle_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenKostenstelle_Nummer] ON [dbo].[KundenKostenstelle]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenKostenstelle_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenKostenstelle_Status] ON [dbo].[KundenKostenstelle]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenProdukt_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenProdukt_KundenI3D] ON [dbo].[KundenProdukt]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenProdukt_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenProdukt_Status] ON [dbo].[KundenProdukt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenRMA_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenRMA_Nummer] ON [dbo].[KundenRMA]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenRMA_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenRMA_UrsprungI3D] ON [dbo].[KundenRMA]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenRMA_UrsprungPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenRMA_UrsprungPosI3D] ON [dbo].[KundenRMA]
(
	[UrsprungPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenSonderpreise_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenSonderpreise_ArtikelI3D] ON [dbo].[KundenSonderpreise]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenSonderpreise_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenSonderpreise_KundenI3D] ON [dbo].[KundenSonderpreise]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenSonderpreise_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenSonderpreise_ObjektArt] ON [dbo].[KundenSonderpreise]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundenSonderpreise_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundenSonderpreise_ObjektI3D] ON [dbo].[KundenSonderpreise]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [KundeToArtikel_ArtikelcodeKunde]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundeToArtikel_ArtikelcodeKunde] ON [dbo].[KundeToArtikel]
(
	[ArtikelcodeKunde] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundeToArtikel_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundeToArtikel_I3D] ON [dbo].[KundeToArtikel]
(
	[I3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [KundeToKonzern_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [KundeToKonzern_KundenI3D] ON [dbo].[KundeToKonzern]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_AnschriftID] ON [dbo].[LagerAufKopf]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_AussendienstID] ON [dbo].[LagerAufKopf]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_Datum] ON [dbo].[LagerAufKopf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_hlpdsk_requestsI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_hlpdsk_requestsI3D] ON [dbo].[LagerAufKopf]
(
	[hlpdsk_requestsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_InnendienstID] ON [dbo].[LagerAufKopf]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_KundenID] ON [dbo].[LagerAufKopf]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LagerAufKopf_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_KurzZeich] ON [dbo].[LagerAufKopf]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_Nummer] ON [dbo].[LagerAufKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_Status] ON [dbo].[LagerAufKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_Techniker2ID] ON [dbo].[LagerAufKopf]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopf_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopf_TechnikerID] ON [dbo].[LagerAufKopf]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfErweitert_AufkopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfErweitert_AufkopfI3D] ON [dbo].[LagerAufKopfErweitert]
(
	[AufkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfErweitertVersions_AufkopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfErweitertVersions_AufkopfI3D] ON [dbo].[LagerAufKopfErweitertVersions]
(
	[AufkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_AnschriftID] ON [dbo].[LagerAufKopfVersions]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_AussendienstID] ON [dbo].[LagerAufKopfVersions]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_Datum] ON [dbo].[LagerAufKopfVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_hlpdsk_requestsI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_hlpdsk_requestsI3D] ON [dbo].[LagerAufKopfVersions]
(
	[hlpdsk_requestsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_InnendienstID] ON [dbo].[LagerAufKopfVersions]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_KundenID] ON [dbo].[LagerAufKopfVersions]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LagerAufKopfVersions_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_KurzZeich] ON [dbo].[LagerAufKopfVersions]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_Nummer] ON [dbo].[LagerAufKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_Status] ON [dbo].[LagerAufKopfVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_Techniker2ID] ON [dbo].[LagerAufKopfVersions]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufKopfVersions_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufKopfVersions_TechnikerID] ON [dbo].[LagerAufKopfVersions]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_Art] ON [dbo].[LagerAufPos]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_ArtikelI3D] ON [dbo].[LagerAufPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufPos_AufKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_AufKopfI3D] ON [dbo].[LagerAufPos]
(
	[AufKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LagerAufPos_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_Code] ON [dbo].[LagerAufPos]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LagerAufPos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_EANCode] ON [dbo].[LagerAufPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufPos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_GeraeteBarcodeI3D] ON [dbo].[LagerAufPos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LagerAufPos_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_HerstCode] ON [dbo].[LagerAufPos]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufPos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_Status] ON [dbo].[LagerAufPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufPos_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_UrsprungI3D] ON [dbo].[LagerAufPos]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerAufPos_UrsprungPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerAufPos_UrsprungPosI3D] ON [dbo].[LagerAufPos]
(
	[UrsprungPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Lagerort_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Lagerort_Status] ON [dbo].[Lagerort]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Lagerplatz_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Lagerplatz_Status] ON [dbo].[Lagerplatz]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerUmbuchungsliste_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerUmbuchungsliste_Nummer] ON [dbo].[LagerUmbuchungsliste]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerUmbuchungsliste_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerUmbuchungsliste_Status] ON [dbo].[LagerUmbuchungsliste]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerUmbuchungslisteArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerUmbuchungslisteArtikel_ArtikelI3D] ON [dbo].[LagerUmbuchungslisteArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerUmbuchungslisteArtikel_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerUmbuchungslisteArtikel_Status] ON [dbo].[LagerUmbuchungslisteArtikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerZuWebShopEinstellungen_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerZuWebShopEinstellungen_LagerI3D] ON [dbo].[LagerZuWebShopEinstellungen]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LagerZuWebShopEinstellungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LagerZuWebShopEinstellungen_Status] ON [dbo].[LagerZuWebShopEinstellungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LetzteAnlage_AnlageArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LetzteAnlage_AnlageArt] ON [dbo].[LetzteAnlage]
(
	[AnlageArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LetzteArtikelVerwendung_AnlageArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LetzteArtikelVerwendung_AnlageArt] ON [dbo].[LetzteArtikelVerwendung]
(
	[AnlageArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LetzteArtikelVerwendung_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LetzteArtikelVerwendung_ArtikelI3D] ON [dbo].[LetzteArtikelVerwendung]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LetzteArtikelVerwendung_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LetzteArtikelVerwendung_KundenI3D] ON [dbo].[LetzteArtikelVerwendung]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LetzteArtikelVerwendung_PosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LetzteArtikelVerwendung_PosI3D] ON [dbo].[LetzteArtikelVerwendung]
(
	[PosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LieferungKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LieferungKopf_Status] ON [dbo].[LieferungKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixLiefKopf_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefKopf_AussendienstID] ON [dbo].[LiefKopf]
(
	[AussendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixLiefKopf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefKopf_Datum] ON [dbo].[LiefKopf]
(
	[Datum] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixLiefKopf_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefKopf_InnendienstID] ON [dbo].[LiefKopf]
(
	[InnendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixLiefKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefKopf_Nummer] ON [dbo].[LiefKopf]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixLiefKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefKopf_Techniker2ID] ON [dbo].[LiefKopf]
(
	[Techniker2ID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixLiefKopf_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefKopf_TechnikerID] ON [dbo].[LiefKopf]
(
	[TechnikerID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopf_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopf_AnschriftID] ON [dbo].[LiefKopf]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopf_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopf_KundenID] ON [dbo].[LiefKopf]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiefKopf_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopf_KurzZeich] ON [dbo].[LiefKopf]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfErweitert_LiefkopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfErweitert_LiefkopfI3D] ON [dbo].[LiefKopfErweitert]
(
	[LiefkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfErweitertVersions_LiefkopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfErweitertVersions_LiefkopfI3D] ON [dbo].[LiefKopfErweitertVersions]
(
	[LiefkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_AnschriftID] ON [dbo].[LiefKopfVersions]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_AussendienstID] ON [dbo].[LiefKopfVersions]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_Datum] ON [dbo].[LiefKopfVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_InnendienstID] ON [dbo].[LiefKopfVersions]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_KundenID] ON [dbo].[LiefKopfVersions]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiefKopfVersions_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_KurzZeich] ON [dbo].[LiefKopfVersions]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_Nummer] ON [dbo].[LiefKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_Status] ON [dbo].[LiefKopfVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_Techniker2ID] ON [dbo].[LiefKopfVersions]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefKopfVersions_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefKopfVersions_TechnikerID] ON [dbo].[LiefKopfVersions]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ix_LiefPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ix_LiefPos_Art] ON [dbo].[LiefPos]
(
	[Art] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixLiefPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefPos_ArtikelI3D] ON [dbo].[LiefPos]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixLiefPos_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefPos_Code] ON [dbo].[LiefPos]
(
	[Code] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixLiefPos_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixLiefPos_HerstCode] ON [dbo].[LiefPos]
(
	[HerstCode] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiefPos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPos_EANCode] ON [dbo].[LiefPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPos_GeraeteBarcodeI3D] ON [dbo].[LiefPos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPos_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPos_Ursprung] ON [dbo].[LiefPos]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPos_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPos_UrsprungI3D] ON [dbo].[LiefPos]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPosVersions_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_Art] ON [dbo].[LiefPosVersions]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPosVersions_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_ArtikelI3D] ON [dbo].[LiefPosVersions]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiefPosVersions_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_Code] ON [dbo].[LiefPosVersions]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiefPosVersions_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_EANCode] ON [dbo].[LiefPosVersions]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPosVersions_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_GeraeteBarcodeI3D] ON [dbo].[LiefPosVersions]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiefPosVersions_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_HerstCode] ON [dbo].[LiefPosVersions]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPosVersions_KopfVersionsI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_KopfVersionsI3D] ON [dbo].[LiefPosVersions]
(
	[KopfVersionsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPosVersions_LiefKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_LiefKopfI3D] ON [dbo].[LiefPosVersions]
(
	[LiefKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPosVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_Status] ON [dbo].[LiefPosVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPosVersions_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_Ursprung] ON [dbo].[LiefPosVersions]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefPosVersions_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefPosVersions_UrsprungI3D] ON [dbo].[LiefPosVersions]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiefProv_LiefKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiefProv_LiefKopfI3D] ON [dbo].[LiefProv]
(
	[LiefKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutKopf_AktuelleVersion]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutKopf_AktuelleVersion] ON [dbo].[LiGutKopf]
(
	[AktuelleVersion] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutKopf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutKopf_Datum] ON [dbo].[LiGutKopf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutKopf_Nummer] ON [dbo].[LiGutKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutKopf_Status] ON [dbo].[LiGutKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_Art] ON [dbo].[LiGutPos]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiGutPos_Artikelcode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_Artikelcode] ON [dbo].[LiGutPos]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_ArtikelI3D] ON [dbo].[LiGutPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiGutPos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_EANCode] ON [dbo].[LiGutPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutPos_EKAusAufPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_EKAusAufPosI3D] ON [dbo].[LiGutPos]
(
	[EKAusAufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LiGutPos_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_Hersteller] ON [dbo].[LiGutPos]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutPos_KalkKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_KalkKopfI3D] ON [dbo].[LiGutPos]
(
	[KalkKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutPos_LiGutKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_LiGutKopfI3D] ON [dbo].[LiGutPos]
(
	[LiGutKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LiGutPos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LiGutPos_Status] ON [dbo].[LiGutPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LizenzKopf_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LizenzKopf_Name] ON [dbo].[LizenzKopf]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LizenzKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LizenzKopf_Nummer] ON [dbo].[LizenzKopf]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LizenzPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LizenzPos_Art] ON [dbo].[LizenzPos]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [LizenzPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LizenzPos_ArtikelI3D] ON [dbo].[LizenzPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LizenzPos_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LizenzPos_Code] ON [dbo].[LizenzPos]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [LizenzPos_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [LizenzPos_HerstCode] ON [dbo].[LizenzPos]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Logos_ObjectI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Logos_ObjectI3D] ON [dbo].[Logos]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Logos_ObjectKind]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Logos_ObjectKind] ON [dbo].[Logos]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [MaAbteilung_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MaAbteilung_Name] ON [dbo].[MaAbteilung]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MaAbteilung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MaAbteilung_Status] ON [dbo].[MaAbteilung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Mahnlauf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Mahnlauf_Datum] ON [dbo].[Mahnlauf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Mahnlauf_RechKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Mahnlauf_RechKopfI3D] ON [dbo].[Mahnlauf]
(
	[RechKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Mahnlauf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Mahnlauf_Status] ON [dbo].[Mahnlauf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailAgentEinstellungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailAgentEinstellungen_Status] ON [dbo].[MailAgentEinstellungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailAgentRegel_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailAgentRegel_KundenI3D] ON [dbo].[MailAgentRegel]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailAgentRegel_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailAgentRegel_Status] ON [dbo].[MailAgentRegel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailAgentRollen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailAgentRollen_Status] ON [dbo].[MailAgentRollen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Mailing_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Mailing_Datum] ON [dbo].[Mailing]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Mailing_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Mailing_Name] ON [dbo].[Mailing]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_MailingAttachments_MailingDaten]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_MailingAttachments_MailingDaten] ON [dbo].[MailingAttachments]
(
	[MailingDatenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailingDaten_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailingDaten_Datum] ON [dbo].[MailingDaten]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailingTeilnahme_AnsprechI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailingTeilnahme_AnsprechI3D] ON [dbo].[MailingTeilnahme]
(
	[AnsprechI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailingTeilnahme_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailingTeilnahme_KundenI3D] ON [dbo].[MailingTeilnahme]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_Mailingtexte_MAilingDaten]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_Mailingtexte_MAilingDaten] ON [dbo].[Mailingtexte]
(
	[MailingDatenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_MailingToKunde_MailingDaten]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_MailingToKunde_MailingDaten] ON [dbo].[MailingToKunde]
(
	[MailingDatenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailingToKunde_AnsprechI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailingToKunde_AnsprechI3D] ON [dbo].[MailingToKunde]
(
	[AnsprechI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailingToKunde_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailingToKunde_KundenI3D] ON [dbo].[MailingToKunde]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailingVorlagen_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailingVorlagen_Art] ON [dbo].[MailingVorlagen]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailingVorlagen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailingVorlagen_Status] ON [dbo].[MailingVorlagen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailVerzeichnisse_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailVerzeichnisse_I3D] ON [dbo].[MailVerzeichnisse]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [MailVerzeichnisse_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailVerzeichnisse_Name] ON [dbo].[MailVerzeichnisse]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailVerzeichnisse_OwnerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailVerzeichnisse_OwnerI3D] ON [dbo].[MailVerzeichnisse]
(
	[OwnerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailVerzeichnisse_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailVerzeichnisse_Status] ON [dbo].[MailVerzeichnisse]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [MailVorlagen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailVorlagen_Name] ON [dbo].[MailVorlagen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailVorlagen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailVorlagen_Status] ON [dbo].[MailVorlagen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [MailVorlagenAttachments_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [MailVorlagenAttachments_Status] ON [dbo].[MailVorlagenAttachments]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Mandant_Land]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Mandant_Land] ON [dbo].[Mandant]
(
	[Land] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Mandant_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Mandant_Status] ON [dbo].[Mandant]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Mitarbeiterartikel_ArtikelCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Mitarbeiterartikel_ArtikelCode] ON [dbo].[Mitarbeiterartikel]
(
	[ArtikelCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Module_ModuleGuid]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Module_ModuleGuid] ON [dbo].[Module]
(
	[ModuleGuid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ModuleActionLog_ObjectI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ModuleActionLog_ObjectI3D] ON [dbo].[ModuleActionLog]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ModuleActionType_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ModuleActionType_Name] ON [dbo].[ModuleActionType]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ModuleCategory_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ModuleCategory_Name] ON [dbo].[ModuleCategory]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ModuleCustomProperties_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ModuleCustomProperties_Name] ON [dbo].[ModuleCustomProperties]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ModuleCustomProperties_ObjectI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ModuleCustomProperties_ObjectI3D] ON [dbo].[ModuleCustomProperties]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ModuleCustomProperties_ObjectKind]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ModuleCustomProperties_ObjectKind] ON [dbo].[ModuleCustomProperties]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ModuleCustomPropertyValues_ObjectI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ModuleCustomPropertyValues_ObjectI3D] ON [dbo].[ModuleCustomPropertyValues]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ModuleCustomPropertyValues_ObjectKind]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ModuleCustomPropertyValues_ObjectKind] ON [dbo].[ModuleCustomPropertyValues]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_MyDayUserItems_ItemDate_EmployeeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_MyDayUserItems_ItemDate_EmployeeI3D] ON [dbo].[MyDayUserItems]
(
	[ItemDate] DESC,
	[EmployeeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Nebenlager_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Nebenlager_Nummer] ON [dbo].[Nebenlager]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [NebenlagerArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [NebenlagerArtikel_ArtikelI3D] ON [dbo].[NebenlagerArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [NLALagerI3D_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [NLALagerI3D_ArtikelI3D] ON [dbo].[NebenlagerArtikel]
(
	[NebenlagerI3D] ASC,
	[ArtikelI3D] ASC
)
INCLUDE([Bestand]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [NebenlagerLog_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [NebenlagerLog_ArtikelI3D] ON [dbo].[NebenlagerLog]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [NebenlagerLog_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [NebenlagerLog_Datum] ON [dbo].[NebenlagerLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [NebenlagerUmbuchungsLog_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [NebenlagerUmbuchungsLog_ArtikelI3D] ON [dbo].[NebenlagerUmbuchungsLog]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [NebenlagerUmbuchungsLog_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [NebenlagerUmbuchungsLog_Datum] ON [dbo].[NebenlagerUmbuchungsLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_NexusNotifications_UserI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_NexusNotifications_UserI3D] ON [dbo].[NexusNotifications]
(
	[UserI3D] DESC,
	[UserKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_NexusTicketViews_Caption]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_NexusTicketViews_Caption] ON [dbo].[NexusTicketViews]
(
	[Caption] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ObjectFields_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ObjectFields_Name] ON [dbo].[ObjectFields]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ObjectFields_OwnerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ObjectFields_OwnerI3D] ON [dbo].[ObjectFields]
(
	[OwnerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IDX_ObjectFulltextIndex_TextValue]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IDX_ObjectFulltextIndex_TextValue] ON [dbo].[ObjectFulltextIndex]
(
	[TextValue] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [OfferProjectLayouts_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [OfferProjectLayouts_I3D] ON [dbo].[OfferProjectLayouts]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_OnlineBankingAccountTransactions_ConfigI3DAndBookingDate]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_OnlineBankingAccountTransactions_ConfigI3DAndBookingDate] ON [dbo].[OnlineBankingAccountTransactions]
(
	[OnlineBankingConfigurationI3D] ASC,
	[BookingDate] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_OnlineBankingTransactionAssignments_AccountTransactionI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_OnlineBankingTransactionAssignments_AccountTransactionI3D] ON [dbo].[OnlineBankingTransactionAssignments]
(
	[AccountTransactionI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Opos_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Opos_KundenID] ON [dbo].[Opos]
(
	[KundenID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_PartialCommissionItemToBarcodeRelations_PartialCommissionOrderI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_PartialCommissionItemToBarcodeRelations_PartialCommissionOrderI3D] ON [dbo].[PartialCommissionItemToBarcodeRelations]
(
	[PartialCommissionOrderI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_PartialCommissionOrderItems_PartialCommissionOrderI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_PartialCommissionOrderItems_PartialCommissionOrderI3D] ON [dbo].[PartialCommissionOrderItems]
(
	[PartialCommissionOrderI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_PartialCommissionOrders_ReceiptOrderI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_PartialCommissionOrders_ReceiptOrderI3D] ON [dbo].[PartialCommissionOrders]
(
	[ReceiptOrderI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ParticipantArticles_ObjectI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ParticipantArticles_ObjectI3D] ON [dbo].[ParticipantArticles]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ParticipantArticles_ObjectKind]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ParticipantArticles_ObjectKind] ON [dbo].[ParticipantArticles]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PasswordManagement_CustomerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PasswordManagement_CustomerI3D] ON [dbo].[PasswordManagement]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PasswordManagement_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PasswordManagement_Status] ON [dbo].[PasswordManagement]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [PasswordManagementKeyword_Username]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PasswordManagementKeyword_Username] ON [dbo].[PasswordManagementKeyword]
(
	[Username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [PasswordManagementType_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PasswordManagementType_Name] ON [dbo].[PasswordManagementType]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PasswordManagementType_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PasswordManagementType_Status] ON [dbo].[PasswordManagementType]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Personal_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Personal_KurzZeich] ON [dbo].[Personal]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Personal_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Personal_Name] ON [dbo].[Personal]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Personal_Vertreter]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Personal_Vertreter] ON [dbo].[Personal]
(
	[Vertreter] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PersonalUnterweisung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PersonalUnterweisung_Status] ON [dbo].[PersonalUnterweisung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PersonalUrlaub_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PersonalUrlaub_Status] ON [dbo].[PersonalUrlaub]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PersonalVertretung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PersonalVertretung_Status] ON [dbo].[PersonalVertretung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PersonalZuMailAgentRollen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PersonalZuMailAgentRollen_Status] ON [dbo].[PersonalZuMailAgentRollen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Personen_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Personen_AnschriftID] ON [dbo].[Personen]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PORTDEBI_Kundennummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PORTDEBI_Kundennummer] ON [dbo].[PORTDEBI]
(
	[Kundennummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_PORTRECH_Rechnungsnummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_PORTRECH_Rechnungsnummer] ON [dbo].[PORTRECH]
(
	[Rechnungsnummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PORTRECH_AnlageI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PORTRECH_AnlageI3D] ON [dbo].[PORTRECH]
(
	[AnlageI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PORTRECH_Kundennummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PORTRECH_Kundennummer] ON [dbo].[PORTRECH]
(
	[Kundennummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PORTWARE_AnlageI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PORTWARE_AnlageI3D] ON [dbo].[PORTWARE]
(
	[AnlageI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PORTWARE_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PORTWARE_Art] ON [dbo].[PORTWARE]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [PORTWARE_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [PORTWARE_Datum] ON [dbo].[PORTWARE]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Printer_ReportGroup]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Printer_ReportGroup] ON [dbo].[Printer]
(
	[ReportGroup] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Printer_ReportI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Printer_ReportI3D] ON [dbo].[Printer]
(
	[ReportI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ProductFamilyAction_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProductFamilyAction_Name] ON [dbo].[ProductFamilyAction]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProductFamilyAction_OwnerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProductFamilyAction_OwnerI3D] ON [dbo].[ProductFamilyAction]
(
	[OwnerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Produkt_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Produkt_Name] ON [dbo].[Produkt]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Produktfamilie_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Produktfamilie_Status] ON [dbo].[Produktfamilie]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProduktfamilieHersteller_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProduktfamilieHersteller_Status] ON [dbo].[ProduktfamilieHersteller]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProduktfamilieKundenSperren_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProduktfamilieKundenSperren_KundenI3D] ON [dbo].[ProduktfamilieKundenSperren]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProduktfamilieKundenSperren_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProduktfamilieKundenSperren_Status] ON [dbo].[ProduktfamilieKundenSperren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProduktfamiliePositionSperren_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProduktfamiliePositionSperren_ArtikelI3D] ON [dbo].[ProduktfamiliePositionSperren]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProduktfamiliePositionSperren_BarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProduktfamiliePositionSperren_BarcodeI3D] ON [dbo].[ProduktfamiliePositionSperren]
(
	[BarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProduktfamiliePositionSperren_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProduktfamiliePositionSperren_Status] ON [dbo].[ProduktfamiliePositionSperren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Projekt_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Projekt_Name] ON [dbo].[Projekt]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Projekt_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Projekt_Status] ON [dbo].[Projekt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektAkteure_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektAkteure_Status] ON [dbo].[ProjektAkteure]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektAnlagen_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektAnlagen_ObjektArt] ON [dbo].[ProjektAnlagen]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ProjektAufgaben_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektAufgaben_Name] ON [dbo].[ProjektAufgaben]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektAufgaben_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektAufgaben_Status] ON [dbo].[ProjektAufgaben]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektBeteiligtePersonen_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektBeteiligtePersonen_Art] ON [dbo].[ProjektBeteiligtePersonen]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Projektgrundlagen_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Projektgrundlagen_Art] ON [dbo].[ProjektGrundlagen]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Projektgrundlagen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Projektgrundlagen_Status] ON [dbo].[ProjektGrundlagen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ProjektGruppen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektGruppen_Name] ON [dbo].[ProjektGruppen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektGruppen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektGruppen_Status] ON [dbo].[ProjektGruppen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektNotiz_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektNotiz_Datum] ON [dbo].[ProjektNotiz]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ProjektNotiz_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektNotiz_KurzZeich] ON [dbo].[ProjektNotiz]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ProjektPersonenGruppen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPersonenGruppen_Name] ON [dbo].[ProjektPersonenGruppen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPersonenGruppen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPersonenGruppen_Status] ON [dbo].[ProjektPersonenGruppen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPersonenGruppenMitarbeiter_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPersonenGruppenMitarbeiter_Status] ON [dbo].[ProjektPersonenGruppenMitarbeiter]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasen_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasen_Art] ON [dbo].[ProjektPhasen]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ProjektPhasen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasen_Name] ON [dbo].[ProjektPhasen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasen_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasen_Nummer] ON [dbo].[ProjektPhasen]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasen_OwnerDirI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasen_OwnerDirI3D] ON [dbo].[ProjektPhasen]
(
	[OwnerDirI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasen_Status] ON [dbo].[ProjektPhasen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasenAbhaengigkeit_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasenAbhaengigkeit_Art] ON [dbo].[ProjektPhasenAbhaengigkeit]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ProjektPhasenAufgaben_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasenAufgaben_Name] ON [dbo].[ProjektPhasenAufgaben]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasenAufgaben_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasenAufgaben_Nummer] ON [dbo].[ProjektPhasenAufgaben]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasenAufgaben_OwnerDirI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasenAufgaben_OwnerDirI3D] ON [dbo].[ProjektPhasenAufgaben]
(
	[OwnerDirI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasenAufgaben_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasenAufgaben_Status] ON [dbo].[ProjektPhasenAufgaben]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektPhasenAufgabenAbhaengigkeit_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektPhasenAufgabenAbhaengigkeit_Art] ON [dbo].[ProjektPhasenAufgabenAbhaengigkeit]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektTexte_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektTexte_Datum] ON [dbo].[ProjektTexte]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ProjektTexteVersion_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ProjektTexteVersion_Datum] ON [dbo].[ProjektTexteVersion]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Projektverwaltung_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Projektverwaltung_KundenI3D] ON [dbo].[Projektverwaltung]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Projektverwaltung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Projektverwaltung_Status] ON [dbo].[Projektverwaltung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [QuickNote_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [QuickNote_Status] ON [dbo].[QuickNote]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IDX_ReceiptPositionPricing_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IDX_ReceiptPositionPricing_I3D] ON [dbo].[ReceiptPositionPricing]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_ReceiptProvisionEmployeeGoals_UniqueGoal]    Script Date: 11.11.2025 11:20:30 ******/
CREATE UNIQUE NONCLUSTERED INDEX [idx_ReceiptProvisionEmployeeGoals_UniqueGoal] ON [dbo].[ReceiptProvisionEmployeeGoals]
(
	[EmployeeI3D] ASC,
	[Year] ASC,
	[Month] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_ReceiptProvisionSchemaCustomerAssignments_UniqueAssignment]    Script Date: 11.11.2025 11:20:30 ******/
CREATE UNIQUE NONCLUSTERED INDEX [idx_ReceiptProvisionSchemaCustomerAssignments_UniqueAssignment] ON [dbo].[ReceiptProvisionSchemaCustomerAssignments]
(
	[CustomerI3D] ASC,
	[BranchI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixRechKopf_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechKopf_AussendienstID] ON [dbo].[RechKopf]
(
	[AussendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixRechKopf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechKopf_Datum] ON [dbo].[RechKopf]
(
	[Datum] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixRechKopf_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechKopf_InnendienstID] ON [dbo].[RechKopf]
(
	[InnendienstID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixRechKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechKopf_Nummer] ON [dbo].[RechKopf]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixRechKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechKopf_Techniker2ID] ON [dbo].[RechKopf]
(
	[Techniker2ID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixRechKopf_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechKopf_TechnikerID] ON [dbo].[RechKopf]
(
	[TechnikerID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopf_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopf_KundenID] ON [dbo].[RechKopf]
(
	[KundenID] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RechKopf_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopf_KurzZeich] ON [dbo].[RechKopf]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfErweitert_RechkopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfErweitert_RechkopfI3D] ON [dbo].[RechKopfErweitert]
(
	[RechkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfErweitertVersions_RechkopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfErweitertVersions_RechkopfI3D] ON [dbo].[RechKopfErweitertVersions]
(
	[RechkopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_AnschriftID] ON [dbo].[RechKopfVersions]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_AussendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_AussendienstID] ON [dbo].[RechKopfVersions]
(
	[AussendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_Datum] ON [dbo].[RechKopfVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_InnendienstID] ON [dbo].[RechKopfVersions]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_KundenID] ON [dbo].[RechKopfVersions]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RechKopfVersions_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_KurzZeich] ON [dbo].[RechKopfVersions]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_Nummer] ON [dbo].[RechKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_Status] ON [dbo].[RechKopfVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_Techniker2ID] ON [dbo].[RechKopfVersions]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechKopfVersions_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechKopfVersions_TechnikerID] ON [dbo].[RechKopfVersions]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ix_RechPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ix_RechPos_Art] ON [dbo].[RechPos]
(
	[Art] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ixRechPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechPos_ArtikelI3D] ON [dbo].[RechPos]
(
	[ArtikelI3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixRechPos_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechPos_Code] ON [dbo].[RechPos]
(
	[Code] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ixRechPos_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ixRechPos_HerstCode] ON [dbo].[RechPos]
(
	[HerstCode] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RechPos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPos_EANCode] ON [dbo].[RechPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPos_GeraeteBarcodeI3D] ON [dbo].[RechPos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPos_Status] ON [dbo].[RechPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPos_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPos_Ursprung] ON [dbo].[RechPos]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPos_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPos_UrsprungI3D] ON [dbo].[RechPos]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPosVersions_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_Art] ON [dbo].[RechPosVersions]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPosVersions_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_ArtikelI3D] ON [dbo].[RechPosVersions]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RechPosVersions_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_Code] ON [dbo].[RechPosVersions]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RechPosVersions_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_EANCode] ON [dbo].[RechPosVersions]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPosVersions_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_GeraeteBarcodeI3D] ON [dbo].[RechPosVersions]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RechPosVersions_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_HerstCode] ON [dbo].[RechPosVersions]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPosVersions_KopfVersionsI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_KopfVersionsI3D] ON [dbo].[RechPosVersions]
(
	[KopfVersionsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPosVersions_RechKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_RechKopfI3D] ON [dbo].[RechPosVersions]
(
	[RechKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPosVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_Status] ON [dbo].[RechPosVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPosVersions_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_Ursprung] ON [dbo].[RechPosVersions]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechPosVersions_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechPosVersions_UrsprungI3D] ON [dbo].[RechPosVersions]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RechProv_RechKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RechProv_RechKopfI3D] ON [dbo].[RechProv]
(
	[RechKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReisekostenAbrechnungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReisekostenAbrechnungen_Status] ON [dbo].[ReisekostenAbrechnungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReisekostenBelege_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReisekostenBelege_Status] ON [dbo].[ReisekostenBelege]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReisekostenBelegeHotel_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReisekostenBelegeHotel_Status] ON [dbo].[ReisekostenBelegeHotel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReisekostenBelegePKW_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReisekostenBelegePKW_Status] ON [dbo].[ReisekostenBelegePKW]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReisekostenFahrten_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReisekostenFahrten_Status] ON [dbo].[ReisekostenFahrten]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReisekostenReisen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReisekostenReisen_Status] ON [dbo].[ReisekostenReisen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RemoteConnections_CustomerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteConnections_CustomerI3D] ON [dbo].[RemoteConnections]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RemoteConnections_DeviceI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteConnections_DeviceI3D] ON [dbo].[RemoteConnections]
(
	[DeviceI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RemoteCredentials_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteCredentials_Name] ON [dbo].[RemoteCredentials]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RemoteCredentials_Username]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteCredentials_Username] ON [dbo].[RemoteCredentials]
(
	[Username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RemoteExternalMetadatas_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteExternalMetadatas_Name] ON [dbo].[RemoteExternalMetadatas]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RemoteFolders_CustomerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteFolders_CustomerI3D] ON [dbo].[RemoteFolders]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RemotePuttyMetadatas_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemotePuttyMetadatas_Name] ON [dbo].[RemotePuttyMetadatas]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RemoteRDPMetadatas_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteRDPMetadatas_Name] ON [dbo].[RemoteRDPMetadatas]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RemoteRDPMetadatas_Username]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteRDPMetadatas_Username] ON [dbo].[RemoteRDPMetadatas]
(
	[Username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RemoteVNCMetadatas_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteVNCMetadatas_Name] ON [dbo].[RemoteVNCMetadatas]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RemoteWebMetadatas_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RemoteWebMetadatas_Name] ON [dbo].[RemoteWebMetadatas]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RepaArtikel_ArtikelCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RepaArtikel_ArtikelCode] ON [dbo].[RepaArtikel]
(
	[ArtikelCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RepaArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RepaArtikel_ArtikelI3D] ON [dbo].[RepaArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RepaArtikelHistory_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RepaArtikelHistory_ArtikelI3D] ON [dbo].[RepaArtikelHistory]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RepaKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RepaKopf_Status] ON [dbo].[RepaKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RepaKopfHistory_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RepaKopfHistory_Status] ON [dbo].[RepaKopfHistory]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReportLog_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReportLog_Nummer] ON [dbo].[ReportLog]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Reports_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Reports_Name] ON [dbo].[Reports]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Reports_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Reports_Status] ON [dbo].[Reports]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReportsVersions_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReportsVersions_Datum] ON [dbo].[ReportsVersions]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReportsVersions_ReportI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReportsVersions_ReportI3D] ON [dbo].[ReportsVersions]
(
	[ReportI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReportsVersions_ReportVersion]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReportsVersions_ReportVersion] ON [dbo].[ReportsVersions]
(
	[ReportVersion] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ReportToGroupAssignment_ReportGroup]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReportToGroupAssignment_ReportGroup] ON [dbo].[ReportToGroupAssignment]
(
	[ReportGroup] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReportToGroupAssignment_ReportI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReportToGroupAssignment_ReportI3D] ON [dbo].[ReportToGroupAssignment]
(
	[ReportI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ReportUsers_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReportUsers_Status] ON [dbo].[ReportUsers]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [ReportUsers_UserName]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ReportUsers_UserName] ON [dbo].[ReportUsers]
(
	[UserName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAAnfKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAAnfKopf_Nummer] ON [dbo].[RMAAnfKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAAnfKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAAnfKopf_Status] ON [dbo].[RMAAnfKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAAnfPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAAnfPos_ArtikelI3D] ON [dbo].[RMAAnfPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAAnfPos_BarcodeScanen]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAAnfPos_BarcodeScanen] ON [dbo].[RMAAnfPos]
(
	[BarcodeScanen] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAAnfPos_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAAnfPos_LagerI3D] ON [dbo].[RMAAnfPos]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAKopf_Nummer] ON [dbo].[RMAKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAKopf_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAKopf_ObjektArt] ON [dbo].[RMAKopf]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [RMAPos_Artikelcode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAPos_Artikelcode] ON [dbo].[RMAPos]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAPos_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAPos_ObjektArt] ON [dbo].[RMAPos]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAPos_RechPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAPos_RechPosI3D] ON [dbo].[RMAPos]
(
	[RechPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAPos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAPos_Status] ON [dbo].[RMAPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAPosSN_SNI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAPosSN_SNI3D] ON [dbo].[RMAPosSN]
(
	[SNI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAPosSN_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAPosSN_Status] ON [dbo].[RMAPosSN]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAPosStatus_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAPosStatus_Datum] ON [dbo].[RMAPosStatus]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMAPosStatus_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMAPosStatus_Status] ON [dbo].[RMAPosStatus]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARepKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARepKopf_Nummer] ON [dbo].[RMARepKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARepKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARepKopf_Status] ON [dbo].[RMARepKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARepPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARepPos_ArtikelI3D] ON [dbo].[RMARepPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARepPos_BarcodeScanen]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARepPos_BarcodeScanen] ON [dbo].[RMARepPos]
(
	[BarcodeScanen] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARepPos_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARepPos_LagerI3D] ON [dbo].[RMARepPos]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARueckKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARueckKopf_Nummer] ON [dbo].[RMARueckKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARueckKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARueckKopf_Status] ON [dbo].[RMARueckKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARueckPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARueckPos_ArtikelI3D] ON [dbo].[RMARueckPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARueckPos_BarcodeScanen]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARueckPos_BarcodeScanen] ON [dbo].[RMARueckPos]
(
	[BarcodeScanen] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RMARueckPos_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RMARueckPos_LagerI3D] ON [dbo].[RMARueckPos]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Roles_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Roles_Name] ON [dbo].[Roles]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RundschrKopf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RundschrKopf_Datum] ON [dbo].[RundschrKopf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [RundschrKunden_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [RundschrKunden_KundenI3D] ON [dbo].[RundschrKunden]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [S2PLog_AktuelleVersion]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [S2PLog_AktuelleVersion] ON [dbo].[S2PLog]
(
	[AktuelleVersion] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [S2PLog_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [S2PLog_Datum] ON [dbo].[S2PLog]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [S2PLog_KopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [S2PLog_KopfI3D] ON [dbo].[S2PLog]
(
	[KopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [S2PLog_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [S2PLog_ObjektArt] ON [dbo].[S2PLog]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [S2PLog_PosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [S2PLog_PosI3D] ON [dbo].[S2PLog]
(
	[PosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [S2PLog_SNI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [S2PLog_SNI3D] ON [dbo].[S2PLog]
(
	[SNI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ScanBoxen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ScanBoxen_Status] ON [dbo].[ScanBoxen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Scanner_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Scanner_Status] ON [dbo].[Scanner]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_SepaContracts_CustomerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_SepaContracts_CustomerI3D] ON [dbo].[SepaContracts]
(
	[CustomerI3D] ASC,
	[State] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SerAuftr_AnschriftID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SerAuftr_AnschriftID] ON [dbo].[SerAuftr]
(
	[AnschriftID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SerAuftr_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SerAuftr_Datum] ON [dbo].[SerAuftr]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SerAuftr_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SerAuftr_KundenID] ON [dbo].[SerAuftr]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SerAuftr_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SerAuftr_Status] ON [dbo].[SerAuftr]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SerAuftr_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SerAuftr_TechnikerID] ON [dbo].[SerAuftr]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SeriennummerToPosition_KopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SeriennummerToPosition_KopfI3D] ON [dbo].[SeriennummerToPosition]
(
	[KopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SeriennummerToPosition_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SeriennummerToPosition_ObjektArt] ON [dbo].[SeriennummerToPosition]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SeriennummerToPosition_PosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SeriennummerToPosition_PosI3D] ON [dbo].[SeriennummerToPosition]
(
	[PosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SeriennummerToPosition_SNI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SeriennummerToPosition_SNI3D] ON [dbo].[SeriennummerToPosition]
(
	[SNI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SeriennummerZuArbeitsauftrag_BarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SeriennummerZuArbeitsauftrag_BarcodeI3D] ON [dbo].[SeriennummerZuArbeitsauftrag]
(
	[BarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SeriennummerZuArbeitsauftrag_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SeriennummerZuArbeitsauftrag_Status] ON [dbo].[SeriennummerZuArbeitsauftrag]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [SerTechn_Username]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SerTechn_Username] ON [dbo].[SerTechn]
(
	[Username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ServiceArbeitenVorlagen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ServiceArbeitenVorlagen_Status] ON [dbo].[ServiceArbeitenVorlagen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_SharedDocumentForAcceptance_EmployeeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_SharedDocumentForAcceptance_EmployeeI3D] ON [dbo].[SharedDocumentForAcceptance]
(
	[EmployeeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_SharedDocumentForAcceptance_SharedDocumentI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_SharedDocumentForAcceptance_SharedDocumentI3D] ON [dbo].[SharedDocumentForAcceptance]
(
	[SharedDocumentI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_SharedDocumentForAcceptance_Token]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_SharedDocumentForAcceptance_Token] ON [dbo].[SharedDocumentForAcceptance]
(
	[Token] ASC,
	[SharedDocumentI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IDX_SharedDocumentLogs_SharedDocumentI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IDX_SharedDocumentLogs_SharedDocumentI3D] ON [dbo].[SharedDocumentLogs]
(
	[SharedDocumentI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_SharedDocuments_Token]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_SharedDocuments_Token] ON [dbo].[SharedDocuments]
(
	[Token] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_Token_ReceiptI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_Token_ReceiptI3D] ON [dbo].[SharedDocuments]
(
	[Token] ASC,
	[ReceiptI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Sichbenu_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sichbenu_Name] ON [dbo].[Sichbenu]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Sichbenu_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sichbenu_Status] ON [dbo].[Sichbenu]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Sichbenu_Vertreter]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sichbenu_Vertreter] ON [dbo].[Sichbenu]
(
	[Vertreter] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Sichgrup_Land]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sichgrup_Land] ON [dbo].[Sichgrup]
(
	[Land] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Sichgrup_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sichgrup_Name] ON [dbo].[Sichgrup]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Sichgrup_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sichgrup_Status] ON [dbo].[Sichgrup]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SichProtokoll_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SichProtokoll_Art] ON [dbo].[SichProtokoll]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SichProtokoll_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SichProtokoll_Status] ON [dbo].[SichProtokoll]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Sichrech_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sichrech_Nummer] ON [dbo].[Sichrech]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Skillgruppe_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Skillgruppe_I3D] ON [dbo].[Skillgruppe]
(
	[I3D] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Skillgruppe_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Skillgruppe_ObjektArt] ON [dbo].[Skillgruppe]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Skillgruppe_OwnerDirI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Skillgruppe_OwnerDirI3D] ON [dbo].[Skillgruppe]
(
	[OwnerDirI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Skillgruppe_OwnerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Skillgruppe_OwnerI3D] ON [dbo].[Skillgruppe]
(
	[OwnerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Skillgruppe_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Skillgruppe_Status] ON [dbo].[Skillgruppe]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SocialMediaStream_ObjectI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SocialMediaStream_ObjectI3D] ON [dbo].[SocialMediaStream]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SocialMediaStream_ObjectKind]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SocialMediaStream_ObjectKind] ON [dbo].[SocialMediaStream]
(
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Sonderaktionen_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sonderaktionen_Nummer] ON [dbo].[Sonderaktionen]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SonderaktionenAktion_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SonderaktionenAktion_Datum] ON [dbo].[SonderaktionenAktion]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SonderaktionenAktion_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SonderaktionenAktion_Status] ON [dbo].[SonderaktionenAktion]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SonderaktionenAktionVorlagen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SonderaktionenAktionVorlagen_Status] ON [dbo].[SonderaktionenAktionVorlagen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SonderaktionenReferenzen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SonderaktionenReferenzen_Status] ON [dbo].[SonderaktionenReferenzen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Sondervereinbarung_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sondervereinbarung_Nummer] ON [dbo].[Sondervereinbarung]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SondervereinbarungsArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SondervereinbarungsArtikel_ArtikelI3D] ON [dbo].[SondervereinbarungsArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [SondervereinbarungsArtikel_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SondervereinbarungsArtikel_HerstCode] ON [dbo].[SondervereinbarungsArtikel]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SondervereinbarungsArtikel_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SondervereinbarungsArtikel_Status] ON [dbo].[SondervereinbarungsArtikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [SozialesNetzwerk_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SozialesNetzwerk_Name] ON [dbo].[SozialesNetzwerk]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [SozialesNetzwerk_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [SozialesNetzwerk_Status] ON [dbo].[SozialesNetzwerk]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Sperrung_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sperrung_Art] ON [dbo].[Sperrung]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Sperrung_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sperrung_Datum] ON [dbo].[Sperrung]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Sperrung_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Sperrung_KurzZeich] ON [dbo].[Sperrung]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [STAMM0]    Script Date: 11.11.2025 11:20:30 ******/
CREATE UNIQUE NONCLUSTERED INDEX [STAMM0] ON [dbo].[STAMM]
(
	[Angebotsnummer] ASC,
	[Auftragsnummer] ASC,
	[Liefernummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [StammdatExterneProgramme_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [StammdatExterneProgramme_Name] ON [dbo].[StammdatExterneProgramme]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [StammdatProjektVorlage_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [StammdatProjektVorlage_Art] ON [dbo].[StammdatProjektVorlage]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [StammdatProjektVorlage_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [StammdatProjektVorlage_Status] ON [dbo].[StammdatProjektVorlage]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [StatisticRoles_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [StatisticRoles_I3D] ON [dbo].[StatisticRoles]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [StatisticRoles_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [StatisticRoles_Name] ON [dbo].[StatisticRoles]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [StatisticTypes_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [StatisticTypes_I3D] ON [dbo].[StatisticTypes]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_StopwatchNotifications_EmployeeI3D_HelpdeskI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_StopwatchNotifications_EmployeeI3D_HelpdeskI3D] ON [dbo].[StopwatchNotifications]
(
	[EmployeeI3D] ASC,
	[HelpdeskI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxSupplierEdiConfigurations_SupplierIdObjectKind]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idxSupplierEdiConfigurations_SupplierIdObjectKind] ON [dbo].[SupplierEdiConfigurations]
(
	[SupplierI3D] ASC,
	[ObjectKind] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_SurveyProcessProperties_SurveyI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_SurveyProcessProperties_SurveyI3D] ON [dbo].[SurveyProcessProperties]
(
	[SurveyI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [sysuserobjects_pid]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [sysuserobjects_pid] ON [dbo].[sysuserobjects]
(
	[pid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Taetigkeiten_AnsprechI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Taetigkeiten_AnsprechI3D] ON [dbo].[Taetigkeiten]
(
	[AnsprechI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Taetigkeiten_BarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Taetigkeiten_BarcodeI3D] ON [dbo].[Taetigkeiten]
(
	[BarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Taetigkeiten_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Taetigkeiten_Datum] ON [dbo].[Taetigkeiten]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Taetigkeiten_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Taetigkeiten_Name] ON [dbo].[Taetigkeiten]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Taetigkeiten_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Taetigkeiten_ObjektArt] ON [dbo].[Taetigkeiten]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Taetigkeiten_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Taetigkeiten_ObjektI3D] ON [dbo].[Taetigkeiten]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Taetigkeiten_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Taetigkeiten_Status] ON [dbo].[Taetigkeiten]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaetigkeitenHistory_AnsprechI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenHistory_AnsprechI3D] ON [dbo].[TaetigkeitenHistory]
(
	[AnsprechI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaetigkeitenHistory_BarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenHistory_BarcodeI3D] ON [dbo].[TaetigkeitenHistory]
(
	[BarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaetigkeitenHistory_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenHistory_Datum] ON [dbo].[TaetigkeitenHistory]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [TaetigkeitenHistory_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenHistory_Name] ON [dbo].[TaetigkeitenHistory]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaetigkeitenHistory_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenHistory_ObjektArt] ON [dbo].[TaetigkeitenHistory]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaetigkeitenHistory_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenHistory_ObjektI3D] ON [dbo].[TaetigkeitenHistory]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaetigkeitenHistory_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenHistory_Status] ON [dbo].[TaetigkeitenHistory]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaetigkeitenVorlagen_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenVorlagen_Art] ON [dbo].[TaetigkeitenVorlagen]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [TaetigkeitenVorlagen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenVorlagen_Name] ON [dbo].[TaetigkeitenVorlagen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaetigkeitenVorlagen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaetigkeitenVorlagen_Status] ON [dbo].[TaetigkeitenVorlagen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Tagebuch_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Tagebuch_Datum] ON [dbo].[Tagebuch]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Tagebuch0]    Script Date: 11.11.2025 11:20:30 ******/
CREATE UNIQUE NONCLUSTERED INDEX [Tagebuch0] ON [dbo].[Tagebuch]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_Tags_Caption]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_Tags_Caption] ON [dbo].[Tags]
(
	[Caption] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [TAPIAnrufer_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TAPIAnrufer_Nummer] ON [dbo].[TAPIAnrufer]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TAPIAnrufer_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TAPIAnrufer_Status] ON [dbo].[TAPIAnrufer]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [TAPINummern_Nummer1]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TAPINummern_Nummer1] ON [dbo].[TAPINummern]
(
	[Nummer1] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TAPINummern_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TAPINummern_ObjektArt] ON [dbo].[TAPINummern]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TAPINummern_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TAPINummern_ObjektI3D] ON [dbo].[TAPINummern]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TAPIRueckrufe_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TAPIRueckrufe_Datum] ON [dbo].[TAPIRueckrufe]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AK_TaskChecklistSuggestions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [AK_TaskChecklistSuggestions_Status] ON [dbo].[TaskChecklistSuggestions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [AK_TaskChecklistSuggestions_TaskI3D_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [AK_TaskChecklistSuggestions_TaskI3D_Status] ON [dbo].[TaskChecklistSuggestions]
(
	[TaskI3D] DESC,
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaskManagementTemplate_CustomerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaskManagementTemplate_CustomerI3D] ON [dbo].[TaskManagementAction]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TaskManagementTemplate_TypeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TaskManagementTemplate_TypeI3D] ON [dbo].[TaskManagementAction]
(
	[TypeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Telefonate_OwnerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Telefonate_OwnerI3D] ON [dbo].[Telefonate]
(
	[OwnerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TelemarketingTexte_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TelemarketingTexte_Status] ON [dbo].[TelemarketingTexte]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Termine_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Termine_ObjektArt] ON [dbo].[Termine]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Termine_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Termine_ObjektI3D] ON [dbo].[Termine]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Termine_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Termine_Status] ON [dbo].[Termine]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_Terminplanung_Von]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idx_Terminplanung_Von] ON [dbo].[Terminplanung]
(
	[Von] DESC,
	[Bis] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Terminplanung_AufKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Terminplanung_AufKopfI3D] ON [dbo].[Terminplanung]
(
	[AufKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Terminplanung_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Terminplanung_KundenI3D] ON [dbo].[Terminplanung]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Terminplanung_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Terminplanung_ObjektArt] ON [dbo].[Terminplanung]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Terminplanung_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Terminplanung_ObjektI3D] ON [dbo].[Terminplanung]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Terminplanung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Terminplanung_Status] ON [dbo].[Terminplanung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungArt_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungArt_Status] ON [dbo].[TerminplanungArt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungGruppen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungGruppen_Status] ON [dbo].[TerminplanungGruppen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungGruppenPersonen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungGruppenPersonen_Status] ON [dbo].[TerminplanungGruppenPersonen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungOffeneArbeiten_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungOffeneArbeiten_KundenI3D] ON [dbo].[TerminplanungOffeneArbeiten]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungOffeneArbeiten_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungOffeneArbeiten_Status] ON [dbo].[TerminplanungOffeneArbeiten]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungOffeneArbeitenPerson_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungOffeneArbeitenPerson_Status] ON [dbo].[TerminplanungOffeneArbeitenPerson]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_TerminplanungPerson_TerminI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idx_TerminplanungPerson_TerminI3D] ON [dbo].[TerminplanungPerson]
(
	[TerminplanungI3D] ASC,
	[PersonalI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungPerson_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungPerson_ArtikelI3D] ON [dbo].[TerminplanungPerson]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungPerson_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungPerson_Status] ON [dbo].[TerminplanungPerson]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungUrlaube_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungUrlaube_Art] ON [dbo].[TerminplanungUrlaube]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungUrlaube_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungUrlaube_Status] ON [dbo].[TerminplanungUrlaube]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungUrlaubstage_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungUrlaubstage_Status] ON [dbo].[TerminplanungUrlaubstage]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungUrlaubstageLog_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungUrlaubstageLog_Status] ON [dbo].[TerminplanungUrlaubstageLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungZyklischeTermine_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungZyklischeTermine_ObjektArt] ON [dbo].[TerminplanungZyklischeTermine]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungZyklischeTermine_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungZyklischeTermine_ObjektI3D] ON [dbo].[TerminplanungZyklischeTermine]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungZyklischeTermine_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungZyklischeTermine_Status] ON [dbo].[TerminplanungZyklischeTermine]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TerminplanungZyklischeTerminePersonal_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TerminplanungZyklischeTerminePersonal_Status] ON [dbo].[TerminplanungZyklischeTerminePersonal]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Textbaustein_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Textbaustein_Art] ON [dbo].[Textbaustein]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Textbaustein_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Textbaustein_KundenI3D] ON [dbo].[Textbaustein]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Textbaustein_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Textbaustein_Status] ON [dbo].[Textbaustein]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [TicketPattern_TypeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [TicketPattern_TypeI3D] ON [dbo].[TicketPattern]
(
	[TypeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_TicketPatternCustomerMappings_AddressContactI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_TicketPatternCustomerMappings_AddressContactI3D] ON [dbo].[TicketPatternCustomerMappings]
(
	[AddressContactI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_TicketPatternCustomerMappings_CustomerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_TicketPatternCustomerMappings_CustomerI3D] ON [dbo].[TicketPatternCustomerMappings]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_TicketProjectLogs_TicketProjectI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_TicketProjectLogs_TicketProjectI3D] ON [dbo].[TicketProjectLogs]
(
	[TicketProjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_TicketTags_TagI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_TicketTags_TagI3D] ON [dbo].[TicketTags]
(
	[TagI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_TicketTags_TicketI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_TicketTags_TicketI3D] ON [dbo].[TicketTags]
(
	[TicketI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ToDoListe_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ToDoListe_Nummer] ON [dbo].[ToDoListe]
(
	[Nummer] ASC
)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, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ToDoListe_ObjectI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ToDoListe_ObjectI3D] ON [dbo].[ToDoListe]
(
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ToDoListe_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ToDoListe_ObjektArt] ON [dbo].[ToDoListe]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ToDoListe_PosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ToDoListe_PosI3D] ON [dbo].[ToDoListe]
(
	[PosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [UNTERWAREN_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [UNTERWAREN_LagerI3D] ON [dbo].[UNTERWAREN]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [UNTERWAREN_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [UNTERWAREN_Status] ON [dbo].[UNTERWAREN]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Unterwarenaufschlaege_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Unterwarenaufschlaege_Status] ON [dbo].[Unterwarenaufschlaege]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_UserHelpdeskData_ChangedDate]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_UserHelpdeskData_ChangedDate] ON [dbo].[UserHelpdeskData]
(
	[ChangedDate] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Var1AnlageControlling_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Var1AnlageControlling_Status] ON [dbo].[Var1AnlageControlling]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [Versandart_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Versandart_Name] ON [dbo].[Versandart]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Versandart_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Versandart_Status] ON [dbo].[Versandart]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragAenderungsart_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragAenderungsart_Status] ON [dbo].[VertragAenderungsart]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragArtikel_ArtikelI3D] ON [dbo].[VertragArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragBepreisungArt_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragBepreisungArt_Status] ON [dbo].[VertragBepreisungArt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragBepreisungArtikel_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragBepreisungArtikel_Art] ON [dbo].[VertragBepreisungArtikel]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragBepreisungArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragBepreisungArtikel_ArtikelI3D] ON [dbo].[VertragBepreisungArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragBepreisungArtikel_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragBepreisungArtikel_Code] ON [dbo].[VertragBepreisungArtikel]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragBepreisungArtikel_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragBepreisungArtikel_Status] ON [dbo].[VertragBepreisungArtikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragBepreisungWaren_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragBepreisungWaren_Art] ON [dbo].[VertragBepreisungWaren]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragBepreisungWaren_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragBepreisungWaren_Status] ON [dbo].[VertragBepreisungWaren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragBepreisungWeise_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragBepreisungWeise_Status] ON [dbo].[VertragBepreisungWeise]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragGeraete_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragGeraete_Status] ON [dbo].[VertragGeraete]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingent_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingent_Status] ON [dbo].[VertragKontingent]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_VertragKontingentAnlagePositionen_opt_cfn_ContingentState]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idx_VertragKontingentAnlagePositionen_opt_cfn_ContingentState] ON [dbo].[VertragKontingentAnlagePositionen]
(
	[VertragKopfI3D] ASC,
	[Datum] ASC,
	[Status] ASC
)
INCLUDE([AnlageArt],[VKKalk],[KontingentArt],[AusgleichStk]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentAnlagePositionen_AnlageArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentAnlagePositionen_AnlageArt] ON [dbo].[VertragKontingentAnlagePositionen]
(
	[AnlageArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragKontingentAnlagePositionen_ArtikelCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentAnlagePositionen_ArtikelCode] ON [dbo].[VertragKontingentAnlagePositionen]
(
	[ArtikelCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentAnlagePositionen_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentAnlagePositionen_ArtikelI3D] ON [dbo].[VertragKontingentAnlagePositionen]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentAnlagePositionen_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentAnlagePositionen_Datum] ON [dbo].[VertragKontingentAnlagePositionen]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentAnlagePositionen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentAnlagePositionen_Status] ON [dbo].[VertragKontingentAnlagePositionen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentart_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentart_Status] ON [dbo].[VertragKontingentart]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentEinstellungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentEinstellungen_Status] ON [dbo].[VertragKontingentEinstellungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentGegenstand_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentGegenstand_Art] ON [dbo].[VertragKontingentGegenstand]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentGegenstand_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentGegenstand_ArtikelI3D] ON [dbo].[VertragKontingentGegenstand]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragKontingentGegenstand_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentGegenstand_Code] ON [dbo].[VertragKontingentGegenstand]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKontingentGegenstand_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKontingentGegenstand_Status] ON [dbo].[VertragKontingentGegenstand]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopf_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopf_InnendienstID] ON [dbo].[VertragKopf]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragKopf_KurzZeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopf_KurzZeich] ON [dbo].[VertragKopf]
(
	[KurzZeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopf_Nummer] ON [dbo].[VertragKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopf_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopf_Techniker2ID] ON [dbo].[VertragKopf]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopf_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopf_TechnikerID] ON [dbo].[VertragKopf]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopfVersions_InnendienstID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopfVersions_InnendienstID] ON [dbo].[VertragKopfVersions]
(
	[InnendienstID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragKopfVersions_Kurzzeich]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopfVersions_Kurzzeich] ON [dbo].[VertragKopfVersions]
(
	[Kurzzeich] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopfVersions_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopfVersions_Nummer] ON [dbo].[VertragKopfVersions]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopfVersions_Techniker2ID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopfVersions_Techniker2ID] ON [dbo].[VertragKopfVersions]
(
	[Techniker2ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopfVersions_TechnikerID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopfVersions_TechnikerID] ON [dbo].[VertragKopfVersions]
(
	[TechnikerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragKopfZaehlerFreistueck_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragKopfZaehlerFreistueck_Status] ON [dbo].[VertragKopfZaehlerFreistueck]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_Art] ON [dbo].[VertragPos]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_ArtikelI3D] ON [dbo].[VertragPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragPos_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_Code] ON [dbo].[VertragPos]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragPos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_EANCode] ON [dbo].[VertragPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_GeraeteBarcodeI3D] ON [dbo].[VertragPos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragPos_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_HerstCode] ON [dbo].[VertragPos]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_Status] ON [dbo].[VertragPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPos_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_Ursprung] ON [dbo].[VertragPos]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPos_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPos_UrsprungI3D] ON [dbo].[VertragPos]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosVersions_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_Art] ON [dbo].[VertragPosVersions]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosVersions_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_ArtikelI3D] ON [dbo].[VertragPosVersions]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragPosVersions_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_Code] ON [dbo].[VertragPosVersions]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragPosVersions_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_EANCode] ON [dbo].[VertragPosVersions]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosVersions_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_GeraeteBarcodeI3D] ON [dbo].[VertragPosVersions]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragPosVersions_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_HerstCode] ON [dbo].[VertragPosVersions]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosVersions_KopfVersionsI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_KopfVersionsI3D] ON [dbo].[VertragPosVersions]
(
	[KopfVersionsI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosVersions_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_Status] ON [dbo].[VertragPosVersions]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosVersions_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_Ursprung] ON [dbo].[VertragPosVersions]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosVersions_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosVersions_UrsprungI3D] ON [dbo].[VertragPosVersions]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosWartung_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosWartung_Art] ON [dbo].[VertragPosWartung]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosWartung_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosWartung_ArtikelI3D] ON [dbo].[VertragPosWartung]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragPosWartung_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosWartung_Code] ON [dbo].[VertragPosWartung]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosWartung_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosWartung_GeraeteBarcodeI3D] ON [dbo].[VertragPosWartung]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragPosWartung_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosWartung_HerstCode] ON [dbo].[VertragPosWartung]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosWartung_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosWartung_Ursprung] ON [dbo].[VertragPosWartung]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosWartung_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosWartung_UrsprungI3D] ON [dbo].[VertragPosWartung]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragPosZaehlerBepreisung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragPosZaehlerBepreisung_Status] ON [dbo].[VertragPosZaehlerBepreisung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idx_VertragRechKopfZuordnung_opt_cfn_ContingentState]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idx_VertragRechKopfZuordnung_opt_cfn_ContingentState] ON [dbo].[VertragRechKopfZuordnung]
(
	[VertragI3D] ASC,
	[Status] ASC,
	[KontingentWert] ASC,
	[GebuchtVon] ASC
)
INCLUDE([Zwischenrechnung],[NachBerechnung],[KontingentRestMitnehmen],[GebuchtBis]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragRechKopfZuordnung_AnlageArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragRechKopfZuordnung_AnlageArt] ON [dbo].[VertragRechKopfZuordnung]
(
	[AnlageArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragRechKopfZuordnung_RechKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragRechKopfZuordnung_RechKopfI3D] ON [dbo].[VertragRechKopfZuordnung]
(
	[RechKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragRechKopfZuordnung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragRechKopfZuordnung_Status] ON [dbo].[VertragRechKopfZuordnung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArt_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArt_Status] ON [dbo].[VertragsArt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtBepreisungArtikel_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtBepreisungArtikel_Art] ON [dbo].[VertragsArtBepreisungArtikel]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtBepreisungArtikel_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtBepreisungArtikel_ArtikelI3D] ON [dbo].[VertragsArtBepreisungArtikel]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragsArtBepreisungArtikel_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtBepreisungArtikel_Code] ON [dbo].[VertragsArtBepreisungArtikel]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtBepreisungArtikel_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtBepreisungArtikel_Status] ON [dbo].[VertragsArtBepreisungArtikel]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtBepreisungWaren_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtBepreisungWaren_Art] ON [dbo].[VertragsArtBepreisungWaren]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtBepreisungWaren_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtBepreisungWaren_Status] ON [dbo].[VertragsArtBepreisungWaren]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtKategorie_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtKategorie_Status] ON [dbo].[VertragsArtKategorie]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtPos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_Art] ON [dbo].[VertragsArtPos]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtPos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_ArtikelI3D] ON [dbo].[VertragsArtPos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragsArtPos_Code]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_Code] ON [dbo].[VertragsArtPos]
(
	[Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragsArtPos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_EANCode] ON [dbo].[VertragsArtPos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtPos_GeraeteBarcodeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_GeraeteBarcodeI3D] ON [dbo].[VertragsArtPos]
(
	[GeraeteBarcodeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [VertragsArtPos_HerstCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_HerstCode] ON [dbo].[VertragsArtPos]
(
	[HerstCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtPos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_Status] ON [dbo].[VertragsArtPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtPos_Ursprung]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_Ursprung] ON [dbo].[VertragsArtPos]
(
	[Ursprung] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragsArtPos_UrsprungI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragsArtPos_UrsprungI3D] ON [dbo].[VertragsArtPos]
(
	[UrsprungI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [VertragStaffelungsart_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [VertragStaffelungsart_Status] ON [dbo].[VertragStaffelungsart]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WahrscheinlichkeitsKlassifizierung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WahrscheinlichkeitsKlassifizierung_Status] ON [dbo].[WahrscheinlichkeitsKlassifizierung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Warehouses_I3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Warehouses_I3D] ON [dbo].[Warehouses]
(
	[I3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WareKopf_AktuelleVersion]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WareKopf_AktuelleVersion] ON [dbo].[WareKopf]
(
	[AktuelleVersion] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WareKopf_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WareKopf_Nummer] ON [dbo].[WareKopf]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WAREN_LagerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WAREN_LagerI3D] ON [dbo].[WAREN]
(
	[LagerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WAREN_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WAREN_Status] ON [dbo].[WAREN]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WAREN0]    Script Date: 11.11.2025 11:20:30 ******/
CREATE UNIQUE NONCLUSTERED INDEX [WAREN0] ON [dbo].[WAREN]
(
	[Warengruppe] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Warenaufschlaege_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Warenaufschlaege_Status] ON [dbo].[Warenaufschlaege]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [idxWarePos_UebernommenAusI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [idxWarePos_UebernommenAusI3D] ON [dbo].[WarePos]
(
	[UebernommenAusI3D] ASC,
	[UebernommenAusArt] ASC
)
INCLUDE([WareKopfI3D]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WarePos_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WarePos_Art] ON [dbo].[WarePos]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [WarePos_Artikelcode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WarePos_Artikelcode] ON [dbo].[WarePos]
(
	[Artikelcode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WarePos_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WarePos_ArtikelI3D] ON [dbo].[WarePos]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [WarePos_EANCode]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WarePos_EANCode] ON [dbo].[WarePos]
(
	[EANCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WarePos_EKAusAufPosI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WarePos_EKAusAufPosI3D] ON [dbo].[WarePos]
(
	[EKAusAufPosI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [WarePos_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WarePos_Hersteller] ON [dbo].[WarePos]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WarePos_WareKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WarePos_WareKopfI3D] ON [dbo].[WarePos]
(
	[WareKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [WartungUntergruppen_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WartungUntergruppen_Name] ON [dbo].[WartungUntergruppen]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebAccounts_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebAccounts_KundenI3D] ON [dbo].[WebAccounts]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebAccounts_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebAccounts_Status] ON [dbo].[WebAccounts]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebAccounts_Type]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebAccounts_Type] ON [dbo].[WebAccounts]
(
	[Type] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebAccounts_TypeI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebAccounts_TypeI3D] ON [dbo].[WebAccounts]
(
	[TypeI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [WebAccounts_Username]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebAccounts_Username] ON [dbo].[WebAccounts]
(
	[Username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [WebKunden_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebKunden_Name] ON [dbo].[WebKunden]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [WebLog_Username]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebLog_Username] ON [dbo].[WebLog]
(
	[Username] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebShopEinstellungen_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebShopEinstellungen_Status] ON [dbo].[WebShopEinstellungen]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebShopKopf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebShopKopf_Status] ON [dbo].[WebShopKopf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [WebShopPos_Hersteller]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebShopPos_Hersteller] ON [dbo].[WebShopPos]
(
	[Hersteller] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebShopPos_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebShopPos_Status] ON [dbo].[WebShopPos]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebShopZuordnung_ObjektArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebShopZuordnung_ObjektArt] ON [dbo].[WebShopZuordnung]
(
	[ObjektArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebShopZuordnung_ObjektI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebShopZuordnung_ObjektI3D] ON [dbo].[WebShopZuordnung]
(
	[ObjektI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebShopZuordnung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebShopZuordnung_Status] ON [dbo].[WebShopZuordnung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WEBUsers_KundenID]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WEBUsers_KundenID] ON [dbo].[WEBUsers]
(
	[KundenID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WEBUsers_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WEBUsers_Status] ON [dbo].[WEBUsers]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WebZeiterfassung_KundenI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WebZeiterfassung_KundenI3D] ON [dbo].[WebZeiterfassung]
(
	[KundenI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Werkzeugverwaltung_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Werkzeugverwaltung_Nummer] ON [dbo].[Werkzeugverwaltung]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_WorkflowBaustein_WorkflowProcessI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_WorkflowBaustein_WorkflowProcessI3D] ON [dbo].[WorkflowBaustein]
(
	[WorkflowProcessI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WorkflowBaustein_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WorkflowBaustein_Status] ON [dbo].[WorkflowBaustein]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_WorkflowBausteinParameter_WorkflowBausteinI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_WorkflowBausteinParameter_WorkflowBausteinI3D] ON [dbo].[WorkflowBausteinParameter]
(
	[WorkflowBausteinI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WorkflowBausteinParameter_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WorkflowBausteinParameter_Art] ON [dbo].[WorkflowBausteinParameter]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WorkflowBausteinParameter_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WorkflowBausteinParameter_Status] ON [dbo].[WorkflowBausteinParameter]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_WorkflowBausteinZuordnung_WorkflowProcessI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_WorkflowBausteinZuordnung_WorkflowProcessI3D] ON [dbo].[WorkflowBausteinZuordnung]
(
	[WorkflowProcessI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WorkflowBausteinZuordnung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WorkflowBausteinZuordnung_Status] ON [dbo].[WorkflowBausteinZuordnung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WorkflowMissingEmailCheck_CustomerI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WorkflowMissingEmailCheck_CustomerI3D] ON [dbo].[WorkflowMissingEmailCheck]
(
	[CustomerI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [IX_WorkflowProcess_WorkflowObject]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [IX_WorkflowProcess_WorkflowObject] ON [dbo].[WorkflowProzess]
(
	[ObjectArt] ASC,
	[ObjectI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WorkflowProzess_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WorkflowProzess_Art] ON [dbo].[WorkflowProzess]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [WorkflowProzess_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [WorkflowProzess_Status] ON [dbo].[WorkflowProzess]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [XMLLockList_Name]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [XMLLockList_Name] ON [dbo].[XMLLockList]
(
	[Name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [XMLLockList_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [XMLLockList_Status] ON [dbo].[XMLLockList]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZaehlerArt_ArtikelI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZaehlerArt_ArtikelI3D] ON [dbo].[ZaehlerArt]
(
	[ArtikelI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZaehlerArt_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZaehlerArt_Status] ON [dbo].[ZaehlerArt]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZahKondWebToCentron_Art]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZahKondWebToCentron_Art] ON [dbo].[ZahKondWebToCentron]
(
	[Art] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZahKondWebToCentron_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZahKondWebToCentron_Status] ON [dbo].[ZahKondWebToCentron]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Zahktext_Land]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Zahktext_Land] ON [dbo].[Zahktext]
(
	[Land] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Zahlungseingang_Nummer]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Zahlungseingang_Nummer] ON [dbo].[Zahlungseingang]
(
	[Nummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZahlungseingangLog_RechKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZahlungseingangLog_RechKopfI3D] ON [dbo].[ZahlungseingangLog]
(
	[RechKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZahlungseingangLog_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZahlungseingangLog_Status] ON [dbo].[ZahlungseingangLog]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZahlungsLauf_Datum]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZahlungsLauf_Datum] ON [dbo].[ZahlungsLauf]
(
	[Datum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZahlungsLauf_KalkKopfI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZahlungsLauf_KalkKopfI3D] ON [dbo].[ZahlungsLauf]
(
	[KalkKopfI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [ZahlungsLauf_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [ZahlungsLauf_Status] ON [dbo].[ZahlungsLauf]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Zeiterfassung_AnlageArt]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Zeiterfassung_AnlageArt] ON [dbo].[Zeiterfassung]
(
	[AnlageArt] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Zeiterfassung_AnlageI3D]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Zeiterfassung_AnlageI3D] ON [dbo].[Zeiterfassung]
(
	[AnlageI3D] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
/****** Object:  Index [Zeiterfassung_Status]    Script Date: 11.11.2025 11:20:30 ******/
CREATE NONCLUSTERED INDEX [Zeiterfassung_Status] ON [dbo].[Zeiterfassung]
(
	[Status] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AbholKopf] ADD  CONSTRAINT [DF_AbholKopf_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[AbholKopf] ADD  CONSTRAINT [DF_AbholKopf_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[AbholKopf] ADD  CONSTRAINT [DF_AbholKopf_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[AbholKopf] ADD  CONSTRAINT [DF_AbholKopf_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[AbholKopf] ADD  CONSTRAINT [DF_AbholKopf_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[AbholKopf] ADD  CONSTRAINT [DF_AbholKopf_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[AbholKopfVersions] ADD  CONSTRAINT [DF_AbholKopfVersions_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[AbholKopfVersions] ADD  CONSTRAINT [DF_AbholKopfVersions_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[AbholKopfVersions] ADD  CONSTRAINT [DF_AbholKopfVersions_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[AbholKopfVersions] ADD  CONSTRAINT [DF_AbholKopfVersions_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[AbholKopfVersions] ADD  CONSTRAINT [DF_AbholKopfVersions_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[AbholKopfVersions] ADD  CONSTRAINT [DF_AbholKopfVersions_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[AccountActivities] ADD  CONSTRAINT [DF_AccountActivities_Text]  DEFAULT ('') FOR [Text]
GO
ALTER TABLE [dbo].[AccountActivities] ADD  CONSTRAINT [DF_AccountActivities_TextRtf]  DEFAULT ('') FOR [TextRtf]
GO
ALTER TABLE [dbo].[AccountActivities] ADD  CONSTRAINT [DF_AccountActivities_ProjectNumber]  DEFAULT ('') FOR [ProjectNumber]
GO
ALTER TABLE [dbo].[AccountAddressContacts] ADD  CONSTRAINT [DF_AccountAddressContacts_IsInvoiceMailCCReceiver]  DEFAULT ((0)) FOR [IsInvoiceMailCCReceiver]
GO
ALTER TABLE [dbo].[AccountAddresses] ADD  CONSTRAINT [DC_AccountAddresses_GeoInfoUpdateFailed]  DEFAULT ((0)) FOR [GeoInfoUpdateFailed]
GO
ALTER TABLE [dbo].[AccountArticleSpecialPricesImportSettings] ADD  CONSTRAINT [DF_AccountArticleSpecialPricesImportSettings_IsActiveForImport]  DEFAULT ((1)) FOR [IsActiveForImport]
GO
ALTER TABLE [dbo].[AccountCustomers] ADD  CONSTRAINT [DF_AccountCustomers_CanSeeTickets]  DEFAULT ((0)) FOR [CanSeeTicketsSBO]
GO
ALTER TABLE [dbo].[AccountCustomers] ADD  CONSTRAINT [DF_AccountCustomers_CustomerApprovalEnabled]  DEFAULT ((0)) FOR [CustomerApprovalEnabledSBO]
GO
ALTER TABLE [dbo].[AccountCustomFilters] ADD  DEFAULT ((0)) FOR [OnlySearchResult]
GO
ALTER TABLE [dbo].[AccountCustomFilters] ADD  DEFAULT ((0)) FOR [IsForSetting]
GO
ALTER TABLE [dbo].[AccountOrderProcessingContracts] ADD  DEFAULT ((0)) FOR [UseOwnTemplateText]
GO
ALTER TABLE [dbo].[AccountRelationships] ADD  CONSTRAINT [DF_AccountRelationships_SendMailThroughBcc]  DEFAULT ((0)) FOR [SendMailThroughBcc]
GO
ALTER TABLE [dbo].[AccountRelationships] ADD  CONSTRAINT [DF_AccountRelationships_NotifyAtCrmActivitiesTo]  DEFAULT ((0)) FOR [NotifyAtCrmActivitiesTo]
GO
ALTER TABLE [dbo].[AccountRelationships] ADD  CONSTRAINT [DF_AccountRelationships_NotifyAtCrmActivitiesBCC]  DEFAULT ((0)) FOR [NotifyAtCrmActivitiesBCC]
GO
ALTER TABLE [dbo].[Accounts] ADD  CONSTRAINT [DF_Accounts_UseSettingsFromCompanyGroupForReceipts]  DEFAULT ((0)) FOR [UseSettingsFromCompanyGroupForReceipts]
GO
ALTER TABLE [dbo].[AccountSuppliers] ADD  DEFAULT ((0)) FOR [IsDistributor]
GO
ALTER TABLE [dbo].[AccountTypes] ADD  DEFAULT ('FALSE') FOR [IsFavorite]
GO
ALTER TABLE [dbo].[AddressContactPersonWebAccountRequests] ADD  DEFAULT ((0)) FOR [State]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_IsCart]  DEFAULT ((0)) FOR [IsCart]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_ContractPositionCombinationDecision]  DEFAULT ((0)) FOR [ContractPositionCombinationDecision]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_TakeOnlyArticles]  DEFAULT ((0)) FOR [TakeOnlyArticles]
GO
ALTER TABLE [dbo].[AngKopf] ADD  CONSTRAINT [DF_AngKopf_CartAssembleArticles]  DEFAULT ((0)) FOR [CartAssembleArticles]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_IsCart]  DEFAULT ((0)) FOR [IsCart]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_ContractPositionCombinationDecision]  DEFAULT ((0)) FOR [ContractPositionCombinationDecision]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_TakeOnlyArticles]  DEFAULT ((0)) FOR [TakeOnlyArticles]
GO
ALTER TABLE [dbo].[AngKopfVersions] ADD  CONSTRAINT [DF_AngKopfVersions_CartAssembleArticles]  DEFAULT ((0)) FOR [CartAssembleArticles]
GO
ALTER TABLE [dbo].[AngPos] ADD  DEFAULT ((0)) FOR [PlannedDurationInHours]
GO
ALTER TABLE [dbo].[AngPosVersions] ADD  DEFAULT ((0)) FOR [PlannedDurationInHours]
GO
ALTER TABLE [dbo].[AppointmentProposals] ADD  CONSTRAINT [DF_AppointmentProposals_AllDay]  DEFAULT ((0)) FOR [AllDay]
GO
ALTER TABLE [dbo].[AppointmentRequests] ADD  CONSTRAINT [DF_AppointmentRequests_Guid]  DEFAULT (newid()) FOR [Guid]
GO
ALTER TABLE [dbo].[ArticleProductionStep] ADD  CONSTRAINT [DF_ArticleProductionStep_RequiredAmount]  DEFAULT ((0)) FOR [RequiredAmount]
GO
ALTER TABLE [dbo].[ArticleUnit] ADD  CONSTRAINT [DF_WorkUnit_State]  DEFAULT ((1)) FOR [State]
GO
ALTER TABLE [dbo].[ARTIK] ADD  DEFAULT ((0)) FOR [MaintenanceKind]
GO
ALTER TABLE [dbo].[ARTIK] ADD  DEFAULT ((0)) FOR [IsContractArticle]
GO
ALTER TABLE [dbo].[ARTIK] ADD  DEFAULT ((1)) FOR [ContractArticleDurationTime]
GO
ALTER TABLE [dbo].[ARTIK] ADD  DEFAULT ((1)) FOR [ContractArticleDurationKind]
GO
ALTER TABLE [dbo].[ARTIK] ADD  CONSTRAINT [DF_ARTIK_DefaultArticleSearchQuantity]  DEFAULT ((1)) FOR [DefaultArticleSearchQuantity]
GO
ALTER TABLE [dbo].[ARTIK] ADD  CONSTRAINT [DF_ARTIK_UpdateVKsInPartList]  DEFAULT ((0)) FOR [UpdateVKsInPartList]
GO
ALTER TABLE [dbo].[ARTIK] ADD  CONSTRAINT [DF_ARTIK_IsMspArticle]  DEFAULT ((0)) FOR [IsMspArticle]
GO
ALTER TABLE [dbo].[ARTIK] ADD  CONSTRAINT [DF_ARTIK_IsAIEdited]  DEFAULT ((0)) FOR [IsAIEdited]
GO
ALTER TABLE [dbo].[AssetManagementAntivirusInformations] ADD  CONSTRAINT [DF_AssetManagementAntivirusInformations_IsDeleted]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[AssetManagementApplication] ADD  DEFAULT ((0)) FOR [Is64Bit]
GO
ALTER TABLE [dbo].[AssetManagementCheckErrorLogs] ADD  DEFAULT ((1)) FOR [Type]
GO
ALTER TABLE [dbo].[AssetManagementCheckStatusReports] ADD  CONSTRAINT [DF_AssetManagementCheckStatusReports_Active]  DEFAULT ((0)) FOR [Active]
GO
ALTER TABLE [dbo].[AssetManagementCrawlerConfigurations] ADD  DEFAULT ((0)) FOR [IsCreateHelpdesk]
GO
ALTER TABLE [dbo].[AssetManagementCrawlerConfigurations] ADD  DEFAULT ((0)) FOR [IsPerformanceCheckEnabled]
GO
ALTER TABLE [dbo].[AssetManagementCrawlerConfigurations] ADD  DEFAULT ((0)) FOR [PerformanceCheckInterval]
GO
ALTER TABLE [dbo].[AssetManagementCrawlerConfigurations] ADD  DEFAULT ((1)) FOR [IsPerformanceCheckExecutionStart]
GO
ALTER TABLE [dbo].[AssetManagementCrawlerConfigurations] ADD  DEFAULT ((0)) FOR [IsLoginFailedCheckEnabled]
GO
ALTER TABLE [dbo].[AssetManagementCrawlerConfigurations] ADD  DEFAULT ((0)) FOR [LoginFailedCheckInterval]
GO
ALTER TABLE [dbo].[AssetManagementCrawlerConfigurations] ADD  DEFAULT ((1)) FOR [IsLoginFailedCheckExecutionStart]
GO
ALTER TABLE [dbo].[AssetManagementCustomerDomains] ADD  CONSTRAINT [DF_AssetManagementCustomerDomains_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementDevices] ADD  DEFAULT ((0)) FOR [SystemCrawlerNeedToUnInstall]
GO
ALTER TABLE [dbo].[AssetManagementDevices] ADD  DEFAULT ((0)) FOR [IsSystemCrawlerRestart]
GO
ALTER TABLE [dbo].[AssetManagementDevices] ADD  DEFAULT ((0)) FOR [IsDeviceRestart]
GO
ALTER TABLE [dbo].[AssetManagementDevices] ADD  DEFAULT ((0)) FOR [IsDownloadLogs]
GO
ALTER TABLE [dbo].[AssetManagementDevices] ADD  DEFAULT ((0)) FOR [ServiceWorkStatus]
GO
ALTER TABLE [dbo].[AssetManagementDevices] ADD  DEFAULT ((0)) FOR [IsSystemCrawlerReinstall]
GO
ALTER TABLE [dbo].[AssetManagementDevices] ADD  DEFAULT ((0)) FOR [RebootPending]
GO
ALTER TABLE [dbo].[AssetManagementDHCPServerSubnetOptions] ADD  DEFAULT ((1)) FOR [TypeID]
GO
ALTER TABLE [dbo].[AssetManagementDomainContacts] ADD  CONSTRAINT [DF_AssetManagementDomainContacts_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementEventLogChecks] ADD  DEFAULT ((0)) FOR [EventId]
GO
ALTER TABLE [dbo].[AssetManagementFolderInformations] ADD  DEFAULT ((0)) FOR [IsShareRoot]
GO
ALTER TABLE [dbo].[AssetManagementFolderInformations] ADD  DEFAULT ((0)) FOR [PermissionsNotEqualToParent]
GO
ALTER TABLE [dbo].[AssetManagementHardDriveChecks] ADD  DEFAULT ('GB') FOR [Criteria]
GO
ALTER TABLE [dbo].[AssetManagementHttpChecks] ADD  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementLoginFailedChecks] ADD  CONSTRAINT [DF_AssetManagementLoginFailedChecks_BackDays]  DEFAULT ((1)) FOR [BackDays]
GO
ALTER TABLE [dbo].[AssetManagementMSBackupChecks] ADD  DEFAULT ((0)) FOR [IsCheckEnabled]
GO
ALTER TABLE [dbo].[AssetManagementNetworkAdapter] ADD  DEFAULT ((0)) FOR [AdapterTypeId]
GO
ALTER TABLE [dbo].[AssetManagementNetworkAdapter] ADD  DEFAULT ((13)) FOR [NetConnectionStatus]
GO
ALTER TABLE [dbo].[AssetManagementNetworkAdapter] ADD  DEFAULT ((1)) FOR [IsPhysicalAdapter]
GO
ALTER TABLE [dbo].[AssetManagementNetworkAdapter] ADD  DEFAULT ((1)) FOR [IsNetEnabled]
GO
ALTER TABLE [dbo].[AssetManagementNotification] ADD  DEFAULT ((0)) FOR [ManualCreation]
GO
ALTER TABLE [dbo].[AssetManagementPatch] ADD  DEFAULT ((0)) FOR [NeedToInstall]
GO
ALTER TABLE [dbo].[AssetManagementPerformanceChecks] ADD  DEFAULT ((1)) FOR [BackExecutionTimes]
GO
ALTER TABLE [dbo].[AssetManagementPhysicalDrive] ADD  CONSTRAINT [DF_AssetManagementPhysicalDrive_IsPrimaryDrive]  DEFAULT ((0)) FOR [IsPrimaryDrive]
GO
ALTER TABLE [dbo].[AssetManagementServiceConnectorStatus] ADD  CONSTRAINT [DF_CSI_AssetManagementServiceConnectorStatus_IsInstalled]  DEFAULT ((0)) FOR [IsInstalled]
GO
ALTER TABLE [dbo].[AssetManagementSnmpArpAppCaches] ADD  CONSTRAINT [DF_AssetManagementSnmpArpAppCaches_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSnmpArpInterfaceIpMaps] ADD  CONSTRAINT [DF_AssetManagementSnmpArpInterfaceIpMaps_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSnmpArpNetworkMapDevices] ADD  CONSTRAINT [DF_AssetManagementSnmpArpNetworkMapDevices_IsSwitch]  DEFAULT ((0)) FOR [IsSwitch]
GO
ALTER TABLE [dbo].[AssetManagementSnmpArpNetworkMapDevices] ADD  CONSTRAINT [DF_AssetManagementSnmpArpNetworkMapDevices_IsWorkstation]  DEFAULT ((0)) FOR [IsWorkstation]
GO
ALTER TABLE [dbo].[AssetManagementSnmpArpNetworkMapDevices] ADD  CONSTRAINT [DF_AssetManagementSnmpArpNetworkMapDevices_IsPrinter]  DEFAULT ((0)) FOR [IsPrinter]
GO
ALTER TABLE [dbo].[AssetManagementSnmpArpNetworkMapDevices] ADD  CONSTRAINT [DF_AssetManagementSnmpArpNetworkMapDevices_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSnmpArpRoutings] ADD  CONSTRAINT [DF_AssetManagementSnmpArpRoutings_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSnmpArpSegmentMaps] ADD  CONSTRAINT [DF_AssetManagementSnmpArpSegmentMaps_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSNMPChecks] ADD  CONSTRAINT [DF_AssetManagementSNMPChecks_IsActive_1]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSNMPDetails] ADD  DEFAULT ((0)) FOR [IsSSHEnabled]
GO
ALTER TABLE [dbo].[AssetManagementSNMPDetails] ADD  DEFAULT ((0)) FOR [IsTelnetEnabled]
GO
ALTER TABLE [dbo].[AssetManagementSNMPDetails] ADD  DEFAULT ((0)) FOR [IsHttpsSupported]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibChecks] ADD  CONSTRAINT [DF_AssetManagementSnmpMibChecks_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibChecks] ADD  DEFAULT ('') FOR [DisplayName]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibChecks] ADD  CONSTRAINT [DF_SizeCheckType]  DEFAULT ((-1)) FOR [SizeCheckType]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibChecks] ADD  DEFAULT ((0)) FOR [OperatorValue]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibChecks] ADD  DEFAULT ((161)) FOR [PortValue]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibDetails] ADD  CONSTRAINT [DF_AssetManagementSnmpMibDetails_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibOidDetails] ADD  CONSTRAINT [DF_AssetManagementSnmpMibOidDetails_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibOidDetails] ADD  DEFAULT ((0)) FOR [IsRangeEnabled]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibOidDetails] ADD  DEFAULT ((2)) FOR [CommandType]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibOidDetails] ADD  DEFAULT ((0)) FOR [IsParallelRecordsExists]
GO
ALTER TABLE [dbo].[AssetManagementSnmpMibOidDetails] ADD  CONSTRAINT [DF_SnmpMibOidDetails_SizeCheckType]  DEFAULT ((-1)) FOR [SizeCheckType]
GO
ALTER TABLE [dbo].[AssetManagementSNMPOIDChecks] ADD  DEFAULT ((0)) FOR [SnmpType]
GO
ALTER TABLE [dbo].[AssetManagementSQLServerChecks] ADD  DEFAULT ((1)) FOR [IntegratedSecurity]
GO
ALTER TABLE [dbo].[AssetManagementStartupPrograms] ADD  DEFAULT ((0)) FOR [IsEnabled]
GO
ALTER TABLE [dbo].[AssetManagementVmWareChecks] ADD  CONSTRAINT [DF_AssetManagementVmWareChecks_AlarmCheckEnabled]  DEFAULT ((0)) FOR [AlarmCheckEnabled]
GO
ALTER TABLE [dbo].[AssetManagementWindowsServiceChecks] ADD  DEFAULT ((5)) FOR [ThresholdValue]
GO
ALTER TABLE [dbo].[AssetManagementWindowsUpdateCategories] ADD  DEFAULT ((0)) FOR [MsrcSeverity]
GO
ALTER TABLE [dbo].[AssetManagementWindowsUpdateCategories] ADD  CONSTRAINT [DF_AssetManagementWindowsUpdateCategories_DelayUpdateCategoriesPerDay]  DEFAULT ((0)) FOR [DelayUpdateCategoriesPerDay]
GO
ALTER TABLE [dbo].[AssetManagmentDeviceWindowsUpdatePolicy] ADD  DEFAULT ((0)) FOR [IsActive]
GO
ALTER TABLE [dbo].[AssetManagmentDeviceWindowsUpdatePolicy] ADD  DEFAULT ((0)) FOR [UpdateInstallationKind]
GO
ALTER TABLE [dbo].[AssetManagmentDeviceWindowsUpdatePolicy] ADD  DEFAULT ((0)) FOR [Reboot]
GO
ALTER TABLE [dbo].[AssetManagmentDeviceWindowsUpdatePolicy] ADD  DEFAULT ((0)) FOR [ShutDownAfterInstallation]
GO
ALTER TABLE [dbo].[AssetManagmentDeviceWindowsUpdatePolicy] ADD  DEFAULT ((0)) FOR [WakeOnLan]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_NetPriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceComplete]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_TaxPriceComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceComplete]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_NetPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceFCComplete]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_TaxPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceFCComplete]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_NetPurchasePriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceComplete]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_NetPurchasePriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFCComplete]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_ContractPositionCombinationDecision]  DEFAULT ((0)) FOR [ContractPositionCombinationDecision]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_TakeOnlyArticles]  DEFAULT ((0)) FOR [TakeOnlyArticles]
GO
ALTER TABLE [dbo].[AufKopf] ADD  CONSTRAINT [DF_AufKopf_CommissionMailSetting]  DEFAULT ((0)) FOR [CommissionMailSetting]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_NetPriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceComplete]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_TaxPriceComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceComplete]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_NetPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceFCComplete]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_TaxPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceFCComplete]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_NetPurchasePriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceComplete]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_NetPurchasePriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFCComplete]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_ContractPositionCombinationDecision]  DEFAULT ((0)) FOR [ContractPositionCombinationDecision]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_TakeOnlyArticles]  DEFAULT ((0)) FOR [TakeOnlyArticles]
GO
ALTER TABLE [dbo].[AufKopfVersions] ADD  CONSTRAINT [DF_AufKopfVersions_CommissionMailSetting]  DEFAULT ((0)) FOR [CommissionMailSetting]
GO
ALTER TABLE [dbo].[AufPos] ADD  DEFAULT ((0)) FOR [PlannedDurationInHours]
GO
ALTER TABLE [dbo].[AufPosVersions] ADD  DEFAULT ((0)) FOR [PlannedDurationInHours]
GO
ALTER TABLE [dbo].[Barcode] ADD  CONSTRAINT [DF_Barcode_IsInRma]  DEFAULT ((0)) FOR [IsInRma]
GO
ALTER TABLE [dbo].[BarcodeConditions] ADD  CONSTRAINT [DF_BarcodeConditions_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[BarcodeConditions] ADD  CONSTRAINT [DF_BarcodeConditions_IsDefault]  DEFAULT ((0)) FOR [IsDefault]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_UseIndividualBookingTextForCustomerReceipts]  DEFAULT ((0)) FOR [UseIndividualBookingTextForCustomerReceipts]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_UseIndividualBookingTextForSupplierReceipts]  DEFAULT ((0)) FOR [UseIndividualBookingTextForSupplierReceipts]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_ShowExportDialog]  DEFAULT ((0)) FOR [ShowExportPathDialog]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_ExportOnlyFixedInvoices]  DEFAULT ((0)) FOR [ExportOnlyFixedInvoices]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_ExportWithoutFixedInvoiceFlag]  DEFAULT ((0)) FOR [ExportWithoutFixedInvoiceFlag]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_ExportSepaMandateReference]  DEFAULT ((1)) FOR [ExportSepaMandateReference]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  DEFAULT ((0)) FOR [UseAccountFromDifferentInvoiceAddress]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  DEFAULT ((0)) FOR [Export0Invoices]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_IsOldCashbookExportActive]  DEFAULT ((0)) FOR [IsOldCashbookExportActive]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_ReceiptsExportAllPositions]  DEFAULT ((0)) FOR [ReceiptsExportAllPositions]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_ExportTaxThroughAccountSystems]  DEFAULT ((0)) FOR [ExportTaxThroughAccountSystems]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_PaymentOrderProcedure]  DEFAULT ((0)) FOR [PaymentOrderProcedure]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_FillAddressNumber]  DEFAULT ((0)) FOR [FillAddressNumber]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_DebitorVersion]  DEFAULT ((2022.00)) FOR [DebitorVersion]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_KreditorVersion]  DEFAULT ((2024.00)) FOR [KreditorVersion]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_DebitorReceiptVersion]  DEFAULT ((2024.00)) FOR [DebitorReceiptVersion]
GO
ALTER TABLE [dbo].[BookKeepingExport] ADD  CONSTRAINT [DF_BookKeepingExport_KreditorReceiptVersion]  DEFAULT ((2024.00)) FOR [KreditorReceiptVersion]
GO
ALTER TABLE [dbo].[CampaignPhaseActions] ADD  CONSTRAINT [DF_CampaignPhaseActions_SendReceiptByMail]  DEFAULT ((0)) FOR [SendReceiptByMail]
GO
ALTER TABLE [dbo].[CampaignPhases] ADD  CONSTRAINT [DF_CampaignPhases_AutomaticExecution]  DEFAULT ((0)) FOR [AutomaticExecution]
GO
ALTER TABLE [dbo].[Campaigns] ADD  CONSTRAINT [FK_Campaings_Sate]  DEFAULT ((0)) FOR [State]
GO
ALTER TABLE [dbo].[Campaigns] ADD  CONSTRAINT [DF_Campaigns_PotentialRevenue]  DEFAULT ((0)) FOR [PotentialRevenue]
GO
ALTER TABLE [dbo].[CentronDMSDirectoryRight] ADD  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[CentronDMSDocument] ADD  DEFAULT ((0)) FOR [IsEncrypted]
GO
ALTER TABLE [dbo].[CentronUiProfiles] ADD  DEFAULT ((0)) FOR [UiProfileType]
GO
ALTER TABLE [dbo].[ChatMemberLastViewedHistory] ADD  DEFAULT ('2019-01-01 00:00:00.000') FOR [LastViewed]
GO
ALTER TABLE [dbo].[ChecklistDetails] ADD  DEFAULT ((0)) FOR [DurationInMinutes]
GO
ALTER TABLE [dbo].[ChecklistDetailTemplates] ADD  DEFAULT ((0)) FOR [ExpectedDurationInMinutes]
GO
ALTER TABLE [dbo].[Checklists] ADD  DEFAULT ((0)) FOR [WorkerKind]
GO
ALTER TABLE [dbo].[Checklists] ADD  DEFAULT ((0)) FOR [Executor]
GO
ALTER TABLE [dbo].[Checklists] ADD  DEFAULT ((0)) FOR [IsRecurrence]
GO
ALTER TABLE [dbo].[ChecklistTemplates] ADD  DEFAULT ((0)) FOR [Executor]
GO
ALTER TABLE [dbo].[ChecklistTemplates] ADD  DEFAULT ((1)) FOR [Status]
GO
ALTER TABLE [dbo].[CometAccount] ADD  CONSTRAINT [DF_CometAccount_DefaultThemeSet]  DEFAULT ((0)) FOR [DefaultThemeSet]
GO
ALTER TABLE [dbo].[ContractArticleReferenzes] ADD  DEFAULT ((0)) FOR [ConsiderUnderbooking]
GO
ALTER TABLE [dbo].[ContractArticleReferenzes] ADD  DEFAULT ((0)) FOR [ConsiderOverbooking]
GO
ALTER TABLE [dbo].[ContractArticleReferenzes] ADD  DEFAULT ((0)) FOR [OverbookingSecondLine]
GO
ALTER TABLE [dbo].[CSI_SocialMediaStream] ADD  CONSTRAINT [DF_CSI_SocialMediaStream_CreatedDate]  DEFAULT (getdate()) FOR [CreatedDate]
GO
ALTER TABLE [dbo].[CustomerProductMatrixRating] ADD  DEFAULT ((0)) FOR [CustomerProductMatrixRatingValue]
GO
ALTER TABLE [dbo].[CustomerProductMatrixRatingChangeLogs] ADD  DEFAULT ((0)) FOR [CustomerProductMatrixRatingValue]
GO
ALTER TABLE [dbo].[DeployablePackageVersion] ADD  DEFAULT ((0)) FOR [Architecture]
GO
ALTER TABLE [dbo].[Documents] ADD  CONSTRAINT [DF_Documents_Flags]  DEFAULT ((0)) FOR [Flags]
GO
ALTER TABLE [dbo].[EDIDeliveryHead] ADD  CONSTRAINT [DF_EDIDeliveryHead_CreatedDate]  DEFAULT (getdate()) FOR [CreatedDate]
GO
ALTER TABLE [dbo].[EDIDeliveryItemsToOrder] ADD  CONSTRAINT [DF_EDIDeliveryItemsToOrder_CentronArticleKind]  DEFAULT ((0)) FOR [CentronArticleKind]
GO
ALTER TABLE [dbo].[EDIInvoiceHead] ADD  CONSTRAINT [DF_EDIInvoiceHead_CreatedDate]  DEFAULT (getdate()) FOR [CreatedDate]
GO
ALTER TABLE [dbo].[EDIInvoiceItemsToOrder] ADD  CONSTRAINT [DF_EDIInvoiceItemsToOrder_CentronArticleKind]  DEFAULT ((0)) FOR [CentronArticleKind]
GO
ALTER TABLE [dbo].[EDIManagementLog] ADD  CONSTRAINT [DF_EDIManagementLog_CreatedDate]  DEFAULT (getdate()) FOR [CreatedDate]
GO
ALTER TABLE [dbo].[EDIOrderResponseHead] ADD  CONSTRAINT [DF_EDIOrderResponseHead_CreatedDate]  DEFAULT (getdate()) FOR [CreatedDate]
GO
ALTER TABLE [dbo].[EDIRechKopf] ADD  CONSTRAINT [DF_EDIRechKopf_Ausgeblendet]  DEFAULT ((0)) FOR [Ausgeblendet]
GO
ALTER TABLE [dbo].[EgisWarenkorbHead] ADD  CONSTRAINT [DF_WarenKorbHead_CreatedAt]  DEFAULT (getdate()) FOR [CreatedAt]
GO
ALTER TABLE [dbo].[ExpectedEvents] ADD  DEFAULT ((0)) FOR [ExpectedEventTypeTime]
GO
ALTER TABLE [dbo].[ExpectedEvents] ADD  DEFAULT ((0)) FOR [ExpectedEventTypeMessageContainsSuccess]
GO
ALTER TABLE [dbo].[ExpectedEvents] ADD  DEFAULT ((0)) FOR [ExpectedEventTypeMessageContainsWarning]
GO
ALTER TABLE [dbo].[ExpectedEvents] ADD  DEFAULT ((0)) FOR [ExpectedEventTypeMessageContainsError]
GO
ALTER TABLE [dbo].[ExternalApplications] ADD  DEFAULT ((0)) FOR [VPNRequired]
GO
ALTER TABLE [dbo].[GeraeteKopf] ADD  CONSTRAINT [DF_GeraeteKopf_IsMsp]  DEFAULT ((0)) FOR [IsMsp]
GO
ALTER TABLE [dbo].[GutKopf] ADD  CONSTRAINT [DF_GutKopf_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[GutKopf] ADD  CONSTRAINT [DF_GutKopf_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[GutKopf] ADD  CONSTRAINT [DF_GutKopf_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[GutKopf] ADD  CONSTRAINT [DF_GutKopf_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[GutKopf] ADD  CONSTRAINT [DF_GutKopf_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[GutKopf] ADD  CONSTRAINT [DF_GutKopf_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[GutKopfVersions] ADD  CONSTRAINT [DF_GutKopfVersions_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[GutKopfVersions] ADD  CONSTRAINT [DF_GutKopfVersions_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[GutKopfVersions] ADD  CONSTRAINT [DF_GutKopfVersions_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[GutKopfVersions] ADD  CONSTRAINT [DF_GutKopfVersions_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[GutKopfVersions] ADD  CONSTRAINT [DF_GutKopfVersions_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[GutKopfVersions] ADD  CONSTRAINT [DF_GutKopfVersions_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[hlpdsk_requests] ADD  CONSTRAINT [DF_hlpdsk_requests_IsOnlyInternalVisible]  DEFAULT ((0)) FOR [IsOnlyInternalVisible]
GO
ALTER TABLE [dbo].[hlpdsk_requests] ADD  CONSTRAINT [DF_hlpdsk_requests_EscalationLevel]  DEFAULT ((0)) FOR [EscalationLevel]
GO
ALTER TABLE [dbo].[hlpdsk_timer] ADD  CONSTRAINT [DF_hlpdsk_timer_CalendarEntryState]  DEFAULT ((1)) FOR [CalendarEntryState]
GO
ALTER TABLE [dbo].[HotlineCustomCategories] ADD  DEFAULT ((0)) FOR [RDPVPNRequired]
GO
ALTER TABLE [dbo].[HotlineCustomCategories] ADD  DEFAULT ((0)) FOR [SSHVPNRequired]
GO
ALTER TABLE [dbo].[KalkKopf] ADD  CONSTRAINT [DF_KalkKopf_IsSupplierInvoiceStandalone]  DEFAULT ((0)) FOR [IsSupplierInvoiceStandalone]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_NetPriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceComplete]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_TaxPriceComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceComplete]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_NetPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceFCComplete]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_TaxPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceFCComplete]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_NetPurchasePriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceComplete]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[LiefKopf] ADD  CONSTRAINT [DF_LiefKopf_NetPurchasePriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFCComplete]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_NetPriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceComplete]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_TaxPriceComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceComplete]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_NetPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceFCComplete]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_TaxPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceFCComplete]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_NetPurchasePriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceComplete]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[LiefKopfVersions] ADD  CONSTRAINT [DF_LiefKopfVersions_NetPurchasePriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFCComplete]
GO
ALTER TABLE [dbo].[MaAbteilung] ADD  CONSTRAINT [DF_MaAbteilung_IsMyDayActive]  DEFAULT ((0)) FOR [IsMyDayActive]
GO
ALTER TABLE [dbo].[MaAbteilung] ADD  CONSTRAINT [DF_MaAbteilung_IsCallSyncActive]  DEFAULT ((0)) FOR [IsCallSyncActive]
GO
ALTER TABLE [dbo].[Machines] ADD  CONSTRAINT [DF_Machines_RunKind]  DEFAULT ((0)) FOR [RunKind]
GO
ALTER TABLE [dbo].[Machines] ADD  CONSTRAINT [DF_Machines_AmountPerRun]  DEFAULT ((0)) FOR [AmountPerRun]
GO
ALTER TABLE [dbo].[Machines] ADD  CONSTRAINT [DF_Machines_RunsPerDay]  DEFAULT ((0)) FOR [RunsPerDay]
GO
ALTER TABLE [dbo].[MailingDaten] ADD  CONSTRAINT [DF_MailingDaten_Version]  DEFAULT ((1)) FOR [Version]
GO
ALTER TABLE [dbo].[MailScannerProfiles] ADD  DEFAULT ((0)) FOR [MailProtocol]
GO
ALTER TABLE [dbo].[MailScannerProfiles] ADD  CONSTRAINT [DF_MailScannerProfiles_ConnectionType]  DEFAULT ((0)) FOR [ConnectionType]
GO
ALTER TABLE [dbo].[MailTemplateAttachments] ADD  CONSTRAINT [DF_MailTemplateAttachments_IsGlobal]  DEFAULT ((0)) FOR [IsGlobal]
GO
ALTER TABLE [dbo].[MailTemplateAttachments] ADD  CONSTRAINT [DF_MailTemplateAttachments_IsPersonal]  DEFAULT ((0)) FOR [IsPersonal]
GO
ALTER TABLE [dbo].[MailVorlagen] ADD  CONSTRAINT [DF_MailVorlagen_BranchI3D]  DEFAULT ((0)) FOR [BranchI3D]
GO
ALTER TABLE [dbo].[MailVorlagen] ADD  CONSTRAINT [DF_MailVorlagen_IsPersonalMailTemplate]  DEFAULT ((0)) FOR [IsPersonalMailTemplate]
GO
ALTER TABLE [dbo].[ModuleCustomProperties] ADD  DEFAULT ((1)) FOR [SortOrder]
GO
ALTER TABLE [dbo].[ModuleCustomProperties] ADD  DEFAULT ((0)) FOR [Sealable]
GO
ALTER TABLE [dbo].[ModuleCustomProperties] ADD  CONSTRAINT [DF_ModuleCustomProperties_IsMandatory]  DEFAULT ((0)) FOR [IsMandatory]
GO
ALTER TABLE [dbo].[ModuleCustomPropertyValues] ADD  DEFAULT ((0)) FOR [Sealed]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_SendOnError]  DEFAULT ((1)) FOR [SendOnError]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_SendOnWarning]  DEFAULT ((1)) FOR [SendOnWarning]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_SendOnSuccess]  DEFAULT ((1)) FOR [SendOnSuccess]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_Adviser1]  DEFAULT ((1)) FOR [Adviser1]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_Adviser2]  DEFAULT ((1)) FOR [Adviser2]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_Adviser3]  DEFAULT ((0)) FOR [Adviser3]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_Adviser4]  DEFAULT ((0)) FOR [Adviser4]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_Adviser5]  DEFAULT ((0)) FOR [Adviser5]
GO
ALTER TABLE [dbo].[MonCheckNotificationMobilePushSettings] ADD  CONSTRAINT [DF_MonCheckNotificationMobilePushSettings_Adviser6]  DEFAULT ((0)) FOR [Adviser6]
GO
ALTER TABLE [dbo].[MonitoringCheckSettings] ADD  CONSTRAINT [DF_MonitoringCheckSettings_IsDelete]  DEFAULT ((0)) FOR [IsDelete]
GO
ALTER TABLE [dbo].[MonitoringCheckTemplateMaps] ADD  CONSTRAINT [DF_MonitoringCheckTemplateMaps_SequenceOrder]  DEFAULT ((1)) FOR [SequenceOrder]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  CONSTRAINT [DF_MonitoringServiceSettings_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((5)) FOR [ServiceConnectorServiceInventoryInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((5)) FOR [ServiceConnectorSystemCrawlerInstallerInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((5)) FOR [ServiceConnectorSystemCrawlerStatusInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ('') FOR [MonitoringWebsiteUrl]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((30)) FOR [SystemCrawlerUpdateStatusInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((5)) FOR [ServiceConnectorUpdaterVersionCheckInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((15)) FOR [ServiceConnectorUpdaterInstallerInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ('') FOR [ServiceConnectorDeviceName]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ('1.0.0.0') FOR [ServiceConnectorVersion]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((15)) FOR [ServiceConnectorSystemCrawlerUninstallInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((0)) FOR [IsServiceConnectorRunning]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((1)) FOR [ServiceType]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((1)) FOR [AdminType]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((0)) FOR [IsDownloadLogs]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((5)) FOR [ServiceConnectorVersionInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((15)) FOR [ServiceConnectorInstallationInterval]
GO
ALTER TABLE [dbo].[MonitoringServiceSettings] ADD  DEFAULT ((15)) FOR [SystemCrawlerUninstallInterval]
GO
ALTER TABLE [dbo].[MonitoringTemplates] ADD  CONSTRAINT [DF_MonitoringTemplates_IsDefaultConfigure]  DEFAULT ((0)) FOR [IsDefaultConfigure]
GO
ALTER TABLE [dbo].[MonitoringTemplates] ADD  CONSTRAINT [DF_MonitoringTemplates_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[MonitoringUserFilterSettings] ADD  CONSTRAINT [DF_MonitoringUserFilterSettings_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[MonScripts] ADD  DEFAULT ((0)) FOR [ScriptKind]
GO
ALTER TABLE [dbo].[MonScripts] ADD  DEFAULT ((0)) FOR [ScriptType]
GO
ALTER TABLE [dbo].[MonScripts] ADD  DEFAULT ((0)) FOR [ExitCodeSuccess]
GO
ALTER TABLE [dbo].[MonScripts] ADD  DEFAULT ((0)) FOR [ExitCodeWarning]
GO
ALTER TABLE [dbo].[MonScripts] ADD  DEFAULT ((0)) FOR [ExitCodeError]
GO
ALTER TABLE [dbo].[MonScripts] ADD  DEFAULT ((0)) FOR [IsSelfHeal]
GO
ALTER TABLE [dbo].[MonScripts] ADD  DEFAULT ((0)) FOR [SelfHealingExitCodeSuccess]
GO
ALTER TABLE [dbo].[MonScripts] ADD  DEFAULT ((0)) FOR [SelfHealingExitCodeError]
GO
ALTER TABLE [dbo].[MspArticleReferences] ADD  CONSTRAINT [DF_MspArticleReferences_ImportKind]  DEFAULT ((1)) FOR [ImportKind]
GO
ALTER TABLE [dbo].[MspCollectorInvoiceHead] ADD  CONSTRAINT [DF_MspCollectorInvoiceHead_ImportKind]  DEFAULT ((1)) FOR [ImportKind]
GO
ALTER TABLE [dbo].[MspCollectorLogs] ADD  CONSTRAINT [DF_MspCollectorLogs_ImportKind]  DEFAULT ((1)) FOR [ImportKind]
GO
ALTER TABLE [dbo].[MspCustomerReferences] ADD  CONSTRAINT [DF_MspCustomerReferences_ImportKind]  DEFAULT ((1)) FOR [ImportKind]
GO
ALTER TABLE [dbo].[NebenlagerArtikel] ADD  CONSTRAINT [DF_NebenlagerArtikel_Bestand]  DEFAULT ((0)) FOR [Bestand]
GO
ALTER TABLE [dbo].[NebenlagerArtikel] ADD  CONSTRAINT [DF_NebenlagerArtikel_Zulauf]  DEFAULT ((0)) FOR [Zulauf]
GO
ALTER TABLE [dbo].[NebenlagerArtikel] ADD  CONSTRAINT [DF_NebenlagerArtikel_Mindestbestand]  DEFAULT ((0)) FOR [Mindestbestand]
GO
ALTER TABLE [dbo].[NebenlagerArtikel] ADD  CONSTRAINT [DF_NebenlagerArtikel_Reparaturbestand]  DEFAULT ((0)) FOR [Reparaturbestand]
GO
ALTER TABLE [dbo].[NebenlagerArtikel] ADD  CONSTRAINT [DF_NebenlagerArtikel_EigenerEK]  DEFAULT ((0)) FOR [EigenerEK]
GO
ALTER TABLE [dbo].[NebenlagerArtikel] ADD  CONSTRAINT [DF_NebenlagerArtikel_EK]  DEFAULT ((0)) FOR [EK]
GO
ALTER TABLE [dbo].[NebenlagerArtikel] ADD  CONSTRAINT [DF_NebenlagerArtikel_Lagerwert]  DEFAULT ((0)) FOR [Lagerwert]
GO
ALTER TABLE [dbo].[NexusTicketViews] ADD  CONSTRAINT [DF_NexusTicketViews_IndexOf]  DEFAULT ((0)) FOR [IndexOf]
GO
ALTER TABLE [dbo].[NexusTicketViews] ADD  CONSTRAINT [DF_NexusTicketViews_IsDefault]  DEFAULT ((0)) FOR [IsDefault]
GO
ALTER TABLE [dbo].[NexusTicketViews] ADD  CONSTRAINT [DF_NexusTicketViews_IsGlobal]  DEFAULT ((0)) FOR [IsGlobal]
GO
ALTER TABLE [dbo].[NotifyContactRequest] ADD  DEFAULT (NULL) FOR [DeviceGuid]
GO
ALTER TABLE [dbo].[OnlineBankingAccountTransactions] ADD  CONSTRAINT [DF_OnlineBankingAccountTransactions_IsVisible]  DEFAULT ((1)) FOR [IsVisible]
GO
ALTER TABLE [dbo].[OnlineBankingAccountTransactions] ADD  CONSTRAINT [DF_OnlineBankingAccountTransactions_IsCompleted]  DEFAULT ((0)) FOR [IsCompleted]
GO
ALTER TABLE [dbo].[OnlineBankingAccountTransactions] ADD  CONSTRAINT [DF_OnlineBankingAccountTransactions_TransactionState]  DEFAULT ((0)) FOR [TransactionState]
GO
ALTER TABLE [dbo].[OnlineBankingConfigurationsFinApi] ADD  DEFAULT ((0)) FOR [SaveUserAccountPassword]
GO
ALTER TABLE [dbo].[OnlineBankingTransactionAssignments] ADD  CONSTRAINT [DF_OnlineBankingTransactionAssignments_IsBooked]  DEFAULT ((0)) FOR [IsBooked]
GO
ALTER TABLE [dbo].[OnlineBankingTransactionAssignments] ADD  CONSTRAINT [DF_OnlineBankingTransactionAssignments_CreditVouchersGrossAmount]  DEFAULT ((0)) FOR [CreditVouchersGrossAmount]
GO
ALTER TABLE [dbo].[OrderProcessingContractTemplates] ADD  DEFAULT ((0)) FOR [UseOwnTemplateText]
GO
ALTER TABLE [dbo].[PackageManagerInfos] ADD  DEFAULT ((0)) FOR [IsDeactivated]
GO
ALTER TABLE [dbo].[PartialCommissionOrders] ADD  CONSTRAINT [DF_PartialCommissionOrders_State]  DEFAULT ((1)) FOR [State]
GO
ALTER TABLE [dbo].[PasswordManagerGuidelines] ADD  DEFAULT ((0)) FOR [VPNAccessesEditable]
GO
ALTER TABLE [dbo].[PatchManagementDeployableJobAssignedDevice] ADD  DEFAULT ((0)) FOR [DeviceI3D]
GO
ALTER TABLE [dbo].[Personal] ADD  CONSTRAINT [DF_Personal_Ueberstunden]  DEFAULT ((0)) FOR [Ueberstunden]
GO
ALTER TABLE [dbo].[Personal] ADD  CONSTRAINT [DF_Personal_Resturlaub]  DEFAULT ((0)) FOR [Resturlaub]
GO
ALTER TABLE [dbo].[Personal] ADD  CONSTRAINT [DF_Personal_Dispatcher]  DEFAULT ((0)) FOR [Dispatcher]
GO
ALTER TABLE [dbo].[Personal] ADD  DEFAULT ((0)) FOR [Availability]
GO
ALTER TABLE [dbo].[PriceUpdateSettings] ADD  CONSTRAINT [DF_PriceUpdateSettings_MassUpdateType]  DEFAULT ((0)) FOR [MassUpdateType]
GO
ALTER TABLE [dbo].[PriceUpdateSettings] ADD  CONSTRAINT [DF_PriceUpdateSettings_IsCustomerAdvisorUpdate]  DEFAULT ((0)) FOR [IsCustomerAdvisorUpdate]
GO
ALTER TABLE [dbo].[PriceUpdateSettings] ADD  CONSTRAINT [DF_PriceUpdateSettings_IsCustomerOptionsUpdate]  DEFAULT ((0)) FOR [IsCustomerOptionsUpdate]
GO
ALTER TABLE [dbo].[PriceUpdateSettings] ADD  CONSTRAINT [DF_PriceUpdateSettings_IsMailTemplateUpdate]  DEFAULT ((0)) FOR [IsMailTemplateUpdate]
GO
ALTER TABLE [dbo].[ProductLifecycleInformations] ADD  CONSTRAINT [DF_ProductLifecycleInformations_IsFromDataImport]  DEFAULT ((0)) FOR [IsFromDataImport]
GO
ALTER TABLE [dbo].[RBChecklistVirtualObjects] ADD  DEFAULT ((0)) FOR [Status]
GO
ALTER TABLE [dbo].[RBChecklistWorkplans] ADD  DEFAULT ((1)) FOR [HasWorksteps]
GO
ALTER TABLE [dbo].[RBChecklistWorkplans] ADD  DEFAULT ((0)) FOR [DurationMinutes]
GO
ALTER TABLE [dbo].[RBScheduleJobs] ADD  CONSTRAINT [DF_RBScheduleJobs_IsDeleted]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[ReceiptPdfDocuments] ADD  DEFAULT ((0)) FOR [AllowChangeQuantity]
GO
ALTER TABLE [dbo].[ReceiptPdfDocuments] ADD  DEFAULT ((0)) FOR [AllowSelectArticles]
GO
ALTER TABLE [dbo].[ReceiptPdfDocuments] ADD  DEFAULT ((0)) FOR [AllowAcceptReceipt]
GO
ALTER TABLE [dbo].[ReceiptPdfDocuments] ADD  CONSTRAINT [DF_ReceiptPdfDocuments_WebReceiptState]  DEFAULT ((0)) FOR [WebReceiptState]
GO
ALTER TABLE [dbo].[ReceiptPdfDocuments] ADD  CONSTRAINT [DF_ReceiptPdfDocuments_ShareDocument]  DEFAULT ((0)) FOR [ShareDocument]
GO
ALTER TABLE [dbo].[ReceiptProjectLayouts] ADD  DEFAULT ((0)) FOR [IsSelectedForPdfGeneration]
GO
ALTER TABLE [dbo].[ReceiptProvisionItems] ADD  CONSTRAINT [DF_ReceiptProvisionItems_SharePercentage]  DEFAULT ((100)) FOR [SharePercentage]
GO
ALTER TABLE [dbo].[ReceiptProvisionItems] ADD  CONSTRAINT [DF_ReceiptProvisionItems_Value]  DEFAULT ('Auto') FOR [Value]
GO
ALTER TABLE [dbo].[ReceiptProvisionItems] ADD  CONSTRAINT [DF_ReceiptProvisionItems_ActualPrice]  DEFAULT ((0)) FOR [ActualPrice]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems] ADD  CONSTRAINT [DF_ReceiptProvisionSchemaItems_SharePercentage]  DEFAULT ((100)) FOR [SharePercentage]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems] ADD  CONSTRAINT [DF_ReceiptProvisionSchemaItems_Value]  DEFAULT ('Auto') FOR [Value]
GO
ALTER TABLE [dbo].[ReceiptReceivers] ADD  CONSTRAINT [DF_ReceiptReceivers_IsPOBoxActive]  DEFAULT ((0)) FOR [IsPOBoxActive]
GO
ALTER TABLE [dbo].[ReceiptReceivers] ADD  CONSTRAINT [DF_ReceiptReceivers_CountryI3D]  DEFAULT ((-1)) FOR [CountryI3D]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_NetPriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceComplete]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_TaxPriceComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceComplete]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_NetPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceFCComplete]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_TaxPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceFCComplete]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_NetPurchasePriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceComplete]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_NetPurchasePriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFCComplete]
GO
ALTER TABLE [dbo].[RechKopf] ADD  CONSTRAINT [DF_RechKopf_IsFixed]  DEFAULT ((0)) FOR [IsFixed]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_NetPriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceComplete]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_TaxPriceComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceComplete]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_NetPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPriceFCComplete]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_TaxPriceFCComplete]  DEFAULT ((0)) FOR [CalculatedTaxPriceFCComplete]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_NetPurchasePriceComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceComplete]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_NetPurchasePriceFCComplete]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFCComplete]
GO
ALTER TABLE [dbo].[RechKopfVersions] ADD  CONSTRAINT [DF_RechKopfVersions_IsFixed]  DEFAULT ((0)) FOR [IsFixed]
GO
ALTER TABLE [dbo].[RechPosVersions] ADD  DEFAULT ((0)) FOR [IsFixed]
GO
ALTER TABLE [dbo].[ReportServiceCustomerConfigurations] ADD  DEFAULT ((0)) FOR [ParentType]
GO
ALTER TABLE [dbo].[ReportServiceCustomerConfigurations] ADD  DEFAULT ((0)) FOR [SendToDefaultContactPerson]
GO
ALTER TABLE [dbo].[ReportServiceCustomerConfigurations] ADD  DEFAULT ((0)) FOR [SendToInnendienst]
GO
ALTER TABLE [dbo].[ReportServiceCustomerConfigurations] ADD  DEFAULT ((0)) FOR [SendToAussendienst]
GO
ALTER TABLE [dbo].[ReportServiceCustomerConfigurations] ADD  DEFAULT ((0)) FOR [SendToTechniker1]
GO
ALTER TABLE [dbo].[ReportServiceCustomerConfigurations] ADD  DEFAULT ((0)) FOR [SendToTechniker2]
GO
ALTER TABLE [dbo].[RiverbirdMobilePhonePushNotificationTokens] ADD  CONSTRAINT [DF_RiverbirdMobilePhonePushNotificationTokens_UserI3D]  DEFAULT ((0)) FOR [UserI3D]
GO
ALTER TABLE [dbo].[RiverbirdMobilePhonePushNotificationTokens] ADD  CONSTRAINT [DF_RiverbirdMobilePhonePushNotificationTokens_UseFor2FA]  DEFAULT ((0)) FOR [UseFor2FA]
GO
ALTER TABLE [dbo].[RMMAgentCommandQueue] ADD  DEFAULT ((0)) FOR [CommandType]
GO
ALTER TABLE [dbo].[RMMAgentCommandQueue] ADD  DEFAULT ((0)) FOR [CommandState]
GO
ALTER TABLE [dbo].[SelfCareFormFields] ADD  CONSTRAINT [DF_IsCrypted]  DEFAULT ((0)) FOR [IsCrypted]
GO
ALTER TABLE [dbo].[SelfCareFormFields] ADD  CONSTRAINT [DF_IsMandatory]  DEFAULT ((0)) FOR [IsMandatory]
GO
ALTER TABLE [dbo].[SelfCareFormFields] ADD  DEFAULT ((0)) FOR [SortItemsAlphabetically]
GO
ALTER TABLE [dbo].[SelfCareFormFields] ADD  CONSTRAINT [DF_SelfCareFormFields_UseInTicket]  DEFAULT ((0)) FOR [UseInTicket]
GO
ALTER TABLE [dbo].[SelfCareForms] ADD  CONSTRAINT [DF_IsTemplate]  DEFAULT ((0)) FOR [IsTemplate]
GO
ALTER TABLE [dbo].[SelfCareForms] ADD  CONSTRAINT [DF_SelfCareForms_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[SepaContracts] ADD  DEFAULT ((0)) FOR [UseOwnTemplateText]
GO
ALTER TABLE [dbo].[SepaContractTemplates] ADD  DEFAULT ((0)) FOR [UseOwnTemplateText]
GO
ALTER TABLE [dbo].[SharedDocuments] ADD  CONSTRAINT [DF_SharedDocuments_State]  DEFAULT ((0)) FOR [State]
GO
ALTER TABLE [dbo].[Sichbenu] ADD  DEFAULT ((0)) FOR [UseTwoFactorAuthentication]
GO
ALTER TABLE [dbo].[Sichbenu] ADD  CONSTRAINT [DF_Sichbenu_AuthentificationKind]  DEFAULT ((0)) FOR [AuthentificationKind]
GO
ALTER TABLE [dbo].[Sichrech] ADD  CONSTRAINT [DF_SIchRech_Obsolete]  DEFAULT ((0)) FOR [Obsolete]
GO
ALTER TABLE [dbo].[SimpleUrls] ADD  CONSTRAINT [DF_SimpleUrls_IsVisible]  DEFAULT ((1)) FOR [IsVisible]
GO
ALTER TABLE [dbo].[SpecialArticleToContractImports] ADD  DEFAULT ((0)) FOR [UseArticleDescriptionForPositionText]
GO
ALTER TABLE [dbo].[SpecialArticleToContractImports] ADD  CONSTRAINT [DF_SpecialArticleToContractImports_UseSpecialPriceForArticleIfAvailable]  DEFAULT ((0)) FOR [UseSpecialPriceForArticleIfAvailable]
GO
ALTER TABLE [dbo].[SpecialArticleToContractImports] ADD  CONSTRAINT [DF_SpecialArticleToContractImports_UseNegativImportPurchasPriceAndIgnoreArticlePurchasePrice]  DEFAULT ((0)) FOR [UseNegativImportPurchasPriceAndIgnoreArticlePurchasePrice]
GO
ALTER TABLE [dbo].[SupplierPdfScanConfigs] ADD  CONSTRAINT [DF_SupplierPdfScanConfigs_ReceiptKind]  DEFAULT ((0)) FOR [ReceiptKind]
GO
ALTER TABLE [dbo].[SupplierReceiptDocuments] ADD  DEFAULT ((0)) FOR [ReceiptKind]
GO
ALTER TABLE [dbo].[SurveyQuestionCategories] ADD  CONSTRAINT [DF_SurveyQuestionCategories_IsDeleted]  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[TaskChecklistSuggestions] ADD  DEFAULT ((0)) FOR [VirtualObjectI3D]
GO
ALTER TABLE [dbo].[TaskChecklistSuggestions] ADD  DEFAULT ((0)) FOR [CustomerI3D]
GO
ALTER TABLE [dbo].[TaskChecklistSuggestions] ADD  DEFAULT (getdate()) FOR [CreatedOn]
GO
ALTER TABLE [dbo].[TaskManagementAction] ADD  DEFAULT ((1)) FOR [ActionType]
GO
ALTER TABLE [dbo].[TaskManagementAction] ADD  CONSTRAINT [DF_TaskManagementAction_SendMailToSelectedHelpdeskEmployees]  DEFAULT ((0)) FOR [SendMailToSelectedHelpdeskEmployees]
GO
ALTER TABLE [dbo].[Telefonate] ADD  CONSTRAINT [DF_Telefonate_IsGroupCall]  DEFAULT ((0)) FOR [IsGroupCall]
GO
ALTER TABLE [dbo].[TicketPattern] ADD  DEFAULT ((0)) FOR [RequiredDocumentTypes]
GO
ALTER TABLE [dbo].[TicketPattern] ADD  DEFAULT ((1)) FOR [DurationInDays]
GO
ALTER TABLE [dbo].[TicketProjects] ADD  CONSTRAINT [DF_TicketProjects_Number]  DEFAULT ((0)) FOR [Number]
GO
ALTER TABLE [dbo].[TicketProjectTasks] ADD  CONSTRAINT [DF_TicketProjectTasks_IsActive]  DEFAULT ((1)) FOR [IsActive]
GO
ALTER TABLE [dbo].[Transactions] ADD  DEFAULT ((0)) FOR [TransactionNumber]
GO
ALTER TABLE [dbo].[UNTERWAREN] ADD  CONSTRAINT [DF_UNTERWAREN_NeedsCustomClearance]  DEFAULT ((0)) FOR [NeedsCustomClearance]
GO
ALTER TABLE [dbo].[UNTERWAREN] ADD  CONSTRAINT [DF_UNTERWAREN_KulanzWarengruppe]  DEFAULT ((0)) FOR [KulanzWarengruppe]
GO
ALTER TABLE [dbo].[VertragKopf] ADD  CONSTRAINT [DF_VertragKopf_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[VertragKopf] ADD  CONSTRAINT [DF_VertragKopf_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[VertragKopf] ADD  CONSTRAINT [DF_VertragKopf_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[VertragKopf] ADD  CONSTRAINT [DF_VertragKopf_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[VertragKopf] ADD  CONSTRAINT [DF_VertragKopf_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[VertragKopf] ADD  CONSTRAINT [DF_VertragKopf_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[VertragKopf] ADD  CONSTRAINT [DF_VertragKopf_IsDisplayedOnWeb]  DEFAULT ((0)) FOR [IsDisplayedOnWeb]
GO
ALTER TABLE [dbo].[VertragKopf] ADD  CONSTRAINT [DF_VertragKopf_IsHiddenInHelpdesk]  DEFAULT ((0)) FOR [IsHiddenInHelpdesk]
GO
ALTER TABLE [dbo].[VertragKopfVersions] ADD  CONSTRAINT [DF_VertragKopfVersions_NetPrice]  DEFAULT ((0)) FOR [CalculatedNetPrice]
GO
ALTER TABLE [dbo].[VertragKopfVersions] ADD  CONSTRAINT [DF_VertragKopfVersions_TaxPrice]  DEFAULT ((0)) FOR [CalculatedTaxPrice]
GO
ALTER TABLE [dbo].[VertragKopfVersions] ADD  CONSTRAINT [DF_VertragKopfVersions_NetPriceFC]  DEFAULT ((0)) FOR [CalculatedNetPriceFC]
GO
ALTER TABLE [dbo].[VertragKopfVersions] ADD  CONSTRAINT [DF_VertragKopfVersions_TaxPriceFC]  DEFAULT ((0)) FOR [CalculatedTaxPriceFC]
GO
ALTER TABLE [dbo].[VertragKopfVersions] ADD  CONSTRAINT [DF_VertragKopfVersions_NetPurchasePrice]  DEFAULT ((0)) FOR [CalculatedNetPurchasePrice]
GO
ALTER TABLE [dbo].[VertragKopfVersions] ADD  CONSTRAINT [DF_VertragKopfVersions_NetPurchasePriceFC]  DEFAULT ((0)) FOR [CalculatedNetPurchasePriceFC]
GO
ALTER TABLE [dbo].[VertragKopfVersions] ADD  CONSTRAINT [DF_VertragKopfVersions_IsDisplayedOnWeb]  DEFAULT ((0)) FOR [IsDisplayedOnWeb]
GO
ALTER TABLE [dbo].[VertragKopfVersions] ADD  CONSTRAINT [DF_VertragKopfVersions_IsHiddenInHelpdesk]  DEFAULT ((0)) FOR [IsHiddenInHelpdesk]
GO
ALTER TABLE [dbo].[VertragsArt] ADD  DEFAULT ((0)) FOR [CanChangeSendKind]
GO
ALTER TABLE [dbo].[VertragsArt] ADD  DEFAULT ((0)) FOR [SendKind]
GO
ALTER TABLE [dbo].[VertragsArt] ADD  CONSTRAINT [DF_VertragsArt_IsDisplayedOnWeb]  DEFAULT ((0)) FOR [IsDisplayedOnWeb]
GO
ALTER TABLE [dbo].[WahrscheinlichkeitsKlassifizierung] ADD  CONSTRAINT [DF_WahrscheinlichkeitsKlassifizierung_Value]  DEFAULT ((0)) FOR [Value]
GO
ALTER TABLE [dbo].[WAREN] ADD  CONSTRAINT [DF_WAREN_NeedsCustomClearance]  DEFAULT ((0)) FOR [NeedsCustomClearance]
GO
ALTER TABLE [dbo].[WAREN] ADD  CONSTRAINT [DF_WAREN_KulanzWarengruppe]  DEFAULT ((0)) FOR [KulanzWarengruppe]
GO
ALTER TABLE [dbo].[WebAccounts] ADD  CONSTRAINT [DF_WebAccounts_UseTwoFactorAuthentication]  DEFAULT ((0)) FOR [UseTwoFactorAuthentication]
GO
ALTER TABLE [dbo].[WebLinkActions] ADD  DEFAULT ((0)) FOR [Done]
GO
ALTER TABLE [dbo].[WebLinkGroups] ADD  DEFAULT (newid()) FOR [Guid]
GO
ALTER TABLE [dbo].[WebLinkGroups] ADD  DEFAULT ((0)) FOR [IsLandingPage]
GO
ALTER TABLE [dbo].[WorkflowProzess] ADD  DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[Zahkond] ADD  CONSTRAINT [DF_Zahkond_FaelligArt]  DEFAULT ((1)) FOR [FaelligArt]
GO
ALTER TABLE [dbo].[Zahkond] ADD  CONSTRAINT [DF_Zahkond_IsProformaInvoice]  DEFAULT ((0)) FOR [IsProformaInvoice]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_AccountAddressContactI3D] FOREIGN KEY([AccountAddressContactI3D])
REFERENCES [dbo].[AccountAddressContacts] ([I3D])
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_AccountAddressContactI3D]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_AccountI3D] FOREIGN KEY([AccountI3D])
REFERENCES [dbo].[Accounts] ([I3D])
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_AccountI3D]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_CampaignI3D] FOREIGN KEY([CampaignI3D])
REFERENCES [dbo].[Campaigns] ([I3D])
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_CampaignI3D]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_ChangedByI3D] FOREIGN KEY([ChangedByI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_ChangedByI3D]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_CreatedByI3D] FOREIGN KEY([CreatedByI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_CreatedByI3D]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_DirectoryI3D] FOREIGN KEY([DirectoryI3D])
REFERENCES [dbo].[Directorys] ([I3D])
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_DirectoryI3D]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_EditorI3D] FOREIGN KEY([EditorI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_EditorI3D]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_Taetigkeiten] FOREIGN KEY([OldReferenceI3D])
REFERENCES [dbo].[Taetigkeiten] ([I3D])
ON UPDATE CASCADE
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_Taetigkeiten]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivities_TodoI3D] FOREIGN KEY([TodoI3D])
REFERENCES [dbo].[ToDoListe] ([I3D])
ON UPDATE CASCADE
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [FK_AccountActivities_TodoI3D]
GO
ALTER TABLE [dbo].[AccountActivityForReceipt]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivityForReceipt_AccountActivity] FOREIGN KEY([AccountActivityI3D])
REFERENCES [dbo].[AccountActivities] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AccountActivityForReceipt] CHECK CONSTRAINT [FK_AccountActivityForReceipt_AccountActivity]
GO
ALTER TABLE [dbo].[AccountActivityProcessLogs]  WITH CHECK ADD  CONSTRAINT [FK_AccountActivityProcessLogs_ProcessActivity] FOREIGN KEY([ProcessActivityI3D])
REFERENCES [dbo].[AccountActivities] ([I3D])
GO
ALTER TABLE [dbo].[AccountActivityProcessLogs] CHECK CONSTRAINT [FK_AccountActivityProcessLogs_ProcessActivity]
GO
ALTER TABLE [dbo].[AccountAddressContacts]  WITH CHECK ADD  CONSTRAINT [FK_AccountAddressContacts_AccountAddresses] FOREIGN KEY([AccountAddressI3D])
REFERENCES [dbo].[AccountAddresses] ([I3D])
GO
ALTER TABLE [dbo].[AccountAddressContacts] CHECK CONSTRAINT [FK_AccountAddressContacts_AccountAddresses]
GO
ALTER TABLE [dbo].[AccountAddresses]  WITH CHECK ADD  CONSTRAINT [FK_AccountAddresses_Accounts] FOREIGN KEY([AccountI3D])
REFERENCES [dbo].[Accounts] ([I3D])
GO
ALTER TABLE [dbo].[AccountAddresses] CHECK CONSTRAINT [FK_AccountAddresses_Accounts]
GO
ALTER TABLE [dbo].[AccountAddresses]  WITH CHECK ADD  CONSTRAINT [FK_AccountAddresses_StateI3D_Bundesland_I3D] FOREIGN KEY([StateI3D])
REFERENCES [dbo].[Bundesland] ([I3D])
GO
ALTER TABLE [dbo].[AccountAddresses] CHECK CONSTRAINT [FK_AccountAddresses_StateI3D_Bundesland_I3D]
GO
ALTER TABLE [dbo].[AccountCustomFilterStaticItems]  WITH CHECK ADD  CONSTRAINT [FK_AccountCustomFilterStaticItems_AccountCustomFilters] FOREIGN KEY([AccountCustomFilterI3D])
REFERENCES [dbo].[AccountCustomFilters] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AccountCustomFilterStaticItems] CHECK CONSTRAINT [FK_AccountCustomFilterStaticItems_AccountCustomFilters]
GO
ALTER TABLE [dbo].[AccountLogs]  WITH CHECK ADD  CONSTRAINT [FK_AccountLogs_Accounts] FOREIGN KEY([AccountI3D])
REFERENCES [dbo].[Accounts] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AccountLogs] CHECK CONSTRAINT [FK_AccountLogs_Accounts]
GO
ALTER TABLE [dbo].[AccountOrderProcessingContracts]  WITH CHECK ADD  CONSTRAINT [FK_AccountOrderProcessingContracts_Documents] FOREIGN KEY([DocumentI3D])
REFERENCES [dbo].[Documents] ([I3D])
ON UPDATE CASCADE
GO
ALTER TABLE [dbo].[AccountOrderProcessingContracts] CHECK CONSTRAINT [FK_AccountOrderProcessingContracts_Documents]
GO
ALTER TABLE [dbo].[AccountTypeToAccounts]  WITH CHECK ADD  CONSTRAINT [FK_AccountTypeToAccounts_AccountCustomers] FOREIGN KEY([AccountCustomerI3D])
REFERENCES [dbo].[AccountCustomers] ([I3D])
GO
ALTER TABLE [dbo].[AccountTypeToAccounts] CHECK CONSTRAINT [FK_AccountTypeToAccounts_AccountCustomers]
GO
ALTER TABLE [dbo].[AccountTypeToAccounts]  WITH CHECK ADD  CONSTRAINT [FK_AccountTypeToAccounts_Accounts] FOREIGN KEY([AccountI3D])
REFERENCES [dbo].[Accounts] ([I3D])
GO
ALTER TABLE [dbo].[AccountTypeToAccounts] CHECK CONSTRAINT [FK_AccountTypeToAccounts_Accounts]
GO
ALTER TABLE [dbo].[AccountTypeToAccounts]  WITH CHECK ADD  CONSTRAINT [FK_AccountTypeToAccounts_AccountSuppliers] FOREIGN KEY([AccountSupplierI3D])
REFERENCES [dbo].[AccountSuppliers] ([I3D])
GO
ALTER TABLE [dbo].[AccountTypeToAccounts] CHECK CONSTRAINT [FK_AccountTypeToAccounts_AccountSuppliers]
GO
ALTER TABLE [dbo].[AccountTypeToAccounts]  WITH CHECK ADD  CONSTRAINT [FK_AccountTypeToAccounts_AccountTypes] FOREIGN KEY([AccountTypeI3D])
REFERENCES [dbo].[AccountTypes] ([I3D])
GO
ALTER TABLE [dbo].[AccountTypeToAccounts] CHECK CONSTRAINT [FK_AccountTypeToAccounts_AccountTypes]
GO
ALTER TABLE [dbo].[ArticleImportDistributors]  WITH NOCHECK ADD  CONSTRAINT [FK_ArticleImportDistributors_ArticleImports] FOREIGN KEY([ArticleImportI3D])
REFERENCES [dbo].[ArticleImports] ([I3D])
GO
ALTER TABLE [dbo].[ArticleImportDistributors] CHECK CONSTRAINT [FK_ArticleImportDistributors_ArticleImports]
GO
ALTER TABLE [dbo].[ArticleImportLogs]  WITH NOCHECK ADD  CONSTRAINT [FK_ArticleImportLogs_ArticleImports] FOREIGN KEY([ArticleImportI3D])
REFERENCES [dbo].[ArticleImports] ([I3D])
GO
ALTER TABLE [dbo].[ArticleImportLogs] CHECK CONSTRAINT [FK_ArticleImportLogs_ArticleImports]
GO
ALTER TABLE [dbo].[ArticleImportMappings]  WITH NOCHECK ADD  CONSTRAINT [FK_ArticleImportMappings_ArticleImports] FOREIGN KEY([ArticleImportI3D])
REFERENCES [dbo].[ArticleImports] ([I3D])
GO
ALTER TABLE [dbo].[ArticleImportMappings] CHECK CONSTRAINT [FK_ArticleImportMappings_ArticleImports]
GO
ALTER TABLE [dbo].[ArticleProductionOrderStepItems]  WITH CHECK ADD  CONSTRAINT [FK_ArticleProductionOrderStepItems_ArticleProductionOrders] FOREIGN KEY([ArticleProductionOrderI3D])
REFERENCES [dbo].[ArticleProductionOrders] ([I3D])
GO
ALTER TABLE [dbo].[ArticleProductionOrderStepItems] CHECK CONSTRAINT [FK_ArticleProductionOrderStepItems_ArticleProductionOrders]
GO
ALTER TABLE [dbo].[ArticleProductionStep]  WITH CHECK ADD  CONSTRAINT [FK_ArticleProductionStep_ARTIK] FOREIGN KEY([ArticleI3D])
REFERENCES [dbo].[ARTIK] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ArticleProductionStep] CHECK CONSTRAINT [FK_ArticleProductionStep_ARTIK]
GO
ALTER TABLE [dbo].[ArticleWorkItems]  WITH CHECK ADD  CONSTRAINT [FK_ArticleWorkItems_TicketPattern] FOREIGN KEY([TicketPatternI3D])
REFERENCES [dbo].[TicketPattern] ([I3D])
ON UPDATE CASCADE
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[ArticleWorkItems] CHECK CONSTRAINT [FK_ArticleWorkItems_TicketPattern]
GO
ALTER TABLE [dbo].[ArtificialIntelligencePromptSettings]  WITH CHECK ADD  CONSTRAINT [FK_ArtificialIntelligencePromptSettings_PromptCategoryI3D] FOREIGN KEY([PromptCategoryI3D])
REFERENCES [dbo].[ArtificialIntelligencePromptCategory] ([I3D])
GO
ALTER TABLE [dbo].[ArtificialIntelligencePromptSettings] CHECK CONSTRAINT [FK_ArtificialIntelligencePromptSettings_PromptCategoryI3D]
GO
ALTER TABLE [dbo].[AssetManagementDocumentationFile]  WITH CHECK ADD  CONSTRAINT [FK_AssetManagementDocumentationFile_AssetManagementDocumentationGroup] FOREIGN KEY([GroupI3D])
REFERENCES [dbo].[AssetManagementDocumentationGroup] ([I3D])
GO
ALTER TABLE [dbo].[AssetManagementDocumentationFile] CHECK CONSTRAINT [FK_AssetManagementDocumentationFile_AssetManagementDocumentationGroup]
GO
ALTER TABLE [dbo].[AssetManagementDocumentationGroup]  WITH CHECK ADD  CONSTRAINT [FK_AssetManagementDocumentationGroup_AssetManagementDocumentation] FOREIGN KEY([DocumentationI3D])
REFERENCES [dbo].[AssetManagementDocumentation] ([I3D])
GO
ALTER TABLE [dbo].[AssetManagementDocumentationGroup] CHECK CONSTRAINT [FK_AssetManagementDocumentationGroup_AssetManagementDocumentation]
GO
ALTER TABLE [dbo].[AssetManagementDocumentationTemplateGroup]  WITH CHECK ADD  CONSTRAINT [FK_AssetManagementDocumentationTemplateGroup_AssetManagementDocumentationTemplate] FOREIGN KEY([TemplateI3D])
REFERENCES [dbo].[AssetManagementDocumentationTemplate] ([I3D])
GO
ALTER TABLE [dbo].[AssetManagementDocumentationTemplateGroup] CHECK CONSTRAINT [FK_AssetManagementDocumentationTemplateGroup_AssetManagementDocumentationTemplate]
GO
ALTER TABLE [dbo].[AssetManagementDocumentationVersion]  WITH CHECK ADD  CONSTRAINT [FK_AssetManagementDocumentationVersion_AssetManagementDocumentation] FOREIGN KEY([DocumentationI3D])
REFERENCES [dbo].[AssetManagementDocumentation] ([I3D])
GO
ALTER TABLE [dbo].[AssetManagementDocumentationVersion] CHECK CONSTRAINT [FK_AssetManagementDocumentationVersion_AssetManagementDocumentation]
GO
ALTER TABLE [dbo].[AssetManagementLogicalDeviceHistory]  WITH CHECK ADD  CONSTRAINT [fk_AssetManLogDevHist_AssetManDev] FOREIGN KEY([DeviceI3D])
REFERENCES [dbo].[AssetManagementDevices] ([I3D])
GO
ALTER TABLE [dbo].[AssetManagementLogicalDeviceHistory] CHECK CONSTRAINT [fk_AssetManLogDevHist_AssetManDev]
GO
ALTER TABLE [dbo].[AssetManagementLogicalDeviceHistory]  WITH CHECK ADD  CONSTRAINT [fk_AssetManLogDevHist_AssetManLogDev] FOREIGN KEY([LogicalDeviceI3D])
REFERENCES [dbo].[AssetManagementLogicalDevice] ([I3D])
GO
ALTER TABLE [dbo].[AssetManagementLogicalDeviceHistory] CHECK CONSTRAINT [fk_AssetManLogDevHist_AssetManLogDev]
GO
ALTER TABLE [dbo].[Barcode]  WITH CHECK ADD  CONSTRAINT [FK_Barcode_BarcodeConditions] FOREIGN KEY([BarcodeConditionI3D])
REFERENCES [dbo].[BarcodeConditions] ([I3D])
GO
ALTER TABLE [dbo].[Barcode] CHECK CONSTRAINT [FK_Barcode_BarcodeConditions]
GO
ALTER TABLE [dbo].[BookKeepingAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BookKeepingAccounts_BookKeepingAccountSystems] FOREIGN KEY([AccountSystemI3D])
REFERENCES [dbo].[BookKeepingAccountSystems] ([I3D])
GO
ALTER TABLE [dbo].[BookKeepingAccounts] CHECK CONSTRAINT [FK_BookKeepingAccounts_BookKeepingAccountSystems]
GO
ALTER TABLE [dbo].[CampaignDecisionTemplateTexts]  WITH CHECK ADD  CONSTRAINT [FK_CampaignDecisionTemplateTexts_Campaigns] FOREIGN KEY([CampaignI3D])
REFERENCES [dbo].[Campaigns] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CampaignDecisionTemplateTexts] CHECK CONSTRAINT [FK_CampaignDecisionTemplateTexts_Campaigns]
GO
ALTER TABLE [dbo].[CampaignEmployees]  WITH CHECK ADD  CONSTRAINT [FK_CampaignEmployees_Campaigns] FOREIGN KEY([CampaignI3D])
REFERENCES [dbo].[Campaigns] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CampaignEmployees] CHECK CONSTRAINT [FK_CampaignEmployees_Campaigns]
GO
ALTER TABLE [dbo].[CampaignEmployees]  WITH CHECK ADD  CONSTRAINT [FK_CampaignEmployees_Personal] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[CampaignEmployees] CHECK CONSTRAINT [FK_CampaignEmployees_Personal]
GO
ALTER TABLE [dbo].[CampaignMarkers]  WITH CHECK ADD  CONSTRAINT [FK_CampaignMarkers_Campaign] FOREIGN KEY([CampaignI3D])
REFERENCES [dbo].[Campaigns] ([I3D])
GO
ALTER TABLE [dbo].[CampaignMarkers] CHECK CONSTRAINT [FK_CampaignMarkers_Campaign]
GO
ALTER TABLE [dbo].[CampaignMarkers]  WITH CHECK ADD  CONSTRAINT [FK_CampaignMarkers_CampaignParticipant] FOREIGN KEY([CampaignParticipantI3D])
REFERENCES [dbo].[CampaignParticipants] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CampaignMarkers] CHECK CONSTRAINT [FK_CampaignMarkers_CampaignParticipant]
GO
ALTER TABLE [dbo].[CampaignMarkers]  WITH CHECK ADD  CONSTRAINT [FK_CampaignMarkers_Personal] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[CampaignMarkers] CHECK CONSTRAINT [FK_CampaignMarkers_Personal]
GO
ALTER TABLE [dbo].[CampaignParticipantContactPerson]  WITH CHECK ADD  CONSTRAINT [FK_CampaignParticipantContactPerson_AccountAddressContacts] FOREIGN KEY([AccountAddressContactI3D])
REFERENCES [dbo].[AccountAddressContacts] ([I3D])
GO
ALTER TABLE [dbo].[CampaignParticipantContactPerson] CHECK CONSTRAINT [FK_CampaignParticipantContactPerson_AccountAddressContacts]
GO
ALTER TABLE [dbo].[CampaignParticipantContactPerson]  WITH CHECK ADD  CONSTRAINT [FK_CampaignParticipantContactPerson_CampaignParticipants] FOREIGN KEY([CampaignParticipantI3D])
REFERENCES [dbo].[CampaignParticipants] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CampaignParticipantContactPerson] CHECK CONSTRAINT [FK_CampaignParticipantContactPerson_CampaignParticipants]
GO
ALTER TABLE [dbo].[CampaignParticipantContactPerson]  WITH CHECK ADD  CONSTRAINT [FK_CampaignParticipantContactPerson_Campaigns] FOREIGN KEY([CampaignI3D])
REFERENCES [dbo].[Campaigns] ([I3D])
GO
ALTER TABLE [dbo].[CampaignParticipantContactPerson] CHECK CONSTRAINT [FK_CampaignParticipantContactPerson_Campaigns]
GO
ALTER TABLE [dbo].[CampaignParticipants]  WITH CHECK ADD  CONSTRAINT [FK_CampaignParticipants_AccountAddressContacts] FOREIGN KEY([AccountAddressContactI3D])
REFERENCES [dbo].[AccountAddressContacts] ([I3D])
GO
ALTER TABLE [dbo].[CampaignParticipants] CHECK CONSTRAINT [FK_CampaignParticipants_AccountAddressContacts]
GO
ALTER TABLE [dbo].[CampaignParticipants]  WITH CHECK ADD  CONSTRAINT [FK_CampaignParticipants_AccountAddresses] FOREIGN KEY([AccountAddressI3D])
REFERENCES [dbo].[AccountAddresses] ([I3D])
GO
ALTER TABLE [dbo].[CampaignParticipants] CHECK CONSTRAINT [FK_CampaignParticipants_AccountAddresses]
GO
ALTER TABLE [dbo].[CampaignParticipants]  WITH CHECK ADD  CONSTRAINT [FK_CampaignParticipants_Accounts] FOREIGN KEY([AccountI3D])
REFERENCES [dbo].[Accounts] ([I3D])
GO
ALTER TABLE [dbo].[CampaignParticipants] CHECK CONSTRAINT [FK_CampaignParticipants_Accounts]
GO
ALTER TABLE [dbo].[CampaignParticipants]  WITH CHECK ADD  CONSTRAINT [FK_CampaignParticipants_Campaigns] FOREIGN KEY([CampaignI3D])
REFERENCES [dbo].[Campaigns] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CampaignParticipants] CHECK CONSTRAINT [FK_CampaignParticipants_Campaigns]
GO
ALTER TABLE [dbo].[CampaignPhaseActions]  WITH CHECK ADD  CONSTRAINT [FK_CampaignPhaseActions_CampaignPhases] FOREIGN KEY([CampaignPhaseI3D])
REFERENCES [dbo].[CampaignPhases] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CampaignPhaseActions] CHECK CONSTRAINT [FK_CampaignPhaseActions_CampaignPhases]
GO
ALTER TABLE [dbo].[CampaignPhases]  WITH CHECK ADD  CONSTRAINT [FK_CampaignPhases_Campaigns] FOREIGN KEY([CampaignI3D])
REFERENCES [dbo].[Campaigns] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CampaignPhases] CHECK CONSTRAINT [FK_CampaignPhases_Campaigns]
GO
ALTER TABLE [dbo].[CampaignProcessProperties]  WITH CHECK ADD  CONSTRAINT [FK_CampaignProcessProperties_Process] FOREIGN KEY([CampaignProcessI3D])
REFERENCES [dbo].[WorkflowProzess] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CampaignProcessProperties] CHECK CONSTRAINT [FK_CampaignProcessProperties_Process]
GO
ALTER TABLE [dbo].[CentronChecklistItems]  WITH CHECK ADD  CONSTRAINT [FK_CentronChecklistItems_AdHocCreatedBy] FOREIGN KEY([AdHocCreatedBy])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[CentronChecklistItems] CHECK CONSTRAINT [FK_CentronChecklistItems_AdHocCreatedBy]
GO
ALTER TABLE [dbo].[CentronDMSDirectoryRight]  WITH CHECK ADD  CONSTRAINT [FK_DirectoryRight_Directory] FOREIGN KEY([CentronDMSDirectoryI3D])
REFERENCES [dbo].[CentronDMSDirectory] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CentronDMSDirectoryRight] CHECK CONSTRAINT [FK_DirectoryRight_Directory]
GO
ALTER TABLE [dbo].[CentronDMSDirectoryRight]  WITH CHECK ADD  CONSTRAINT [FK_DirectoryRight_Personal] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CentronDMSDirectoryRight] CHECK CONSTRAINT [FK_DirectoryRight_Personal]
GO
ALTER TABLE [dbo].[ChatMembers]  WITH CHECK ADD  CONSTRAINT [FK_ChatMembers_Chats] FOREIGN KEY([ChatI3D])
REFERENCES [dbo].[Chats] ([I3D])
GO
ALTER TABLE [dbo].[ChatMembers] CHECK CONSTRAINT [FK_ChatMembers_Chats]
GO
ALTER TABLE [dbo].[ChatMessages]  WITH CHECK ADD  CONSTRAINT [FK_ChatMessages_ChatMembers] FOREIGN KEY([MemberI3D])
REFERENCES [dbo].[ChatMembers] ([I3D])
GO
ALTER TABLE [dbo].[ChatMessages] CHECK CONSTRAINT [FK_ChatMessages_ChatMembers]
GO
ALTER TABLE [dbo].[ChatMessages]  WITH CHECK ADD  CONSTRAINT [FK_ChatMessages_Chats] FOREIGN KEY([ChatI3D])
REFERENCES [dbo].[Chats] ([I3D])
GO
ALTER TABLE [dbo].[ChatMessages] CHECK CONSTRAINT [FK_ChatMessages_Chats]
GO
ALTER TABLE [dbo].[ContactToMailTemplateRelationshipKinds]  WITH CHECK ADD  CONSTRAINT [FK_ContactToMailTemplateRelationshipKinds_AccountAddressContact] FOREIGN KEY([AccountAddressContactI3D])
REFERENCES [dbo].[AccountAddressContacts] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ContactToMailTemplateRelationshipKinds] CHECK CONSTRAINT [FK_ContactToMailTemplateRelationshipKinds_AccountAddressContact]
GO
ALTER TABLE [dbo].[ContactToMailTemplateRelationshipKinds]  WITH CHECK ADD  CONSTRAINT [FK_ContactToMailTemplateRelationshipKinds_Employee] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ContactToMailTemplateRelationshipKinds] CHECK CONSTRAINT [FK_ContactToMailTemplateRelationshipKinds_Employee]
GO
ALTER TABLE [dbo].[ContactToMailTemplateRelationshipKinds]  WITH CHECK ADD  CONSTRAINT [FK_ContactToMailTemplateRelationshipKinds_MailTemplateRelationshipKind] FOREIGN KEY([MailTemplateRelationshipKindI3D])
REFERENCES [dbo].[MailTemplateRelationshipKinds] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ContactToMailTemplateRelationshipKinds] CHECK CONSTRAINT [FK_ContactToMailTemplateRelationshipKinds_MailTemplateRelationshipKind]
GO
ALTER TABLE [dbo].[CSI_SocialMediaAction]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaAction_Personal] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaAction] CHECK CONSTRAINT [FK_SocialMediaAction_Personal]
GO
ALTER TABLE [dbo].[CSI_SocialMediaAction]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaAction_SocialMediaStream] FOREIGN KEY([SocialMediaStreamI3D])
REFERENCES [dbo].[CSI_SocialMediaStream] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaAction] CHECK CONSTRAINT [FK_SocialMediaAction_SocialMediaStream]
GO
ALTER TABLE [dbo].[CSI_SocialMediaComment]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaComment_Personal] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaComment] CHECK CONSTRAINT [FK_SocialMediaComment_Personal]
GO
ALTER TABLE [dbo].[CSI_SocialMediaComment]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaComment_SocialMediaAction] FOREIGN KEY([SocialMediaActionI3D])
REFERENCES [dbo].[CSI_SocialMediaAction] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaComment] CHECK CONSTRAINT [FK_SocialMediaComment_SocialMediaAction]
GO
ALTER TABLE [dbo].[CSI_SocialMediaComment]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaComment_SocialMediaStream] FOREIGN KEY([SocialMediaStreamI3D])
REFERENCES [dbo].[CSI_SocialMediaStream] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaComment] CHECK CONSTRAINT [FK_SocialMediaComment_SocialMediaStream]
GO
ALTER TABLE [dbo].[CSI_SocialMediaLike]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaLike_SocialMediaAction] FOREIGN KEY([SocialMediaActionI3D])
REFERENCES [dbo].[CSI_SocialMediaAction] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaLike] CHECK CONSTRAINT [FK_SocialMediaLike_SocialMediaAction]
GO
ALTER TABLE [dbo].[CSI_SocialMediaLike]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaLike_SocialMediaStream] FOREIGN KEY([SocialMediaStreamI3D])
REFERENCES [dbo].[CSI_SocialMediaStream] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaLike] CHECK CONSTRAINT [FK_SocialMediaLike_SocialMediaStream]
GO
ALTER TABLE [dbo].[CSI_SocialMediaStreamAccount]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaStreamAccount_SocialMediaStream] FOREIGN KEY([SocialMediaStreamI3D])
REFERENCES [dbo].[CSI_SocialMediaStream] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaStreamAccount] CHECK CONSTRAINT [FK_SocialMediaStreamAccount_SocialMediaStream]
GO
ALTER TABLE [dbo].[CSI_SocialMediaSubscription]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaSubscription_Personal] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaSubscription] CHECK CONSTRAINT [FK_SocialMediaSubscription_Personal]
GO
ALTER TABLE [dbo].[CSI_SocialMediaSubscription]  WITH CHECK ADD  CONSTRAINT [FK_SocialMediaSubscription_SocialMediaStream] FOREIGN KEY([SocialMediaStreamI3D])
REFERENCES [dbo].[CSI_SocialMediaStream] ([I3D])
GO
ALTER TABLE [dbo].[CSI_SocialMediaSubscription] CHECK CONSTRAINT [FK_SocialMediaSubscription_SocialMediaStream]
GO
ALTER TABLE [dbo].[CustomerSpecialArticles]  WITH CHECK ADD  CONSTRAINT [fk_CustSpecArt_ArtikelI3D] FOREIGN KEY([ArticleI3D])
REFERENCES [dbo].[ARTIK] ([I3D])
GO
ALTER TABLE [dbo].[CustomerSpecialArticles] CHECK CONSTRAINT [fk_CustSpecArt_ArtikelI3D]
GO
ALTER TABLE [dbo].[CustomerSpecialArticles]  WITH CHECK ADD  CONSTRAINT [fk_CustSpecArt_KundeI3D] FOREIGN KEY([CustomerI3D])
REFERENCES [dbo].[Kunden] ([I3D])
GO
ALTER TABLE [dbo].[CustomerSpecialArticles] CHECK CONSTRAINT [fk_CustSpecArt_KundeI3D]
GO
ALTER TABLE [dbo].[CustomerToBranches]  WITH CHECK ADD  CONSTRAINT [FK_CustomerToBranches_Filiale] FOREIGN KEY([BranchI3D])
REFERENCES [dbo].[Filiale] ([I3D])
GO
ALTER TABLE [dbo].[CustomerToBranches] CHECK CONSTRAINT [FK_CustomerToBranches_Filiale]
GO
ALTER TABLE [dbo].[DashboardContainers]  WITH CHECK ADD  CONSTRAINT [FK_DashboardContainers_Sichbenu] FOREIGN KEY([AppUserI3D])
REFERENCES [dbo].[Sichbenu] ([I3D])
GO
ALTER TABLE [dbo].[DashboardContainers] CHECK CONSTRAINT [FK_DashboardContainers_Sichbenu]
GO
ALTER TABLE [dbo].[DocumentFulltextIndex]  WITH CHECK ADD  CONSTRAINT [FK_DocumentFulltextIndex_Documents] FOREIGN KEY([DocumentI3D])
REFERENCES [dbo].[Documents] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentFulltextIndex] CHECK CONSTRAINT [FK_DocumentFulltextIndex_Documents]
GO
ALTER TABLE [dbo].[DocumentFulltextIndexStats]  WITH CHECK ADD  CONSTRAINT [FK_DocumentFulltextIndexStats_Documents] FOREIGN KEY([DocumentI3D])
REFERENCES [dbo].[Documents] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentFulltextIndexStats] CHECK CONSTRAINT [FK_DocumentFulltextIndexStats_Documents]
GO
ALTER TABLE [dbo].[DocumentMetaInformations]  WITH CHECK ADD  CONSTRAINT [FK_DocumentMetaInformations_DocumentI3D_Documents_I3D] FOREIGN KEY([DocumentI3D])
REFERENCES [dbo].[Documents] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentMetaInformations] CHECK CONSTRAINT [FK_DocumentMetaInformations_DocumentI3D_Documents_I3D]
GO
ALTER TABLE [dbo].[EmployeeRfidTokens]  WITH CHECK ADD  CONSTRAINT [FK_EmployeeRfidTokens_EmployeeI3D] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[EmployeeRfidTokens] CHECK CONSTRAINT [FK_EmployeeRfidTokens_EmployeeI3D]
GO
ALTER TABLE [dbo].[EmployeeUserSettings]  WITH CHECK ADD  CONSTRAINT [FK_PersonalSettings_Personal] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[EmployeeUserSettings] CHECK CONSTRAINT [FK_PersonalSettings_Personal]
GO
ALTER TABLE [dbo].[EstimatedProgressForHelpdesks]  WITH CHECK ADD  CONSTRAINT [FK_EstimatedProgressForHelpdesks_EmployeeI3D] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[EstimatedProgressForHelpdesks] CHECK CONSTRAINT [FK_EstimatedProgressForHelpdesks_EmployeeI3D]
GO
ALTER TABLE [dbo].[EstimatedProgressForHelpdesks]  WITH CHECK ADD  CONSTRAINT [FK_EstimatedProgressForHelpdesks_HelpdeskI3D] FOREIGN KEY([HelpdeskI3D])
REFERENCES [dbo].[hlpdsk_requests] ([I3D])
GO
ALTER TABLE [dbo].[EstimatedProgressForHelpdesks] CHECK CONSTRAINT [FK_EstimatedProgressForHelpdesks_HelpdeskI3D]
GO
ALTER TABLE [dbo].[HelpdeskTimerSpecialArticles]  WITH CHECK ADD  CONSTRAINT [fk_HelpdeskTimerSpecialArticles_ArticleI3D] FOREIGN KEY([ArticleI3D])
REFERENCES [dbo].[ARTIK] ([I3D])
GO
ALTER TABLE [dbo].[HelpdeskTimerSpecialArticles] CHECK CONSTRAINT [fk_HelpdeskTimerSpecialArticles_ArticleI3D]
GO
ALTER TABLE [dbo].[hlpdsk_timer]  WITH CHECK ADD  CONSTRAINT [FK_HelpdeskTimerBillingStates] FOREIGN KEY([BillingStateI3D])
REFERENCES [dbo].[HelpdeskTimerBillingStates] ([I3D])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[hlpdsk_timer] CHECK CONSTRAINT [FK_HelpdeskTimerBillingStates]
GO
ALTER TABLE [dbo].[hlpdsk_timer]  WITH CHECK ADD  CONSTRAINT [FK_hlpdsk_timer_ReferenceOrderITemI3D_AufPos_I3D] FOREIGN KEY([ReferenceOrderItemI3D])
REFERENCES [dbo].[AufPos] ([I3D])
ON UPDATE CASCADE
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[hlpdsk_timer] CHECK CONSTRAINT [FK_hlpdsk_timer_ReferenceOrderITemI3D_AufPos_I3D]
GO
ALTER TABLE [dbo].[Kostenart]  WITH CHECK ADD  CONSTRAINT [FK_Kostenart_Mandant] FOREIGN KEY([MandantI3D])
REFERENCES [dbo].[Mandant] ([I3D])
GO
ALTER TABLE [dbo].[Kostenart] CHECK CONSTRAINT [FK_Kostenart_Mandant]
GO
ALTER TABLE [dbo].[MachineLocations]  WITH CHECK ADD  CONSTRAINT [FK_MachineLocations_MachineLocations] FOREIGN KEY([ParentMachineLocationI3D])
REFERENCES [dbo].[MachineLocations] ([I3D])
GO
ALTER TABLE [dbo].[MachineLocations] CHECK CONSTRAINT [FK_MachineLocations_MachineLocations]
GO
ALTER TABLE [dbo].[Machines]  WITH CHECK ADD  CONSTRAINT [FK_Machine_MachineKinds] FOREIGN KEY([MachineKindI3D])
REFERENCES [dbo].[MachineKind] ([I3D])
ON UPDATE CASCADE
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[Machines] CHECK CONSTRAINT [FK_Machine_MachineKinds]
GO
ALTER TABLE [dbo].[Machines]  WITH CHECK ADD  CONSTRAINT [FK_Machine_MachineLocations] FOREIGN KEY([MachineLocationI3D])
REFERENCES [dbo].[MachineLocations] ([I3D])
ON UPDATE CASCADE
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[Machines] CHECK CONSTRAINT [FK_Machine_MachineLocations]
GO
ALTER TABLE [dbo].[MailingDataToRelationshipKind]  WITH CHECK ADD  CONSTRAINT [FK_MailingDataToRelationshipKind_MailingData] FOREIGN KEY([MailingDataI3D])
REFERENCES [dbo].[MailingDaten] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MailingDataToRelationshipKind] CHECK CONSTRAINT [FK_MailingDataToRelationshipKind_MailingData]
GO
ALTER TABLE [dbo].[MailingDataToRelationshipKind]  WITH CHECK ADD  CONSTRAINT [FK_MailingDataToRelationshipKind_MailTemplateRelationshipKind] FOREIGN KEY([MailTemplateRelationshipKindI3D])
REFERENCES [dbo].[MailTemplateRelationshipKinds] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MailingDataToRelationshipKind] CHECK CONSTRAINT [FK_MailingDataToRelationshipKind_MailTemplateRelationshipKind]
GO
ALTER TABLE [dbo].[MassUpdateTemplate]  WITH CHECK ADD  CONSTRAINT [FK_MassUpdateTemplate_ChangedByI3D] FOREIGN KEY([ChangedByI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[MassUpdateTemplate] CHECK CONSTRAINT [FK_MassUpdateTemplate_ChangedByI3D]
GO
ALTER TABLE [dbo].[MassUpdateTemplate]  WITH CHECK ADD  CONSTRAINT [FK_MassUpdateTemplate_CreatedByI3D] FOREIGN KEY([CreatedByI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[MassUpdateTemplate] CHECK CONSTRAINT [FK_MassUpdateTemplate_CreatedByI3D]
GO
ALTER TABLE [dbo].[MassUpdateTemplate]  WITH CHECK ADD  CONSTRAINT [FK_MassUpdateTemplate_ExecutedByI3D] FOREIGN KEY([ExecutedByI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[MassUpdateTemplate] CHECK CONSTRAINT [FK_MassUpdateTemplate_ExecutedByI3D]
GO
ALTER TABLE [dbo].[MassUpdateTemplate]  WITH CHECK ADD  CONSTRAINT [FK_MassUpdateTemplate_PriceUpdateSettingsI3D] FOREIGN KEY([PriceUpdateSettingsI3D])
REFERENCES [dbo].[PriceUpdateSettings] ([I3D])
GO
ALTER TABLE [dbo].[MassUpdateTemplate] CHECK CONSTRAINT [FK_MassUpdateTemplate_PriceUpdateSettingsI3D]
GO
ALTER TABLE [dbo].[MassUpdateTemplateItems]  WITH CHECK ADD  CONSTRAINT [FK_MassUpdateTemplateItems_ExecutedByI3D] FOREIGN KEY([ExecutedByI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[MassUpdateTemplateItems] CHECK CONSTRAINT [FK_MassUpdateTemplateItems_ExecutedByI3D]
GO
ALTER TABLE [dbo].[MassUpdateTemplateItems]  WITH CHECK ADD  CONSTRAINT [FK_MassUpdateTemplateItems_MassUpdateTemplateI3D] FOREIGN KEY([MassUpdateTemplateI3D])
REFERENCES [dbo].[MassUpdateTemplate] ([I3D])
GO
ALTER TABLE [dbo].[MassUpdateTemplateItems] CHECK CONSTRAINT [FK_MassUpdateTemplateItems_MassUpdateTemplateI3D]
GO
ALTER TABLE [dbo].[OnlineBankingConfigurationsFinApi]  WITH CHECK ADD  CONSTRAINT [FK_OnlineBankingConfigurationsFinApi_OnlineBankingConfigurationI3D] FOREIGN KEY([OnlineBankingConfigurationI3D])
REFERENCES [dbo].[OnlineBankingConfigurations] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OnlineBankingConfigurationsFinApi] CHECK CONSTRAINT [FK_OnlineBankingConfigurationsFinApi_OnlineBankingConfigurationI3D]
GO
ALTER TABLE [dbo].[OnlineBankingConfigurationsFinTS]  WITH CHECK ADD  CONSTRAINT [FK_OnlineBankingConfigurationsFinTS_OnlineBankingConfigurationI3D] FOREIGN KEY([OnlineBankingConfigurationI3D])
REFERENCES [dbo].[OnlineBankingConfigurations] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OnlineBankingConfigurationsFinTS] CHECK CONSTRAINT [FK_OnlineBankingConfigurationsFinTS_OnlineBankingConfigurationI3D]
GO
ALTER TABLE [dbo].[OnlineBankingConfigurationsSpreadsheet]  WITH CHECK ADD  CONSTRAINT [FK_OnlineBankingConfigurationsSpreadsheet_OnlineBankingConfigurationI3D] FOREIGN KEY([OnlineBankingConfigurationI3D])
REFERENCES [dbo].[OnlineBankingConfigurations] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OnlineBankingConfigurationsSpreadsheet] CHECK CONSTRAINT [FK_OnlineBankingConfigurationsSpreadsheet_OnlineBankingConfigurationI3D]
GO
ALTER TABLE [dbo].[Personal]  WITH CHECK ADD  CONSTRAINT [FK_Personal_SupportLevelI3D_SupportLevel_I3D] FOREIGN KEY([SupportLevelI3D])
REFERENCES [dbo].[SupportLevel] ([I3D])
ON UPDATE CASCADE
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[Personal] CHECK CONSTRAINT [FK_Personal_SupportLevelI3D_SupportLevel_I3D]
GO
ALTER TABLE [dbo].[ProductionOrderItems]  WITH CHECK ADD  CONSTRAINT [FK_ProductionOrderItems_ProductionOrders] FOREIGN KEY([ProductionOrderI3D])
REFERENCES [dbo].[ProductionOrders] ([I3D])
GO
ALTER TABLE [dbo].[ProductionOrderItems] CHECK CONSTRAINT [FK_ProductionOrderItems_ProductionOrders]
GO
ALTER TABLE [dbo].[ProductionOrders]  WITH CHECK ADD  CONSTRAINT [FK_ProductionOrders_AufKopf] FOREIGN KEY([OrderI3D])
REFERENCES [dbo].[AufKopf] ([I3D])
GO
ALTER TABLE [dbo].[ProductionOrders] CHECK CONSTRAINT [FK_ProductionOrders_AufKopf]
GO
ALTER TABLE [dbo].[ProductionOrders]  WITH CHECK ADD  CONSTRAINT [FK_ProductionOrders_AufPos] FOREIGN KEY([OrderItemI3D])
REFERENCES [dbo].[AufPos] ([I3D])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[ProductionOrders] CHECK CONSTRAINT [FK_ProductionOrders_AufPos]
GO
ALTER TABLE [dbo].[ReceiptComments]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptComments_ReceiptPdfDocumentsI3D] FOREIGN KEY([ReceiptPdfDocumentsI3D])
REFERENCES [dbo].[ReceiptPdfDocuments] ([I3D])
GO
ALTER TABLE [dbo].[ReceiptComments] CHECK CONSTRAINT [FK_ReceiptComments_ReceiptPdfDocumentsI3D]
GO
ALTER TABLE [dbo].[ReceiptItemServiceArticleClassifications]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptItemServiceArticleClassifications_ReceiptItemServiceArticleClassifications] FOREIGN KEY([ParentI3D])
REFERENCES [dbo].[ReceiptItemServiceArticleClassifications] ([I3D])
GO
ALTER TABLE [dbo].[ReceiptItemServiceArticleClassifications] CHECK CONSTRAINT [FK_ReceiptItemServiceArticleClassifications_ReceiptItemServiceArticleClassifications]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaCustomerAssignments]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptProvisionSchemaCustomerAssignments_Kunden] FOREIGN KEY([CustomerI3D])
REFERENCES [dbo].[Kunden] ([I3D])
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaCustomerAssignments] CHECK CONSTRAINT [FK_ReceiptProvisionSchemaCustomerAssignments_Kunden]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaCustomerAssignments]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptProvisionSchemaCustomerAssignments_ReceiptProvisionSchemas] FOREIGN KEY([ReceiptProvisionSchemaI3D])
REFERENCES [dbo].[ReceiptProvisionSchemas] ([I3D])
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaCustomerAssignments] CHECK CONSTRAINT [FK_ReceiptProvisionSchemaCustomerAssignments_ReceiptProvisionSchemas]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptProvisionSchemaItems_ReceiptProvisionSchemas] FOREIGN KEY([ReceiptProvisionSchemaI3D])
REFERENCES [dbo].[ReceiptProvisionSchemas] ([I3D])
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems] CHECK CONSTRAINT [FK_ReceiptProvisionSchemaItems_ReceiptProvisionSchemas]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemas]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptProvisionSchemas_NextSchemaI3D] FOREIGN KEY([NextSchemaI3D])
REFERENCES [dbo].[ReceiptProvisionSchemas] ([I3D])
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemas] CHECK CONSTRAINT [FK_ReceiptProvisionSchemas_NextSchemaI3D]
GO
ALTER TABLE [dbo].[ReceiptTemplateFolders]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptTemplateFolders_ReceiptTemplateFolders] FOREIGN KEY([ParentFolderI3D])
REFERENCES [dbo].[ReceiptTemplateFolders] ([I3D])
GO
ALTER TABLE [dbo].[ReceiptTemplateFolders] CHECK CONSTRAINT [FK_ReceiptTemplateFolders_ReceiptTemplateFolders]
GO
ALTER TABLE [dbo].[ReceiptTemplates]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptTemplates_ReceiptTemplateFolders] FOREIGN KEY([FolderI3D])
REFERENCES [dbo].[ReceiptTemplateFolders] ([I3D])
ON DELETE SET NULL
GO
ALTER TABLE [dbo].[ReceiptTemplates] CHECK CONSTRAINT [FK_ReceiptTemplates_ReceiptTemplateFolders]
GO
ALTER TABLE [dbo].[ReportData]  WITH CHECK ADD  CONSTRAINT [FK_ReportData_ReportData] FOREIGN KEY([I3D])
REFERENCES [dbo].[ReportData] ([I3D])
GO
ALTER TABLE [dbo].[ReportData] CHECK CONSTRAINT [FK_ReportData_ReportData]
GO
ALTER TABLE [dbo].[ReportDataBinSettings]  WITH CHECK ADD  CONSTRAINT [FK_ReportDataSettingsBin_ReportDataSettings] FOREIGN KEY([ReportDataSettingsI3D])
REFERENCES [dbo].[ReportDataSettings] ([I3D])
GO
ALTER TABLE [dbo].[ReportDataBinSettings] CHECK CONSTRAINT [FK_ReportDataSettingsBin_ReportDataSettings]
GO
ALTER TABLE [dbo].[ReportDataQueries]  WITH CHECK ADD  CONSTRAINT [FK_ReportDataQueries_ReportData] FOREIGN KEY([ReportDataI3D])
REFERENCES [dbo].[ReportData] ([I3D])
GO
ALTER TABLE [dbo].[ReportDataQueries] CHECK CONSTRAINT [FK_ReportDataQueries_ReportData]
GO
ALTER TABLE [dbo].[ReportGroups]  WITH CHECK ADD  CONSTRAINT [FK_ReportGroupStructure_ReportGroupStructure] FOREIGN KEY([I3D])
REFERENCES [dbo].[ReportGroups] ([I3D])
GO
ALTER TABLE [dbo].[ReportGroups] CHECK CONSTRAINT [FK_ReportGroupStructure_ReportGroupStructure]
GO
ALTER TABLE [dbo].[Rma]  WITH CHECK ADD  CONSTRAINT [FK_Rma_AccountI3D] FOREIGN KEY([AccountI3D])
REFERENCES [dbo].[Accounts] ([I3D])
GO
ALTER TABLE [dbo].[Rma] CHECK CONSTRAINT [FK_Rma_AccountI3D]
GO
ALTER TABLE [dbo].[Rma]  WITH CHECK ADD  CONSTRAINT [FK_Rma_HelpdeskI3D] FOREIGN KEY([HelpdeskI3D])
REFERENCES [dbo].[hlpdsk_requests] ([I3D])
GO
ALTER TABLE [dbo].[Rma] CHECK CONSTRAINT [FK_Rma_HelpdeskI3D]
GO
ALTER TABLE [dbo].[RmaArticle]  WITH CHECK ADD  CONSTRAINT [FK_RmaArticle_ArticleI3D] FOREIGN KEY([ArticleI3D])
REFERENCES [dbo].[ARTIK] ([I3D])
GO
ALTER TABLE [dbo].[RmaArticle] CHECK CONSTRAINT [FK_RmaArticle_ArticleI3D]
GO
ALTER TABLE [dbo].[RmaArticle]  WITH CHECK ADD  CONSTRAINT [FK_RmaArticle_RmaI3D] FOREIGN KEY([RmaI3D])
REFERENCES [dbo].[Rma] ([I3D])
GO
ALTER TABLE [dbo].[RmaArticle] CHECK CONSTRAINT [FK_RmaArticle_RmaI3D]
GO
ALTER TABLE [dbo].[RmaArticle]  WITH CHECK ADD  CONSTRAINT [FK_RmaArticle_SerialNumberI3D] FOREIGN KEY([SerialNumberI3D])
REFERENCES [dbo].[Barcode] ([I3D])
GO
ALTER TABLE [dbo].[RmaArticle] CHECK CONSTRAINT [FK_RmaArticle_SerialNumberI3D]
GO
ALTER TABLE [dbo].[RmaArticleHistory]  WITH CHECK ADD  CONSTRAINT [FK_RmaArticleHistory_RmaArticleI3D] FOREIGN KEY([RmaArticleI3D])
REFERENCES [dbo].[RmaArticle] ([I3D])
GO
ALTER TABLE [dbo].[RmaArticleHistory] CHECK CONSTRAINT [FK_RmaArticleHistory_RmaArticleI3D]
GO
ALTER TABLE [dbo].[RmaSendBack]  WITH CHECK ADD  CONSTRAINT [FK_RmaSendBack_RmaI3D] FOREIGN KEY([RmaI3D])
REFERENCES [dbo].[Rma] ([I3D])
GO
ALTER TABLE [dbo].[RmaSendBack] CHECK CONSTRAINT [FK_RmaSendBack_RmaI3D]
GO
ALTER TABLE [dbo].[RmaSendBackArticles]  WITH CHECK ADD  CONSTRAINT [FK_RmaSendBackArticles_RmaArticleI3D] FOREIGN KEY([RmaArticleI3D])
REFERENCES [dbo].[RmaArticle] ([I3D])
GO
ALTER TABLE [dbo].[RmaSendBackArticles] CHECK CONSTRAINT [FK_RmaSendBackArticles_RmaArticleI3D]
GO
ALTER TABLE [dbo].[RmaSendBackArticles]  WITH CHECK ADD  CONSTRAINT [FK_RmaSendBackArticles_RmaSendBackI3D] FOREIGN KEY([RmaSendBackI3D])
REFERENCES [dbo].[RmaSendBack] ([I3D])
GO
ALTER TABLE [dbo].[RmaSendBackArticles] CHECK CONSTRAINT [FK_RmaSendBackArticles_RmaSendBackI3D]
GO
ALTER TABLE [dbo].[SelfCareFormFields]  WITH CHECK ADD  CONSTRAINT [FK_SelfCareFormFields_SelfCareForms] FOREIGN KEY([SelfCareFormI3D])
REFERENCES [dbo].[SelfCareForms] ([I3D])
GO
ALTER TABLE [dbo].[SelfCareFormFields] CHECK CONSTRAINT [FK_SelfCareFormFields_SelfCareForms]
GO
ALTER TABLE [dbo].[SepaContracts]  WITH CHECK ADD  CONSTRAINT [FK_SepaContracts_Documents] FOREIGN KEY([DocumentI3D])
REFERENCES [dbo].[Documents] ([I3D])
ON UPDATE CASCADE
GO
ALTER TABLE [dbo].[SepaContracts] CHECK CONSTRAINT [FK_SepaContracts_Documents]
GO
ALTER TABLE [dbo].[SurveyProcessProperties]  WITH CHECK ADD  CONSTRAINT [FK_SurveyProcessProperties_Surveys] FOREIGN KEY([SurveyI3D])
REFERENCES [dbo].[WorkflowProzess] ([I3D])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[SurveyProcessProperties] CHECK CONSTRAINT [FK_SurveyProcessProperties_Surveys]
GO
ALTER TABLE [dbo].[Termine]  WITH CHECK ADD  CONSTRAINT [FK_Termine_TerminArt] FOREIGN KEY([TerminArt])
REFERENCES [dbo].[TerminArt] ([I3D])
GO
ALTER TABLE [dbo].[Termine] CHECK CONSTRAINT [FK_Termine_TerminArt]
GO
ALTER TABLE [dbo].[TicketProjectLogs]  WITH CHECK ADD  CONSTRAINT [FK_TicketProjectLogs_TicketProjects] FOREIGN KEY([TicketProjectI3D])
REFERENCES [dbo].[TicketProjects] ([I3D])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[TicketProjectLogs] CHECK CONSTRAINT [FK_TicketProjectLogs_TicketProjects]
GO
ALTER TABLE [dbo].[ToDoListe]  WITH CHECK ADD  CONSTRAINT [FK_ToDoListe_AccountI3D_Accounts_I3D] FOREIGN KEY([AccountI3D])
REFERENCES [dbo].[Accounts] ([I3D])
GO
ALTER TABLE [dbo].[ToDoListe] CHECK CONSTRAINT [FK_ToDoListe_AccountI3D_Accounts_I3D]
GO
ALTER TABLE [dbo].[VideoPortalAssignment]  WITH CHECK ADD  CONSTRAINT [FK_VideoPortalAssignment_AssignedByEmployeeI3D] FOREIGN KEY([AssignedByEmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[VideoPortalAssignment] CHECK CONSTRAINT [FK_VideoPortalAssignment_AssignedByEmployeeI3D]
GO
ALTER TABLE [dbo].[VideoPortalAssignment]  WITH CHECK ADD  CONSTRAINT [FK_VideoPortalAssignment_ChangedByEmployeeI3D] FOREIGN KEY([ChangedByEmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[VideoPortalAssignment] CHECK CONSTRAINT [FK_VideoPortalAssignment_ChangedByEmployeeI3D]
GO
ALTER TABLE [dbo].[VideoPortalAssignment]  WITH CHECK ADD  CONSTRAINT [FK_VideoPortalAssignment_EmployeeI3D] FOREIGN KEY([EmployeeI3D])
REFERENCES [dbo].[Personal] ([I3D])
GO
ALTER TABLE [dbo].[VideoPortalAssignment] CHECK CONSTRAINT [FK_VideoPortalAssignment_EmployeeI3D]
GO
ALTER TABLE [dbo].[AccountActivities]  WITH CHECK ADD  CONSTRAINT [CK_AccountActivities_Rating] CHECK  (([Rating]=(5) OR [Rating]=(4) OR [Rating]=(3) OR [Rating]=(2) OR [Rating]=(1) OR [Rating]=(0)))
GO
ALTER TABLE [dbo].[AccountActivities] CHECK CONSTRAINT [CK_AccountActivities_Rating]
GO
ALTER TABLE [dbo].[ReceiptProvisionEmployeeGoals]  WITH CHECK ADD  CONSTRAINT [Check_ReceiptProvisionEmployeeGoals_Month] CHECK  (([Month]>=(1) AND [Month]<=(12)))
GO
ALTER TABLE [dbo].[ReceiptProvisionEmployeeGoals] CHECK CONSTRAINT [Check_ReceiptProvisionEmployeeGoals_Month]
GO
ALTER TABLE [dbo].[ReceiptProvisionEmployeeGoals]  WITH CHECK ADD  CONSTRAINT [Check_ReceiptProvisionEmployeeGoals_Year] CHECK  (([Year]>(0) AND [Year]<=(9999)))
GO
ALTER TABLE [dbo].[ReceiptProvisionEmployeeGoals] CHECK CONSTRAINT [Check_ReceiptProvisionEmployeeGoals_Year]
GO
ALTER TABLE [dbo].[ReceiptProvisionItems]  WITH CHECK ADD  CONSTRAINT [Check_ReceiptProvisionItems_Receiver] CHECK  (([Receiver]='ServiceArticleEmployee' OR [Receiver]='ReceiptAdviser2' OR [Receiver]='ReceiptAdviser1' OR [Receiver]='ReceiptEditor' OR [Receiver]='CustomerAdviser6' OR [Receiver]='CustomerAdviser5' OR [Receiver]='CustomerAdviser4' OR [Receiver]='CustomerAdviser3' OR [Receiver]='CustomerAdviser2' OR [Receiver]='CustomerAdviser1' OR [Receiver]='FixedEmployee'))
GO
ALTER TABLE [dbo].[ReceiptProvisionItems] CHECK CONSTRAINT [Check_ReceiptProvisionItems_Receiver]
GO
ALTER TABLE [dbo].[ReceiptProvisionItems]  WITH CHECK ADD  CONSTRAINT [Check_ReceiptProvisionItems_Source] CHECK  (([Source]='OwnServiceArticlesOnly' OR [Source]='MaterialGroups' OR [Source]='ProductsOnly' OR [Source]='ServiceOnly' OR [Source]='All'))
GO
ALTER TABLE [dbo].[ReceiptProvisionItems] CHECK CONSTRAINT [Check_ReceiptProvisionItems_Source]
GO
ALTER TABLE [dbo].[ReceiptProvisionItems]  WITH CHECK ADD  CONSTRAINT [Check_ReceiptProvisionItems_Value] CHECK  (([Value]='Earnings' OR [Value]='Sales' OR [Value]='Auto'))
GO
ALTER TABLE [dbo].[ReceiptProvisionItems] CHECK CONSTRAINT [Check_ReceiptProvisionItems_Value]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems]  WITH CHECK ADD  CONSTRAINT [Check_ReceiptProvisionSchemaItems_Receiver] CHECK  (([Receiver]='ServiceArticleEmployee' OR [Receiver]='ReceiptAdviser2' OR [Receiver]='ReceiptAdviser1' OR [Receiver]='ReceiptEditor' OR [Receiver]='CustomerAdviser6' OR [Receiver]='CustomerAdviser5' OR [Receiver]='CustomerAdviser4' OR [Receiver]='CustomerAdviser3' OR [Receiver]='CustomerAdviser2' OR [Receiver]='CustomerAdviser1' OR [Receiver]='FixedEmployee'))
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems] CHECK CONSTRAINT [Check_ReceiptProvisionSchemaItems_Receiver]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems]  WITH CHECK ADD  CONSTRAINT [Check_ReceiptProvisionSchemaItems_Source] CHECK  (([Source]='OwnServiceArticlesOnly' OR [Source]='MaterialGroups' OR [Source]='ProductsOnly' OR [Source]='ServiceOnly' OR [Source]='All'))
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems] CHECK CONSTRAINT [Check_ReceiptProvisionSchemaItems_Source]
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems]  WITH CHECK ADD  CONSTRAINT [Check_Value] CHECK  (([Value]='Earnings' OR [Value]='Sales' OR [Value]='Auto'))
GO
ALTER TABLE [dbo].[ReceiptProvisionSchemaItems] CHECK CONSTRAINT [Check_Value]
GO
ALTER TABLE [dbo].[ReportPrintOptions]  WITH CHECK ADD  CONSTRAINT [CK_ParentReference] CHECK  (([ParentI3D] IS NULL AND [ParentObjectKind] IS NULL OR [ParentI3D] IS NOT NULL AND [ParentObjectKind] IS NOT NULL))
GO
ALTER TABLE [dbo].[ReportPrintOptions] CHECK CONSTRAINT [CK_ParentReference]
GO
/****** Object:  StoredProcedure [dbo].[proc_ContingetCurrentState]    Script Date: 11.11.2025 11:20:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[proc_ContingetCurrentState] 
	(@ParContractID int)  
AS 
BEGIN 
SET NOCOUNT ON; 
DECLARE 
	@CurContract cursor, 
	@ContractID int, 
	@Booked float, 
	@Used float, 
	@Rest float, 
	@Sm   float, 
	@DateFrom Datetime, 
	@DateTo Datetime, 
	@BookedFrom Datetime, 
	@BookedTo datetime, 
	@RestTogo int, 
	@ContingentValue float, 
	@ContingentRestValue float, 
	@KontngentKind int, 
	@sSql varchar(4000) 

	SET @sSql = ' SELECT  rz.VertragI3D, rz.GebuchtVon, rz.GebuchtBis,  rz.KontingentWert, rz.KontingentRestMitnehmen, rz.KontingentRestWert 
						FROM VertragRechKopfZuordnung rz  
						INNER JOIN VertragKopf vk ON vk.I3D = rz.VertragI3D AND vk.KontingentVertrag =1 
						WHERE rz.Status = 1 
							AND ISNULL(rz.Zwischenrechnung,0) in (0,2,3) 
							AND  ISNULL(rz.Nachberechnung,0)=0 ' 
	IF (@ParContractID > 0) SET @sSql = @sSql + ' AND rz.VertragI3D = ' + LTRIM(STR(@ParContractID)) 
	SET @sSQL = @sSQL + 
						' AND rz.GebuchtBis +1 > GETDATE() AND rz.GebuchtVon < GETDATE() 
					 UNION ' +  
					@sSQL +  
					' AND rz.GebuchtBis < GETDATE() 
						AND rz.I3D = (select max(i3d) from VertragRechKopfZuordnung v where v.VertragI3D = rz.VertragI3D and v.Status = 1 
											and ISNULL(v.Zwischenrechnung,0) in (0,2,3) and ISNULL(v.Nachberechnung,0)=0) 
					 UNION ' + 
					 @sSQL + 
					' AND rz.GebuchtVon > GETDATE() 
						AND rz.I3D = ( select min(i3d) from VertragRechKopfZuordnung v 
											where v.VertragI3D = rz.VertragI3D   and v.Status = 1 and ISNULL(v.Zwischenrechnung,0) in (0,2,3) and ISNULL(v.Nachberechnung,0)=0)' 

	DECLARE	@Contingent TABLE (ContractID int, 
										 BookedFrom Datetime, 
										 BookedTo Datetime, 
										 RestTogo int, 
										 ContingentValue float, 
										 ContingentRestValue float) 

	DECLARE @Ret TABLE (ContractID int, 
								Booked float, 
								Used float) 

	INSERT INTO @Contingent EXEC(@sSQL) 

	SET  @CurContract = CURSOR FAST_FORWARD FOR 
									SELECT I3D, KontingentArt 
									FROM VertragKopf 
									WHERE KontingentVertrag = 1  
									AND I3D >= @ParContractID  
									AND I3D <= CASE WHEN @ParContractID > 0 THEN  @ParContractID ELSE 2147483647 END  
	OPEN @CurContract 
	FETCH FROM  @CurContract INTO @ContractID, @KontngentKind 
	WHILE @@FETCH_STATUS = 0 BEGIN 
		SET @Booked = 0  
		SET @Used = 0 
		SET	@Rest = 0 
		SET @ContingentValue = -2 
		SET @ContingentRestValue = 0 
		SET	@BookedFrom = 0 
		SET	@BookedTo	= 99999  
		SET @Sm = 0 
		SELECT  @ContingentValue = ContingentValue, 
					@RestTogo = RestTogo, 
					@ContingentRestValue = ContingentRestValue, 
					@BookedFrom = BookedFrom, 
					@BookedTo	= BookedTo 
					FROM	@Contingent	
			WHERE ContractID = @ContractID 
		IF  @ContingentValue >-1 BEGIN -- wurden schon abgerechnet  
			IF (@BookedTo + 1 > GetDate() OR @RestTogo = 1) 
			SET @Booked = ISNULL(@ContingentValue,0) + ISNULL(@ContingentRestValue,0) 
			IF @BookedTo +1 < GETDATE() BEGIN  
				IF @RestTogo = 0 SET @BookedFrom = @BookedTo  
				SET	@BookedTo	= 99999 
			END  
			IF @RestTogo = 1 SET @BookedTo	= 99999  
		END 

		SET @Sm = 0 
		SET @Sm = (SELECT SUM(vr.KontingentWert) sm 
						FROM  VertragRechKopfZuordnung vr 
						WHERE vr.NachBerechnung = 1 
							AND vr.VertragI3D = @ContractID 
							AND vr.Status = 1 
							AND vr.GebuchtVon BETWEEN  @BookedFrom AND  @BookedTo	) 
		SET @Booked = @Booked + ISNULL(@Sm,0) 
		SET @Used = (SELECT SUM(CASE WHEN vkp.KontingentArt =1 THEN VKKalk ELSE 1 END * vkp.AusgleichStk * CASE WHEN AnlageArt >4 THEN -1 ELSE 1 END) smBalance	
							FROM VertragKontingentAnlagePositionen vkp 
						  	WHERE vkp.VertragKopfI3D = @ContractID 
								AND vkp.AnlageArt > 2 
								AND vkp.Status > 0 
								AND vkp.datum  BETWEEN  @BookedFrom AND  @BookedTo ) 
		INSERT INTO @Ret VALUES(@ContractID, ISNULL(@Booked,0), ISNULL(@Used,0) ) 
		FETCH FROM  @CurContract INTO @ContractID, @KontngentKind 
	END 
	DEALLOCATE @CurContract 
	SELECT * FROM @Ret 
END

GO
/****** Object:  StoredProcedure [dbo].[procAssetManagementDeviceCrawlerOverview]    Script Date: 11.11.2025 11:20:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE PROCEDURE [dbo].[procAssetManagementDeviceCrawlerOverview]
	        @CustomerI3D INT = 0,
	        @SystemCrawlerNeedToInstall BIT = 1,
	        @DeviceName nvarchar(256) = '',
	        @IsPaging bit = 1,
	        @Skip INT = 0,
	        @Take INT = 100000,
	        @SortDescending BIT = 1,
	        @SortOrderColumn nvarchar(256) = 'I3D'
        AS
        BEGIN

	        DECLARE @SystemCrawlerNeedToInstallCheck0 BIT
	        DECLARE @SystemCrawlerNeedToInstallCheck1 BIT = 1

	        DECLARE @DeviceNameCheck0 BIT
	        DECLARE @DeviceNameCheck1 BIT = 1

	        DECLARE @TotalRecordCount INT = 0

	        -- FOR Customer I3D
	        IF(@SystemCrawlerNeedToInstall = 0 OR @SystemCrawlerNeedToInstall IS NULL) BEGIN SET @SystemCrawlerNeedToInstallCheck0 = 1 END 
	        ELSE BEGIN SET @SystemCrawlerNeedToInstallCheck0 = 0 END

	        -- FOR DeviceName
	        IF(@DeviceName = '') BEGIN SET @DeviceNameCheck0 = 1 END 
	        ELSE BEGIN SET @DeviceNameCheck0 = 0 END

	        SELECT @TotalRecordCount = Count(1) FROM AssetManagementDevices Dev INNER JOIN Kunden K ON K.I3D = Dev.KundenI3D WHERE K.I3D=@CustomerI3D AND
			        CASE WHEN @SystemCrawlerNeedToInstallCheck0=1 THEN 
			        CASE WHEN Dev.SystemCrawlerNeedToInstall = @SystemCrawlerNeedToInstall OR Dev.SystemCrawlerNeedToInstall IS NULL THEN 1 ELSE 0 END 
			        ELSE CASE WHEN Dev.SystemCrawlerNeedToInstall = @SystemCrawlerNeedToInstall THEN 1 ELSE 0 END END=1
			        AND
			        CASE WHEN @DeviceNameCheck0=1 THEN CASE WHEN @DeviceNameCheck1=1 THEN 1 ELSE 0 END ELSE CASE WHEN lower(Dev.ShortName) like ('%'+@DeviceName+'%') THEN 1 ELSE 0 END END=1 -- FOR DeviceName

			SELECT * INTO #tempAssetManagementServiceConnectorLogs
			FROM AssetManagementServiceConnectorLogs

	        IF(@IsPaging = 1)
	        BEGIN
		        SELECT Dev.I3D, Dev.KundenI3D AS CustomerI3D, K.Name AS CustomerName, Dev.ShortName, Dev.DeviceClass, Dev.IsOnline, Dev.SystemCrawlerVersion, Dev.SystemCrawlerStatus, Dev.SystemCrawlerNeedToInstall, 
		        Dev.SystemCrawlerNeedToUnInstall, Dev.IsSystemCrawlerUnInstalling,  CASE WHEN @SystemCrawlerNeedToInstall = 0 THEN 0 ELSE
			        CASE (SELECT TOP 1 LOWER(LogType) FROM (SELECT Dense_Rank() OVER (PARTITION BY LogType ORDER BY sc.LogDate DESC) AS Row, sc.* FROM #tempAssetManagementServiceConnectorLogs sc
				        WHERE LogDate >= GetDate() - 20 AND (LOWER(LogType) = 'error' OR LOWER(LogType) = 'ok') AND DeviceI3D = Dev.I3D) AS HardDriveCheckResult WHERE Row = 1 
				        ORDER BY LogDate DESC) WHEN 'error' THEN 1 ELSE 0 END END AS ErrorExists, Dev.IsSystemCralwerInstalled, Dev.IsSystemCrawlerInstalling, @TotalRecordCount AS TotalRecordCount
		        FROM AssetManagementDevices Dev INNER JOIN Kunden K ON K.I3D = Dev.KundenI3D WHERE K.I3D=@CustomerI3D AND
			        CASE WHEN @SystemCrawlerNeedToInstallCheck0=1 THEN CASE WHEN Dev.SystemCrawlerNeedToInstall = @SystemCrawlerNeedToInstall OR Dev.SystemCrawlerNeedToInstall IS NULL THEN 1 ELSE 0 END
					 ELSE CASE WHEN Dev.SystemCrawlerNeedToInstall = @SystemCrawlerNeedToInstall THEN 1 ELSE 0 END END=1
			        AND
			        CASE WHEN @DeviceNameCheck0=1 THEN CASE WHEN @DeviceNameCheck1=1 THEN 1 ELSE 0 END ELSE CASE WHEN lower(Dev.ShortName) like ('%'+@DeviceName+'%') THEN 1 ELSE 0 END END=1 -- FOR DeviceName
			        ORDER BY 
						CASE WHEN @SortDescending = 1 THEN 
							CASE @SortOrderColumn
								WHEN 'DeviceName' THEN Dev.ShortName
								WHEN 'DeviceClass' THEN Dev.DeviceClass
								WHEN 'SystemCrawlerVersion' THEN Dev.SystemCrawlerVersion
				        END END DESC,
						CASE WHEN @SortDescending = 1 THEN 
							CASE @SortOrderColumn WHEN 'I3D' THEN Dev.I3D
						END END DESC,
				        CASE WHEN @SortDescending = 0 THEN 
							CASE @SortOrderColumn 
								WHEN 'DeviceName' THEN Dev.ShortName
								WHEN 'DeviceClass' THEN Dev.DeviceClass
								WHEN 'SystemCrawlerVersion' THEN Dev.SystemCrawlerVersion
						END END,
				        CASE WHEN @SortDescending = 0 THEN 
							CASE @SortOrderColumn WHEN 'I3D' THEN Dev.I3D
				        END END
				        OFFSET @Skip ROWS
				        FETCH NEXT @Take ROWS ONLY
	        END
	        ELSE
	        BEGIN
		        SELECT Dev.I3D, Dev.KundenI3D AS CustomerI3D, K.Name AS CustomerName, Dev.ShortName, Dev.DeviceClass, Dev.IsOnline, Dev.SystemCrawlerVersion, Dev.SystemCrawlerStatus, Dev.SystemCrawlerNeedToInstall, 
		        Dev.SystemCrawlerNeedToUnInstall, Dev.IsSystemCrawlerUnInstalling,  CASE WHEN @SystemCrawlerNeedToInstall = 0 THEN 0 ELSE
			        CASE (SELECT TOP 1 LOWER(LogType) FROM (SELECT Dense_Rank() OVER (PARTITION BY LogType ORDER BY sc.LogDate DESC) AS Row, sc.* FROM #tempAssetManagementServiceConnectorLogs sc
				        WHERE LogDate >= GetDate() - 20 AND (LOWER(LogType) = 'error' OR LOWER(LogType) = 'ok') AND DeviceI3D = Dev.I3D) AS HardDriveCheckResult WHERE Row = 1 
				        ORDER BY LogDate DESC) WHEN 'error' THEN 1 ELSE 0 END END AS ErrorExists, Dev.IsSystemCralwerInstalled, Dev.IsSystemCrawlerInstalling, @TotalRecordCount AS TotalRecordCount
		        FROM AssetManagementDevices Dev INNER JOIN Kunden K ON K.I3D = Dev.KundenI3D WHERE K.I3D=@CustomerI3D AND
			        CASE WHEN @SystemCrawlerNeedToInstallCheck0=1 THEN CASE WHEN Dev.SystemCrawlerNeedToInstall = @SystemCrawlerNeedToInstall OR Dev.SystemCrawlerNeedToInstall IS NULL THEN 1 ELSE 0 END ELSE CASE WHEN Dev.SystemCrawlerNeedToInstall = @SystemCrawlerNeedToInstall THEN 1 ELSE 0 END END=1
			        AND
			        CASE WHEN @DeviceNameCheck0=1 THEN CASE WHEN @DeviceNameCheck1=1 THEN 1 ELSE 0 END ELSE CASE WHEN lower(Dev.ShortName) like ('%'+@DeviceName+'%') THEN 1 ELSE 0 END END=1 -- FOR DeviceName
			        ORDER BY 
						CASE WHEN @SortDescending = 1 THEN 
							CASE @SortOrderColumn
								WHEN 'DeviceName' THEN Dev.ShortName
								WHEN 'DeviceClass' THEN Dev.DeviceClass
								WHEN 'SystemCrawlerVersion' THEN Dev.SystemCrawlerVersion
				        END END DESC,
						CASE WHEN @SortDescending = 1 THEN 
							CASE @SortOrderColumn WHEN 'I3D' THEN Dev.I3D
						END END DESC,
				        CASE WHEN @SortDescending = 0 THEN 
							CASE @SortOrderColumn
								WHEN 'DeviceName' THEN Dev.ShortName
								WHEN 'DeviceClass' THEN Dev.DeviceClass
								WHEN 'SystemCrawlerVersion' THEN Dev.SystemCrawlerVersion
						END END,
				        CASE WHEN @SortDescending = 0 THEN 
							CASE @SortOrderColumn WHEN 'I3D' THEN Dev.I3D
				        END END
	        END
        END
       
GO
/****** Object:  StoredProcedure [dbo].[procCheckDuplicateConfigureValue]    Script Date: 11.11.2025 11:20:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procCheckDuplicateConfigureValue]
	@CheckDuplicateValue  nvarchar(max),
	@CheckType int,
	@DeviceId int,
	@SqlServerName nvarchar(100)=null,
	@SQLServerInstance nvarchar(100)=null,
	@LogType nvarchar(50)=null,
	@SystemName nvarchar(50)=null,
	@JobName nvarchar(50)=null,
	@BackupTypeI3D int =0,
	@VmMachineI3D int,
	@VmHostI3D int,
	@VCenterHostOrIp nvarchar(40)=null
As
SET NOCOUNT ON
BEGIN
	-- Harddrive Check
	IF (@CheckType = 1)
		BEGIN
			SELECT I3D FROM AssetManagementHardDriveChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(Drive) = LOWER(@CheckDuplicateValue)			
		END
	
	-- WindowsService Check
	ELSE IF (@CheckType = 3)
		BEGIN
			SELECT I3D FROM AssetManagementWindowsServiceChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(NameOfServices) = LOWER(@CheckDuplicateValue)
		END

	-- Ping Check
	ELSE IF (@CheckType = 5)
		BEGIN
			SELECT I3D FROM AssetManagementPingChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType)
			AND LOWER(IPOrComputerName) = LOWER(@CheckDuplicateValue)
		End

	-- SnmpBackup Check
	ELSE IF (@CheckType = 6)
		BEGIN
			SELECT I3D FROM AssetManagementSNMPOIDChecks WHERE SNMPCheckI3D IN 
				(SELECT I3D FROM AssetManagementSNMPBackupChecks WHERE I3D IN 
				(SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) AND LOWER(JobName) = LOWER(@JobName))
				AND LOWER(OID)=LOWER(@CheckDuplicateValue) AND SnmpType = 0
		END

	-- Sql Check
	ELSE IF (@CheckType = 7)
		BEGIN
			SELECT I3D FROM AssetManagementSQLServerChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(SqlServerName) = LOWER(@SqlServerName) AND LOWER(SqlInstanceName) = @SQLServerInstance
			AND LOWER(SqlDatabaseName) = LOWER(@CheckDuplicateValue) 			
		END

	-- EventLog Check
	ELSE IF (@CheckType = 8)
		BEGIN
			SELECT I3D FROM AssetManagementEventLogChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(LogType) = LOWER(@LogType) AND LOWER(ProviderName) = LOWER(@CheckDuplicateValue)			
		END

	-- PowerShell Check
	ELSE IF (@CheckType = 9)
		BEGIN
			SELECT I3D FROM AssetManagementPowerShellChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(PowerShellScript) = LOWER(@CheckDuplicateValue)
		END

	-- VendorWarranty Check
	ELSE IF (@CheckType = 10)
		BEGIN
			SELECT I3D FROM AssetManagementVendorWarrantyChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations where DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND DeviceI3D=@CheckDuplicateValue			
		END

	-- BackupStatus Check
	ELSE IF (@CheckType = 12)
		BEGIN
			SELECT I3D FROM AssetManagementBackupStatusChecks
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND BackupTypeI3D = @BackupTypeI3D AND LOWER(ServerName) = LOWER(@SqlServerName) AND LOWER(DatabaseName) = LOWER(@CheckDuplicateValue) AND
			LOWER(BackupJobId) = LOWER(@JobName)			
		END

	-- Http Check
	ELSE IF (@CheckType = 13)
		BEGIN
			SELECT I3D FROM AssetManagementHttpChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(WebsiteUrl) = LOWER(@CheckDuplicateValue)			
		END

	-- Snmp Check
	ELSE IF (@CheckType = 14)
		BEGIN
			SELECT MibCheck.I3D FROM AssetManagementSnmpMibChecks MibCheck INNER JOIN AssetManagementSnmpMibOidDetails MibOid ON MibOid.I3D = MibCheck.SnmpOidI3D
			WHERE MibCheck.I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(MibCheck.SystemName) = LOWER(@SystemName) AND LOWER(MibOid.OidValue) = LOWER(@CheckDuplicateValue)
		END

	-- SslCertificate Check
	ELSE IF (@CheckType = 15)
		BEGIN
			SELECT I3D FROM AssetManagementSslCertificateChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(CertificateName) = LOWER(@CheckDuplicateValue)			
		END

	-- Performance Check
	ELSE IF (@CheckType = 16)
		BEGIN
			SELECT I3D FROM AssetManagementPerformanceChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(ServiceName) = LOWER(@CheckDuplicateValue)			
		END

	-- Smart Check
	ELSE IF (@CheckType = 18)
		BEGIN
			SELECT I3D FROM AssetManagementSmartChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(PhysicalDriveName) = LOWER(@CheckDuplicateValue) AND PhysicalDriveI3D = @BackupTypeI3D	
		END

	-- FileSize Check
	ELSE IF (@CheckType = 19)
		BEGIN
			SELECT I3D FROM AssetManagementFileSizeChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER([FileName]) = LOWER(@CheckDuplicateValue)			
		END

	-- VmWare Check
	ELSE IF (@CheckType = 20)
		BEGIN
			DECLARE @ParameterDefinition NVARCHAR(max)
			SET @ParameterDefinition='SELECT I3D FROM AssetManagementVmWareChecks 
									  WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId ='+ Convert(Varchar(10),@DeviceId)+' AND CheckType ='+ Convert(Varchar(10),@CheckType)+') AND CategoryTypeI3D ='+
									   Convert(Varchar(10),@CheckDuplicateValue)
			IF(@VmHostI3D IS NOT NULL AND @VmHostI3D>0)
				BEGIN
					SET @ParameterDefinition=@ParameterDefinition+ ' AND VmHostI3D='+Convert(Varchar(10),@VmHostI3D)
				END
			IF(@VmMachineI3D IS NOT NULL AND @VmMachineI3D>0)
				BEGIN
					SET @ParameterDefinition=@ParameterDefinition+ ' AND VmHostI3D='+Convert(Varchar(10),@VmHostI3D)+' AND VmMachineI3D='+Convert(Varchar(10),@VmMachineI3D)
				END
			IF(@VCenterHostOrIp IS NOT NULL AND @VCenterHostOrIp<>'')
				BEGIN
					SET @ParameterDefinition=@ParameterDefinition+ ' AND VCenterIpOrHost= '+ '''' + @VCenterHostOrIp + ''''
				END
			EXEC sp_executeSQL @ParameterDefinition
		END

	-- HyperV Check
	ELSE IF (@CheckType = 21)
		BEGIN
			SELECT I3D FROM AssetManagementHyperVChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND CategoryTypeI3D = @CheckDuplicateValue AND ComputerSystemI3D = @BackupTypeI3D		
		END

	-- Application Check
	ELSE IF (@CheckType = 22)
		BEGIN
			SELECT I3D FROM AssetManagementApplicationChecks 
			WHERE I3D IN (SELECT CheckId FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceId AND CheckType = @CheckType) 
			AND LOWER(ApplicationName) = LOWER(@CheckDuplicateValue)			
		END
END
       
GO
/****** Object:  StoredProcedure [dbo].[procDeleteAssetManagementSnmpMibDetails]    Script Date: 11.11.2025 11:20:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procDeleteAssetManagementSnmpMibDetails] 
	@SnmpMibDetailI3D INT,
	@SnmpMibOidI3D INT
AS
BEGIN
SET NOCOUNT ON
DECLARE @SnmpMibCheckCount INT = 0
DECLARE @MonitoringCheckTemplateMapCount INT = 0
DECLARE @DeleteProcess INT = 0

IF(@SnmpMibOidI3D > 0)
	BEGIN
		SELECT @SnmpMibCheckCount = Count(1) FROM dbo.AssetManagementSnmpMibChecks WHERE SnmpOidI3D = @SnmpMibOidI3D
		IF(@SnmpMibCheckCount > 0)
			BEGIN
				SET @DeleteProcess = 1
			END
		IF(@DeleteProcess = 0)
			BEGIN
				SELECT @MonitoringCheckTemplateMapCount = Count(1) FROM dbo.MonitoringCheckTemplateMaps 
														WHERE CheckI3D = 14 AND CheckKeyName = 'SnmpOidI3D' 
														AND CheckKeyValue = CAST(@SnmpMibOidI3D as NVARCHAR)
				IF(@MonitoringCheckTemplateMapCount > 0)
					BEGIN
						SET @DeleteProcess = 1
					END
			END
	END
IF(@SnmpMibDetailI3D > 0 AND @DeleteProcess = 0)
	BEGIN
		SELECT @SnmpMibCheckCount = Count(1) FROM dbo.AssetManagementSnmpMibChecks WHERE 
							SnmpOidI3D IN (SELECT I3D FROM dbo.AssetManagementSnmpMibOidDetails WHERE SnmpMibI3D = @SnmpMibDetailI3D)
		IF(@SnmpMibCheckCount > 0)
			BEGIN
				SET @DeleteProcess = 1
			END
		IF(@DeleteProcess = 0)
			BEGIN
				SELECT @MonitoringCheckTemplateMapCount = Count(1) FROM dbo.MonitoringCheckTemplateMaps 
														WHERE CheckI3D = 14 AND CheckKeyName = 'SnmpOidI3D' 
														AND CheckKeyValue IN (SELECT CAST(I3D as NVARCHAR) FROM dbo.AssetManagementSnmpMibOidDetails 
																					WHERE SnmpMibI3D = @SnmpMibDetailI3D)
				IF(@MonitoringCheckTemplateMapCount > 0)
					BEGIN
						SET @DeleteProcess = 1
					END
			END
	END
IF(@DeleteProcess = 0)
	BEGIN
		UPDATE dbo.AssetManagementSnmpMibOidDetails SET IsActive = 0 WHERE I3D = @SnmpMibOidI3D
		UPDATE dbo.AssetManagementSnmpMibDetails SET IsActive = 0 WHERE I3D = @SnmpMibDetailI3D
		SET @DeleteProcess = 2
	END
SET NOCOUNT OFF
SELECT @DeleteProcess AS StatusID	
END
       
GO
/****** Object:  StoredProcedure [dbo].[procDeleteCheckConfigurations]    Script Date: 11.11.2025 11:20:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procDeleteCheckConfigurations]
	@CheckI3DList nvarchar(1000),
	@DeviceI3D int
AS
BEGIN
	DECLARE @RecordCount int = 0
	DECLARE @IndexCount int = 0
	DECLARE @SelectedCheckI3D int = 0
	DECLARE @CheckTypeID int = -1
	DECLARE @SelectedDeviceI3D int = -1
	DECLARE @CheckConfigurationCountValidate int = -1
	DECLARE @CheckID int
	DECLARE @TempCheckList table
	(
		CheckI3D int
	)

	IF(@CheckI3DList <> '' AND @DeviceI3D = 0)
		BEGIN
			DECLARE @CheckI3D varchar(10), @Pos int
			SET @CheckI3DList = LTRIM(RTRIM(@CheckI3DList))+ ','
			SET @Pos = CHARINDEX(',', @CheckI3DList, 1)
			IF REPLACE(@CheckI3DList, ',', '') <> ''
			BEGIN
				WHILE @Pos > 0
					BEGIN
						SET @CheckI3D = LTRIM(RTRIM(LEFT(@CheckI3DList, @Pos - 1)))
						IF @CheckI3D <> ''
							BEGIN
								INSERT INTO @TempCheckList (CheckI3D) VALUES (CAST(@CheckI3D AS int)) --Use Appropriate conversion
							END
							SET @CheckI3DList = RIGHT(@CheckI3DList, LEN(@CheckI3DList) - @Pos)
							SET @Pos = CHARINDEX(',', @CheckI3DList, 1)
					END
			END
		END
	ELSE IF(@DeviceI3D > 0)
		BEGIN
			INSERT INTO @TempCheckList SELECT I3D FROM AssetManagementCheckConfigurations WHERE DeviceId = @DeviceI3D
		END

	SELECT @RecordCount = Count(1) FROM @TempCheckList
	IF(@RecordCount > 0)
		BEGIN
			WHILE (@IndexCount < @RecordCount)
				BEGIN
					SELECT @SelectedCheckI3D = CheckI3D FROM @TempCheckList ORDER BY CheckI3D OFFSET @IndexCount ROWS FETCH NEXT 1 ROWS ONLY
					IF(@SelectedCheckI3D > 0)
						BEGIN
							SELECT @CheckTypeID = CheckType, @SelectedDeviceI3D = DeviceId, @CheckID = CheckID FROM AssetManagementCheckConfigurations WHERE I3D = @SelectedCheckI3D
							
							DELETE FROM AssetManagementCheckConfigurations WHERE I3D = @SelectedCheckI3D

							-- For HardDriveCheck
							IF(@CheckTypeID = 1)
								BEGIN									
									DELETE FROM AssetManagementHardDriveChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsHardDriveCheckEnabled = 0, HardDriveCheckInterval = 0,
													IsHardDriveCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For PatchesCheck
							IF(@CheckTypeID = 2)
								BEGIN
									DELETE FROM AssetManagementPatchesChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsPatchesCheckEnabled = 0, PatchesCheckInterval = 0,
													IsPatchesCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For WindowsServiceCheck
							IF(@CheckTypeID = 3)
								BEGIN
									DELETE FROM AssetManagementWindowsServiceChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsWindowsServiceCheckEnabled = 0, WindowsServiceCheckInterval = 0,
													IsWindowsServiceCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For AntivirusCheck
							IF(@CheckTypeID = 4)
								BEGIN
									DELETE FROM AssetManagementAntivirusChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsAntivirusCheckEnabled = 0, AntivirusCheckInterval = 0,
													IsAntivirusCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For PingCheck
							IF(@CheckTypeID = 5)
								BEGIN
									DELETE FROM AssetManagementPingChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsPingCheckEnabled = 0, PingCheckInterval = 0,
													IsPingCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For SnmpBackupCheck
							IF(@CheckTypeID = 6)
								BEGIN
									DELETE FROM AssetManagementSnmpBackupChecks WHERE I3D = @CheckID
									DELETE FROM AssetManagementSNMPOIDChecks WHERE SNMPCheckI3D = @CheckID AND SnmpType = 0
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsSnmpBackupCheckEnabled = 0, SnmpBackupCheckInterval = 0,
													IsSnmpBackupCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For SqlCheck
							IF(@CheckTypeID = 7)
								BEGIN
									DELETE FROM AssetManagementSQLServerChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsSqlCheckEnabled = 0, SqlCheckInterval = 0,
													IsSqlCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For EventLogCheck
							IF(@CheckTypeID = 8)
								BEGIN
									DELETE FROM AssetManagementEventLogChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsEventLogCheckEnabled = 0, EventLogCheckInterval = 0,
													IsEventLogCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For PowerShellCheck
							IF(@CheckTypeID = 9)
								BEGIN
									DELETE FROM AssetManagementPowerShellChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsPowerShellCheckEnabled = 0, PowerShellCheckInterval = 0,
													IsPowerShellCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For VendorWarrantyCheck
							IF(@CheckTypeID = 10)
								BEGIN
									DELETE FROM AssetManagementVendorWarrantyChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsVendorWarrantyCheckEnabled = 0, VendorWarrantyCheckInterval = 0,
													IsVendorWarrantyCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For MSBackupCheck
							IF(@CheckTypeID = 11)
								BEGIN
									DELETE FROM AssetManagementMSBackupChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsMSBackupCheckEnabled = 0, MSBackupCheckInterval = 0,
													IsMSBackupCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For BackupStatusCheck
							IF(@CheckTypeID = 12)
								BEGIN
									DELETE FROM AssetManagementBackupStatusChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsBackupStatusCheckEnabled = 0, BackupStatusCheckInterval = 0,
													IsBackupStatusCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For HttpCheck
							IF(@CheckTypeID = 13)
								BEGIN
									DELETE FROM AssetManagementHttpChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsHttpCheckEnabled = 0, HttpCheckInterval = 0,
													IsHttpCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For SnmpCheck
							IF(@CheckTypeID = 14)
								BEGIN
									DELETE FROM AssetManagementSnmpMibChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsSnmpCheckEnabled = 0, SnmpCheckInterval = 0,
													IsSnmpCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For SslCertificateCheck
							IF(@CheckTypeID = 15)
								BEGIN
									DELETE FROM AssetManagementSslCertificateChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsSslCertificateCheckEnabled = 0, SslCertificateCheckInterval = 0,
													IsSslCertificateCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For PerformanceCheck
							IF(@CheckTypeID = 16)
								BEGIN
									DELETE FROM AssetManagementPerformanceChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsPerformanceCheckEnabled = 0, PerformanceCheckInterval = 0,
													IsPerformanceCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- For LoginFailedCheck
							IF(@CheckTypeID = 17)
								BEGIN
									DELETE FROM AssetManagementLoginFailedChecks WHERE I3D = @CheckID
									IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D and CheckType = @CheckTypeID) = 0)
										BEGIN
											UPDATE AssetManagementCrawlerConfigurations SET IsLoginFailedCheckEnabled = 0, LoginFailedCheckInterval = 0,
													IsLoginFailedCheckExecutionStart = 0 WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
										END
								END

							-- Delete AssetManagementCheckResult
							DELETE FROM AssetManagementCheckResults WHERE CheckConfigurationID = @SelectedCheckI3D

							-- Delete AssetManagementCheckStatusReport
							DELETE FROM AssetManagementCheckStatusReports WHERE CheckConfigurationI3D = @SelectedCheckI3D
						END
						-- Check any Records Exists in AssetManagementCheckConfigurations by Device, if not then reset all. with this exists records which are not reset will be done
						IF((SELECT Count(1) FROM AssetManagementCheckConfigurations WHERE DeviceId = @SelectedDeviceI3D) = 0)
						BEGIN
							UPDATE AssetManagementCrawlerConfigurations SET IsHardDriveCheckEnabled = 0, HardDriveCheckInterval = 0, IsHardDriveCheckExecutionStart = 0,
																			IsPatchesCheckEnabled = 0, PatchesCheckInterval = 0, IsPatchesCheckExecutionStart = 0,
																			IsWindowsServiceCheckEnabled = 0, WindowsServiceCheckInterval = 0, IsWindowsServiceCheckExecutionStart = 0,
																			IsAntivirusCheckEnabled = 0, AntivirusCheckInterval = 0, IsAntivirusCheckExecutionStart = 0,
																			IsPingCheckEnabled = 0, PingCheckInterval = 0, IsPingCheckExecutionStart = 0,
																			IsSnmpBackupCheckEnabled = 0, SnmpBackupCheckInterval = 0, IsSnmpBackupCheckExecutionStart = 0,
																			IsSqlCheckEnabled = 0, SqlCheckInterval = 0, IsSqlCheckExecutionStart = 0,
																			IsEventLogCheckEnabled = 0, EventLogCheckInterval = 0, IsEventLogCheckExecutionStart = 0,
																			IsPowerShellCheckEnabled = 0, PowerShellCheckInterval = 0, IsPowerShellCheckExecutionStart = 0,
																			IsVendorWarrantyCheckEnabled = 0, VendorWarrantyCheckInterval = 0, IsVendorWarrantyCheckExecutionStart = 0,
																			IsMSBackupCheckEnabled = 0, MSBackupCheckInterval = 0, IsMSBackupCheckExecutionStart = 0,
																			IsBackupStatusCheckEnabled = 0, BackupStatusCheckInterval = 0, IsBackupStatusCheckExecutionStart = 0,
																			IsHttpCheckEnabled = 0, HttpCheckInterval = 0, IsHttpCheckExecutionStart = 0,
																			IsSnmpCheckEnabled = 0, SnmpCheckInterval = 0, IsSnmpCheckExecutionStart = 0,
																			IsSslCertificateCheckEnabled = 0, SslCertificateCheckInterval = 0, IsSslCertificateCheckExecutionStart = 0,
																			IsPerformanceCheckEnabled = 0, PerformanceCheckInterval = 0, IsPerformanceCheckExecutionStart = 0,
																			IsLoginFailedCheckEnabled = 0, LoginFailedCheckInterval = 0, IsLoginFailedCheckExecutionStart = 0
																			WHERE DeviceI3D = @SelectedDeviceI3D AND ExecutionTypeI3D = 1
						END

					SET @IndexCount = @IndexCount + 1
				END
		END
END
       
GO
/****** Object:  StoredProcedure [dbo].[procDeleteDeviceDetails]    Script Date: 11.11.2025 11:20:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE PROCEDURE [dbo].[procDeleteDeviceDetails]
	        @DeviceI3DList nvarchar(256)
        AS
        BEGIN
	        DECLARE @TempList table
	        (
		        DeviceI3D int
	        )
	        DECLARE @DeviceI3D varchar(10), @Pos int
	        SET @DeviceI3DList = LTRIM(RTRIM(@DeviceI3DList))+ ','
	        SET @Pos = CHARINDEX(',', @DeviceI3DList, 1)
	        IF REPLACE(@DeviceI3DList, ',', '') <> ''
	        BEGIN
		        WHILE @Pos > 0
			        BEGIN
				        SET @DeviceI3D = LTRIM(RTRIM(LEFT(@DeviceI3DList, @Pos - 1)))
				        IF @DeviceI3D <> ''
					        BEGIN
						        INSERT INTO @TempList (DeviceI3D) VALUES (CAST(@DeviceI3D AS int)) --Use Appropriate conversion
					        END
					        SET @DeviceI3DList = RIGHT(@DeviceI3DList, LEN(@DeviceI3DList) - @Pos)
					        SET @Pos = CHARINDEX(',', @DeviceI3DList, 1)
			        END
	        END

	        -- Delete the AssetManagementDeviceDependency Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementDeviceDependencies WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementApplication Table details on Basis of Device I3D.
		        --First Delete AssetManagementProcessesToAssets on Basis of ApplicationI3D
		        DELETE FROM AssetManagementProcessesToAssets WHERE ObjectI3D IN (SELECT I3D FROM AssetManagementApplication WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)) AND ObjectKind = 5101340

		        -- Delete AssetManagementPartnerItems  on Basis of ApplicationI3D
		        DELETE FROM AssetManagementPartnerItems WHERE ObjectI3D IN (SELECT I3D FROM AssetManagementApplication WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)) AND ObjectKind = 5101340
	        DELETE FROM AssetManagementApplication WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementComputerSystem Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementComputerSystem WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementFolderForShare Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementFolderForShare WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementLogicalDeviceHistory Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementLogicalDeviceHistory WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementLogicalDevice Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementLogicalDevice WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementMappedDrive Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementMappedDrive WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementMediaAccessDevice Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementMediaAccessDevice WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementMemory Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementMemory WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementMotherboard Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementMotherboard WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementNetworkAdapter Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementNetworkAdapter WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementOS Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementOS WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementOSFeatures Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementOSFeatures WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementPatch Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementPatch WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementPhysicalDrive Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementPhysicalDrive WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementPort Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementPort WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementPrinter Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementPrinter WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementProcessor Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementProcessor WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementRAIDController Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementRAIDController WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementService Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementService WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementSoCustomer Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementSoCustomer WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementUSBDevice Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementUSBDevice WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementVideoController Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementVideoController WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementDrivers Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementDrivers WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementVendorWarrantyCheck Table details on Basis of Device I3D.
		        -- Process to Delete the Data from AssetManagementCheckStatusReports which Devices has already deleted and related Device I3D data exists in this Table for Vendor Warranty.
		        DELETE FROM AssetManagementCheckStatusReports WHERE CheckConfigurationI3D IN (SELECT I3D FROM AssetManagementCheckConfigurations WHERE CheckType = 10 AND CheckID IN 
			        (SELECT I3D FROM AssetManagementVendorWarrantyChecks WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)))

		        DELETE FROM AssetManagementCheckResults WHERE CheckConfigurationID IN (SELECT I3D FROM AssetManagementCheckConfigurations WHERE CheckType = 10 AND CheckID IN 
		        (SELECT I3D FROM AssetManagementVendorWarrantyChecks WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)))

		        DELETE FROM AssetManagementCheckConfigurations WHERE CheckType = 10 AND CheckID IN (SELECT I3D FROM AssetManagementVendorWarrantyChecks WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementVendorWarrantyChecks WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)
		        -- Vendor Warranty Process Completed.

	        -- Delete the AssetManagementCheckConfiguration Table details on Basis of Device I3D.
		        -- Process to Delete the Data from AssetManagementCheckStatusReports which Devices has already deleted and related Device I3D data exists in this Table for CheckConfiguration.
		        DELETE FROM AssetManagementHardDriveChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementPatchesChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementWindowsServiceChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementAntivirusChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementPingChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementSNMPBackupChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementSnmpMibChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementSQLServerChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementEventLogChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementPowerShellChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementVendorWarrantyChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementMSBackupChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementBackupStatusChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementHttpChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementSslCertificateChecks WHERE I3D IN 
		        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementCheckStatusReports WHERE CheckConfigurationI3D IN 
		        (SELECT I3D FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementCheckResults WHERE CheckConfigurationID IN 
		        (SELECT I3D FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementCheckConfigurations WHERE DeviceId IN (SELECT DeviceI3D FROM @TempList)
		        -- CheckConfiguration Process Completed

	        -- Delete the AssetManagementServiceConnectorLogs Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementServiceConnectorLogs WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the AssetManagementMonitors Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementMonitors WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        -- Delete the MonitoringTemplateToDeviceMaps Table details on Basis of Device I3D.
	        DELETE FROM MonitoringTemplateToDeviceMaps WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

	        --Before Delete Device Delete related Assinments
		        --First Delete AssetManagementProcessesToAssets on Basis of Device I3D
		        DELETE FROM AssetManagementProcessesToAssets WHERE ObjectI3D IN (SELECT DeviceI3D FROM @TempList) AND ObjectKind = 5101330

		        -- Delete AssetManagementPartnerItems  on Basis of Device I3D
		        DELETE FROM AssetManagementPartnerItems WHERE ObjectI3D IN (SELECT DeviceI3D FROM @TempList) AND ObjectKind = 5101330

		        -- Delete AssetManagementOrgUnitToItems  on Basis of Device I3D
		        DELETE FROM AssetManagementOrgUnitToItems WHERE ObjectI3D IN (SELECT DeviceI3D FROM @TempList) AND ObjectKind = 5101330

		        -- Delete AssetManagementDeviceRating  on Basis of Device I3D
		        DELETE FROM AssetManagementDeviceRating WHERE ObjectI3D IN (SELECT DeviceI3D FROM @TempList) AND ObjectKind = 5101330

		        -- Delete AssetManagementCveSecurityIssueApplications  on Basis of Device I3D
		        DELETE FROM AssetManagementCveSecurityIssueApplications WHERE SecurityIssueI3D IN (SELECT I3D FROM AssetManagementSecurityIssues WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList))

		        -- Delete AssetManagementCveSecurityIssueReferenceLinks  on Basis of Device I3D
		        DELETE FROM AssetManagementCveSecurityIssueReferenceLinks WHERE SecurityIssueI3D IN (SELECT I3D FROM AssetManagementSecurityIssues WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList))

		        DELETE FROM AssetManagementSecurityIssues WHERE DeviceI3D IN (SELECT DeviceI3D FROM @TempList)

		        -- Delete AssetManagementContract on Basis of DeviceI3D

	        -- Delete the AssetManagementDevices Table details on Basis of Device I3D.
	        DELETE FROM AssetManagementDevices WHERE I3D IN (SELECT DeviceI3D FROM @TempList)
        END
       
GO
/****** Object:  StoredProcedure [dbo].[procDeleteServiceConnectorLogs]    Script Date: 11.11.2025 11:20:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE PROCEDURE [dbo].[procDeleteServiceConnectorLogs]
        AS
        BEGIN
	        -- Process to Delete the Info logs which has before 2 days back.
	        DELETE FROM AssetManagementServiceConnectorLogs WHERE lower(LogType) = lower('Info') AND LogDate < GetDate() - 2

	        -- Process to Delete the Info logs which has before 5 days back.
	        DELETE FROM AssetManagementServiceConnectorLogs WHERE lower(LogType) <> lower('Info') AND LogDate < GetDate() - 5

	        -- Process to Delete the Data from AssetManagementServiceConnectorLogs which Devices has already deleted and related Device I3D data exists in this Table.
	        DELETE FROM AssetManagementServiceConnectorLogs WHERE DeviceI3D NOT IN (SELECT I3D FROM AssetManagementDevices)

	        -- Process to Delete the Data from AssetManagementCheckStatusReports which Devices has already deleted and related Device I3D data exists in this Table for Vendor Warranty.
	        DELETE FROM AssetManagementCheckStatusReports WHERE CheckConfigurationI3D IN (SELECT I3D FROM AssetManagementCheckConfigurations WHERE CheckType = 10 AND CheckID IN 
	        (SELECT I3D FROM AssetManagementVendorWarrantyChecks WHERE DeviceI3D NOT IN (SELECT I3D FROM AssetManagementDevices)))

	        DELETE FROM AssetManagementCheckResults WHERE CheckConfigurationID IN (SELECT I3D FROM AssetManagementCheckConfigurations WHERE CheckType = 10 AND CheckID IN 
	        (SELECT I3D FROM AssetManagementVendorWarrantyChecks WHERE DeviceI3D NOT IN (SELECT I3D FROM AssetManagementDevices)))

	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckType = 10 AND CheckID IN 
	        (SELECT I3D FROM AssetManagementVendorWarrantyChecks WHERE DeviceI3D NOT IN (SELECT I3D FROM AssetManagementDevices))


	        DELETE FROM AssetManagementVendorWarrantyChecks WHERE DeviceI3D NOT IN (SELECT I3D FROM AssetManagementDevices)	
	        -- Vendor Warranty Process Completed.

	        -- Process to Delete the Data from AssetManagementCheckStatusReports which Devices has already deleted and related Device I3D data exists in this Table for CheckConfiguration.

	        DELETE FROM AssetManagementHardDriveChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementPatchesChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementWindowsServiceChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementAntivirusChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementPingChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementSNMPBackupChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementSnmpMibChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementSQLServerChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementEventLogChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementPowerShellChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementVendorWarrantyChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementMSBackupChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementBackupStatusChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementHttpChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementSslCertificateChecks WHERE I3D IN 
	        (SELECT CheckID FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementCheckStatusReports WHERE CheckConfigurationI3D IN 
	        (SELECT I3D FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementCheckResults WHERE CheckConfigurationID IN 
	        (SELECT I3D FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices))

	        DELETE FROM AssetManagementCheckConfigurations WHERE DeviceId NOT IN (SELECT I3D FROM AssetManagementDevices)
	        -- CheckConfiguration Process Completed

	        -- Process to Delete the MonitoringTemplateToDeviceMap which devices has deleted

	        DELETE FROM MonitoringTemplateToDeviceMaps WHERE DeviceI3D NOT IN (SELECT I3D FROM AssetManagementDevices)

	        -- MonitoringTemplateToDeviceMap Process Completed

	        -- Process to Delete the Check Results which has not in Check Configuration

	        DELETE FROM AssetManagementCheckResults WHERE CheckConfigurationID NOT IN (SELECT I3D FROM AssetManagementCheckConfigurations)

	        DELETE FROM AssetManagementCheckStatusReports WHERE CheckConfigurationI3D NOT IN (SELECT I3D FROM AssetManagementCheckConfigurations)
	
	        -- HardDriveCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementHardDriveChecks) AND CheckType = 1

	        -- PatchesCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementPatchesChecks) AND CheckType = 2

	        -- WindowsServiceCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementWindowsServiceChecks) AND CheckType = 3

	        -- AntivirusCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementAntivirusChecks) AND CheckType = 4

	        -- PingCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementPingChecks) AND CheckType = 5

	        -- SnmpBackupCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementSNMPBackupChecks) AND CheckType = 6

	        -- SqlCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementSQLServerChecks) AND CheckType = 7

	        -- EventLogCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementEventLogChecks) AND CheckType = 8

	        -- PowerShellCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementPowerShellChecks) AND CheckType = 9

	        -- VendorWarrantyCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementVendorWarrantyChecks) AND CheckType = 10

	        -- MSBackupCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementMSBackupChecks) AND CheckType = 11

	        -- BackupStatusCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementBackupStatusChecks) AND CheckType = 12

	        -- HttpCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementHttpChecks) AND CheckType = 13

	        -- SnmpCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementSnmpMibChecks) AND CheckType = 14

	        -- SslCertificateCheck
	        DELETE FROM AssetManagementCheckConfigurations WHERE CheckID NOT IN (SELECT I3D FROM AssetManagementSslCertificateChecks) AND CheckType = 15
	        -- Check Results Process Completed
        END
       
GO
/****** Object:  StoredProcedure [dbo].[procDeletPatchesByDevice]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procDeletPatchesByDevice] 
	@DeviceI3D int
AS
BEGIN
	DELETE FROM AssetManagementPatch WHERE DeviceI3D = @DeviceI3D AND InstallationResult = 'Not Installed'
	SELECT * FROM AssetManagementPatch WHERE DeviceI3D = @DeviceI3D
END
       
GO
/****** Object:  StoredProcedure [dbo].[procDelPosLetzteArtikelVerwendung]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[procDelPosLetzteArtikelVerwendung] 
	@KundenI3D int, 
	@ArtikelI3D int,
	@AnlageArt int, 
	@PosI3D int 
AS 
BEGIN 
SET NOCOUNT ON 
DECLARE @sSql 	varchar(1000),
			@Anlage varchar(5),
			@NewPosI3D int 
	IF EXISTS(SELECT PosI3D 
				FROM LetzteArtikelVerwendung 
				WHERE KundenI3D = @KundenI3D 
				  AND ArtikelI3D = @ArtikelI3D 
				  AND AnlageArt = @AnlageArt 
				  AND PosI3D = @PosI3D) 
	BEGIN 
		IF @AnlageArt = 1 SET @Anlage = 'Ang' 
		ELSE IF @AnlageArt = 2 SET @Anlage = 'Auf' 
		ELSE IF @AnlageArt = 3 SET @Anlage = 'Lief' 
		ELSE IF @AnlageArt = 4 SET @Anlage = 'Rech' 

		CREATE TABLE #tbl(PosI3D int) 
			SET @sSql = 'INSERT INTO #tbl 
							  SELECT TOP 1 p.I3D  
							  FROM ' +@Anlage + 'Pos p 
							  INNER JOIN ' +@Anlage + 'Kopf k ON k.I3D = p.' +@Anlage + 'KopfI3D 
								WHERE p.ART = 1 
								AND p.ArtikelI3D  = ' + LTRIM(STR(@ArtikelI3D)) + 
								' ORDER BY CASE WHEN k.GeaendertDatum IS NULL THEN k.ErstelltDatum ELSE k.GeaendertDatum END  DESC' 
	EXEC (@sSql) 
	SET @NewPosI3D = ISNULL((SELECT PosI3D FROM #tbl),0) 
	IF @NewPosI3D > 0 
		UPDATE LetzteArtikelVerwendung  
		SET PosI3D = @NewPosI3D 
				WHERE KundenI3D = @KundenI3D 
				AND ArtikelI3D = @ArtikelI3D 
				AND AnlageArt = @AnlageArt 
				AND PosI3D = @PosI3D 
 	ELSE 
		DELETE FROM LetzteArtikelVerwendung 
		WHERE KundenI3D = @KundenI3D 
			AND ArtikelI3D = @ArtikelI3D  
			AND AnlageArt = @AnlageArt 
			AND PosI3D = @PosI3D 
 	END 
END

GO
/****** Object:  StoredProcedure [dbo].[procDeviceCheckResults]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE PROCEDURE [dbo].[procDeviceCheckResults] 
	        @DeviceID INT
        AS
        SET NOCOUNT ON

        DECLARE @DeviceName NVARCHAR(100)
        DECLARE @ISDeviceOnline bit
        DECLARE @DeviceUptime nvarchar(20)

        SELECT @DeviceName = ShortName, @ISDeviceOnline = IsOnline, @DeviceUptime = DeviceUptime FROM AssetManagementDevices WHERE I3D = @DeviceId

        BEGIN
	        SELECT I3D, DeviceID, @DeviceName AS DeviceName, CheckType, @ISDeviceOnline AS IsOnline, @DeviceUptime AS DeviceUptime,
			        CASE WHEN CheckType = 1 THEN 'HardDriveCheck'
				            WHEN CheckType = 2 THEN 'PatchesCheck'
				            WHEN CheckType = 3 THEN 'WindowsServiceCheck'
				            WHEN CheckType = 4 THEN 'AntivirusCheck'
				            WHEN CheckType = 5 THEN 'PingCheck'
				            WHEN CheckType = 6 THEN 'SnmpBackupCheck'
				            WHEN CheckType = 7 THEN 'SqlCheck'
				            WHEN CheckType = 8 THEN 'EventLogCheck'
				            WHEN CheckType = 9 THEN 'PowerShellCheck'
				            WHEN CheckType = 10 THEN 'VendorWarrantyCheck'
				            WHEN CheckType = 11 THEN 'MSBackupCheck'
				            WHEN CheckType = 12 THEN 'BackupStatusCheck'
				            WHEN CheckType = 13 THEN 'HttpCheck'
				            WHEN CheckType = 14 THEN 'SnmpCheck'
				            WHEN CheckType = 15 THEN 'SslCertificateCheck'
				            WHEN CheckType = 16 THEN 'PerformanceCheck'
				            WHEN CheckType = 17 THEN 'LoginFailedCheck'
			        END AS CheckName
	        FROM (SELECT Count(I3D) AS I3D, DeviceID, CheckType FROM [dbo].[AssetManagementCheckConfigurations]
			        WHERE DeviceID = @DeviceID 
			        GROUP BY DeviceID, CheckType) AS RESULT
        END
       
GO
/****** Object:  StoredProcedure [dbo].[procDeviceCheckStatusThroughPaging]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procDeviceCheckStatusThroughPaging] 
	@DeviceID INT,
	@PageNo int,
	@RecordsPerPage int
AS
SET NOCOUNT ON

DECLARE @DeviceName NVARCHAR(100)
DECLARE @ISDeviceOnline bit
DECLARE @DeviceUptime nvarchar(20)
DECLARE @HelpdeskTicketCount INT

SELECT @DeviceName = ShortName, @ISDeviceOnline=IsOnline, @DeviceUptime = DeviceUptime FROM AssetManagementDevices WHERE I3D = @DeviceID

SELECT  @HelpdeskTicketCount = Count(1) FROM dbo.AssetManagementNotification INNER JOIN 
				dbo.hlpdsk_requests ON dbo.AssetManagementNotification.HelpdeskI3D = dbo.hlpdsk_requests.I3D
				WHERE dbo.AssetManagementNotification.DeviceID = @DeviceID

BEGIN

	DECLARE @tempDeviceCheckList TABLE 
	(
			Row int,
			I3D int,
			CheckID int,
			DeviceID int,
			DeviceName nvarchar(256),
			IsOnline bit,
			DeviceUptime nvarchar(20),
			Name nvarchar(max),
			CheckType int,
			[State] nvarchar(50),
			CheckRunDate nvarchar(100),
			CheckName nvarchar(100),
			HelpdeskTicketCount int
	)

	DECLARE @AssetManagementCheckConfigurations_Temp TABLE
	(
		[I3D] [int] NOT NULL,
		[CheckID] [int] NOT NULL,
		[Status] [bit] NOT NULL,
		[StartTime] [datetime] NULL,
		[IntervalKind] [int] NOT NULL,
		[IntervalInMinutes] [int] NULL,
		[DeviceId] [int] NOT NULL,
		[IsNewCheck] [bit] NOT NULL,
		[CheckType] [int] NOT NULL,
		[NoAlertFrom] [datetime] NULL,
		[NoAlertTo] [datetime] NULL,
		[IsPicked] [bit] NOT NULL,
		[PickedDateTime] [datetime] NULL,
		[State] [nvarchar](50) NULL,
		[Message] [nvarchar](2000) NULL,
		[Date] [datetime] NULL
	)

	INSERT INTO @AssetManagementCheckConfigurations_Temp SELECT mct.*, crt.State, crt.Message, crt.Date FROM AssetManagementCheckConfigurations mct LEFT OUTER JOIN AssetManagementCheckResults crt ON (mct.I3D = crt.CheckConfigurationID) WHERE mct.DeviceId = @DeviceID

	INSERT INTO @tempDeviceCheckList

		-- HardDriveCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Hard Disk - ' + ' ' + ct.Drive + ' '+IsNull( mct.Message,'') AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'HardDriveCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementHardDriveChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 1) AS HardDriveCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- PatchesCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Patches' Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'PatchesCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementPatchesChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 2) AS PatchesCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- WindowsServiceCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Windows Service - ' + ct.NameOfServices AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'WindowsServiceCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementWindowsServiceChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 3) AS WindowsServiceCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- AntivirusCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Antivirus' AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'AntivirusCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementAntivirusChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 4) AS AntivirusCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- PingChcek-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Ping - ' + ' ' + ct.IPOrComputerName AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'PingCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementPingChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 5) AS PingChcekResult
				WHERE Row = 1
	
		UNION ALL
	
		-- SnmpBackupCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Snmp Backup - ' + Cast(ct.PortNumber AS NVARCHAR) + ' ' + ct.JobName + ' ' + Cast(ISNULL(ct.CommunityString, '') AS NVARCHAR) AS Name,
				CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'SnmpBackupCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementSNMPBackupChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 6) AS SnmpBackupCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- SqlCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Sql - ' + ct.SqlInstanceName + ' ' + ct.SqlDatabaseName AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'SqlCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementSQLServerChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 7) AS SqlCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- EventLogCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Event Log - ' + ct.ProviderName + CASE WHEN ct.EventId <> 0 THEN ' ' + CONVERT(VARCHAR(16), ct.EventId) ELSE '' END AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate, 
				'EventLogCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementEventLogChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 8) AS EventLogCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- PowerShellCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D, 
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'PowerShell - ' + ct.PowerShellScript AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'PowerShellCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementPowerShellChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 9) AS PowerShellCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- VendorWarrantyCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, mct.DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Vendor Warranty - ' + Dev.ShortName + ' - ' +  + ct.VendorName AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'VendorWarrantyCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementVendorWarrantyChecks] ct ON (mct.checkID = ct.I3D)
				INNER JOIN dbo.AssetManagementDevices Dev ON (Dev.I3D = ct.DeviceI3D)
				WHERE mct.[DeviceID] = @DeviceID AND CheckType = 10) AS VendorWarrantyCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- MSBackupCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'MSBackup' AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'MSBackupCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementMSBackupChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 11) AS MSBackupCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- BackupStatusCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Vendor Backup - ' + CASE WHEN ct.BackupTypeI3D = 0 THEN 'Veeam '+ct.ServerName+' '+ct.DatabaseName
										WHEN ct.BackupTypeI3D = 1 THEN 'Symantec '+ct.ServerName+' '+ct.DatabaseName
										WHEN ct.BackupTypeI3D = 2 THEN 'Arcserve '+ct.ServerName+' '+ct.DatabaseName END AS Name,
				CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'BackupStatusCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementBackupStatusChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 12) AS BackupStatusCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- HttpCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime, 
				'Http - ' + ct.WebsiteUrl AS Name,
				CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'HttpCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementHttpChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 13) AS HttpCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- SnmpCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Snmp - ' + Cast(ISNULL(mibDetails.ProviderName, '') AS NVARCHAR) + ' ' + Cast(ISNULL(ct.SystemName, '') AS NVARCHAR) + ' ' + Cast(ISNULL(ct.CommunityString, '') AS NVARCHAR) + ' ' + Cast(ISNULL( mibDetails.ServiceName, '') AS NVARCHAR) AS Name,
				CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'SnmpCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].AssetManagementSnmpMibChecks ct ON (mct.checkID = ct.I3D)
				INNER JOIN [dbo].AssetManagementSnmpMibOidDetails mibOidDetails ON (ct.SnmpOidI3D = mibOidDetails.I3D)
				INNER JOIN [dbo].AssetManagementSnmpMibDetails mibDetails ON (mibOidDetails.SnmpMibI3D = mibDetails.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 14 ) AS SnmpCheckResult
				WHERE Row = 1	

		UNION ALL
	
		-- SslCertificateCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				CASE IsNull(mct.Message,'') WHEN '' THEN 'Ssl Certificate - ' + ' ' + ct.CertificateName
				ELSE
				'Ssl Certificate - ' + ' ' + IsNull(mct.Message,'')
				END AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'SslCertificateCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementSslCertificateChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 15) AS HardDriveCheckResult
				WHERE Row = 1
	
		UNION ALL

		-- Performance Check --
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Performance - ' + ' ' + ct.ServiceName AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'PerformanceCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementPerformanceChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 16) AS HardDriveCheckResult
				WHERE Row = 1
	
		UNION ALL
	
		-- LoginFailedCheck-------------
		SELECT DISTINCT * FROM (SELECT Dense_Rank() OVER (PARTITION BY CheckID ORDER BY mct.DATE DESC) AS Row, mct.I3D,
				CheckID, DeviceID, @DeviceName AS DeviceName, @ISDeviceOnline As IsOnline, @DeviceUptime AS DeviceUptime,
				'Login Failed - ' + Convert(nvarchar(5), ct.BackDays) + ' day(s) back' AS Name, CheckType, COALESCE(mct.STATE,'Not Run') AS [State],
				COALESCE(REPLACE(CONVERT(VARCHAR(16), mct.DATE, 120), '-' + RIGHT('0' + RTRIM(MONTH(mct.DATE)), 2) + '-', ' ' + DATENAME(MM, mct.DATE) + ' '),'Not Run') AS CheckRunDate,
				'LoginFailedCheck' AS CheckName, @HelpdeskTicketCount AS HelpdeskTicketCount
				FROM @AssetManagementCheckConfigurations_Temp mct
				INNER JOIN [dbo].[AssetManagementLoginFailedChecks] ct ON (mct.checkID = ct.I3D)
				WHERE [DeviceID] = @DeviceID AND CheckType = 17) AS AntivirusCheckResult
				WHERE Row = 1
	
		DECLARE @TotalRecordCount int

		SELECT @TotalRecordCount = count(I3D) FROM @tempDeviceCheckList

		IF(@TotalRecordCount <= 0)
			BEGIN
				INSERT INTO @tempDeviceCheckList VALUES (0, 0, 0, @DeviceID, @DeviceName, @ISDeviceOnline, @DeviceUptime, '', 999, '', GETDATE(), '', 0)
			END
		SELECT @TotalRecordCount = count(I3D) FROM @tempDeviceCheckList
		SELECT Row, I3D, CheckID, DeviceID, DeviceName, Name, CheckType, [State], CheckRunDate, CheckName, IsOnline, DeviceUptime, HelpdeskTicketCount, 
					@TotalRecordCount  as 'TotalRecordCount' FROM @tempDeviceCheckList
					ORDER BY CheckType OFFSET (@PageNo-1)*@RecordsPerPage 
					ROWS FETCH NEXT @RecordsPerPage ROWS ONLY
END
       
GO
/****** Object:  StoredProcedure [dbo].[procFuellEskalation]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[procFuellEskalation] 
	@InsUpd char(1),
	@I3D int,
	@EskStatus int, 
	@ObArt int 
	AS 
	BEGIN 
DECLARE @Cnt INT 
  IF (@InsUpd = 'U') AND (@EskStatus = 1) BEGIN 
    SET @Cnt = (SELECT Count(*) FROM Eskalationen WHERE ObjektI3D = @I3D AND ObArt = @ObArt) 
     if @Cnt = 0 SET @InsUpd = 'I' ELSE BEGIN 
          UPDATE Eskalationen 
              SET Status = @EskStatus, 
              Eskalation1Am = Null, 
              Eskalation2Am = Null, 
              Eskalation3Am = Null, 
              ErstelltAm    = getdate() 
          WHERE ObArt = @ObArt  
            AND ObjektI3D = @I3D 
     END 
   END  
	IF @InsUpd = 'I' 
	INSERT INTO Eskalationen (ObArt,
                           ObjektI3D, 
                           ErstelltAm, 
                           Status) 
                  Values  (@ObArt, 
										@I3D, 
									  getdate(), 
                           @EskStatus)
	IF (@InsUpd = 'U') AND (@EskStatus = 2) 
	UPDATE Eskalationen 
	SET Status = @EskStatus 
 WHERE ObArt = @ObArt 
	AND ObjektI3D = @I3D  
 END

GO
/****** Object:  StoredProcedure [dbo].[procFuellLetzteArtikelVerwendung]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[procFuellLetzteArtikelVerwendung] 
	@KundenI3D int, 
	@ArtikelI3D int, 
	@AnlageArt int, 
	@PosI3D int 
AS 
BEGIN 
SET NOCOUNT ON 
	IF EXISTS(SELECT 1 FROM LetzteArtikelVerwendung k 
	   	WHERE k.KundenI3D = @KundenI3D AND k.ArtikelI3D = @ArtikelI3D AND k.AnlageArt = @AnlageArt) 
		UPDATE LetzteArtikelVerwendung 
		SET PosI3D = @PosI3D 
  	WHERE KundenI3D = @KundenI3D AND ArtikelI3D = @ArtikelI3D AND AnlageArt = @AnlageArt 
	ELSE 
		INSERT INTO LetzteArtikelVerwendung 
			(KundenI3D, ArtikelI3D, AnlageArt, PosI3D) 
			VALUES  (@KundenI3D, @ArtikelI3D, @AnlageArt, @PosI3D) 
END 

GO
/****** Object:  StoredProcedure [dbo].[procGetActiveDeviceClass]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetActiveDeviceClass]
AS
BEGIN
	SELECT DISTINCT Dev.DeviceClass FROM dbo.AssetManagementDevices Dev
              INNER JOIN dbo.Kunden Cust ON Cust.I3D = Dev.KundenI3D
              WHERE Cust.Status = 1 AND (Cust.Gesperrt IS NULL OR Cust.Gesperrt = 0) AND Dev.Deleted = 0              
              ORDER By Dev.DeviceClass
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetActiveTechnicians]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetActiveTechnicians]
	@TechnicianName nvarchar(100)
AS
BEGIN
	SELECT DISTINCT Emp.I3D, Emp.Vorname + ' ' + Emp.Name AS EmployeeName FROM dbo.Personal EMP
              INNER JOIN dbo.Kunden Cust ON Cust.TechnikerID = EMP.I3D OR Cust.Techniker2ID = EMP.I3D
              WHERE Cust.Status = 1 AND Emp.IsActive = 1 AND Emp.Status = 1 AND (Cust.Gesperrt IS NULL OR Cust.Gesperrt = 0)
              AND (Emp.Austritt >= GETDATE() OR Emp.Austritt <= '1900-01-01 00:00:00.000') AND Emp.Vorname + ' ' + Emp.Name like '%' + @TechnicianName + '%'
              ORDER By Emp.Vorname + ' ' + Emp.Name
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetApplicationNotificationSettings]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetApplicationNotificationSettings]
AS
BEGIN
	SET NOCOUNT ON;
	DECLARE @ApplicationNotificationSettings TABLE
	(
		SendWarningNotification BIT NOT NULL,
		SendTechnicianNotification BIT NOT NULL,
		SendWorkStationNotification BIT NOT NULL,
		SendSnmpOtherNotification BIT NOT NULL,
		IsDeviceIgnoreLastConnectNotificationActive BIT NOT NULL
	)

	INSERT INTO @ApplicationNotificationSettings (SendWarningNotification, SendTechnicianNotification, SendWorkStationNotification, SendSnmpOtherNotification, IsDeviceIgnoreLastConnectNotificationActive)
										VALUES ((SELECT ValueBool FROM dbo.ApplicationSettings WITH (NOLOCK) WHERE I3D = 10012), 
												(SELECT ValueBool FROM  dbo.ApplicationSettings WITH (NOLOCK) WHERE I3D = 10013), 
												(SELECT ValueBool FROM  dbo.ApplicationSettings WITH (NOLOCK) WHERE I3D = 50000), 
												(SELECT ValueBool FROM  dbo.ApplicationSettings WITH (NOLOCK) WHERE I3D = 10023), 
												(SELECT ValueBool FROM  dbo.ApplicationSettings WITH (NOLOCK) WHERE I3D = 50024))
	SET NOCOUNT OFF;

	SELECT * FROM @ApplicationNotificationSettings
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetApplicationSmtpSettings]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetApplicationSmtpSettings]
	@MailSmtpUseAuth INT,
	@MailSmtpUserName INT,
	@MailSmtpPassword INT,
	@MailSmtpHost INT,
	@MailSmtpPort INT,
	@MailSmtpTimeout INT
AS
BEGIN
	SET NOCOUNT ON;
	DECLARE @SmtpSettings TABLE
	(
		SmtpMailUseAuthentication INT,
		SmtpMailUserName nvarchar(256),
		SmtpMailPassword nvarchar(256),
		SmtpMailHost nvarchar(256),
		SmtpMailPort INT,
		SmtpMailTimeout INT
	)

	INSERT INTO @SmtpSettings (SmtpMailUseAuthentication, SmtpMailUserName, SmtpMailPassword, SmtpMailHost, SmtpMailPort, SmtpMailTimeout) VALUES
	((SELECT Wert FROM Stammdat WHERE I3D = @MailSmtpUseAuth), (SELECT WertText FROM Stammdat WHERE I3D = @MailSmtpUserName), 
	 (SELECT WertText FROM Stammdat WHERE I3D = @MailSmtpPassword), (SELECT WertText FROM Stammdat WHERE I3D = @MailSmtpHost), 
	 (SELECT Wert FROM Stammdat WHERE I3D = @MailSmtpPort), (SELECT Wert FROM Stammdat WHERE I3D = @MailSmtpTimeout))
	
	SET NOCOUNT OFF;

	SELECT * FROM @SmtpSettings
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetAssetManagementCheckResult]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE PROCEDURE [dbo].[procGetAssetManagementCheckResult]
	        @CheckConfigurationID int = 0,
	        @PageNo int,
	        @RecordsPerPage int
        AS
        BEGIN
	        (SELECT I3D, CheckConfigurationID, State, Resolved, Message, Date, ActualResultValue, OriginalValue FROM AssetManagementCheckResults WHERE CheckConfigurationID = @CheckConfigurationID
	        UNION ALL
	        SELECT CheckResultID AS I3D, CheckConfigurationID, State, Resolved, Message, Date, ActualResultValue, OriginalValue FROM AssetManagementCheckResultsHistory WHERE CheckConfigurationID = @CheckConfigurationID)
	        ORDER BY I3D DESC OFFSET (@PageNo-1)*@RecordsPerPage ROWS FETCH NEXT @RecordsPerPage ROWS ONLY
        END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetAssetManagementCheckStatusReports]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetAssetManagementCheckStatusReports]
	@I3D INT,
	@CustomerI3D int,
	@TechnicianI3D int,
	@CheckTypeI3DList nvarchar(256),
	@DeviceI3D INT,
	@CheckStatusID INT,
	@IsDeviceOnline BIT,
	@IsSystemCrawlerStatus BIT,
	@SearchValue nvarchar(256),
	@IsCheckStatusValidate BIT,
	@DeviceClass nvarchar(256),
	@IsPaging BIT,
	@PageNo INT,
	@RecordsPerPage INT,
	@SortOrderColumn nvarchar(256),
	@SortDescending BIT
AS
BEGIN
	CREATE TABLE #CheckTypeIDs
	(
		CheckI3D int
	)
	CREATE TABLE  #CheckResultStatus 
	(
		DeviceI3D int, 
		LastActionDate datetime, 
		LastActionResult nvarchar(256), 
		CheckStatusIndicator int
	)

	CREATE TABLE #CheckStatusReport
	(
		I3D INT NOT NULL,
		CheckI3D INT NOT NULL,
		CheckName nvarchar(256) NOT NULL,
		DisplayCheckName nvarchar(256) NULL,
		CheckStatus INT NOT NULL,
		DriveName nvarchar(2000) NULL,
		CheckConfigurationI3D INT NOT NULL,
		CustomerI3D INT NOT NULL,
		CustomerName nvarchar(256) NULL,
		DeviceI3D INT NOT NULL,
		DeviceName nvarchar(256) NULL,
		DeviceClass nvarchar(256) NULL,
		IsOnline BIT NULL,
		ServiceName nvarchar(2000) NOT NULL,
		TransactionTime DATETIME NOT NULL,
		CheckTypeID INT NOT NULL,
		LastActionDate DATETIME NULL,
		LastActionResult nvarchar(256) NULL,
		CheckStatusIndicator INT NULL,
		Active BIT NOT NULL,
		SystemCrawlerStatus INT NOT NULL,
		ServiceWorkStatus INT NOT NULL
	)

	DECLARE @TotalRecordCount int
	DECLARE @OkLastTransaction int = 0
	DECLARE @WarningLastTransaction int = 0
	DECLARE @ErrorLastTransaction int = 0
	DECLARE @CurrentDatetime datetime = GETDATE()
	DECLARE @OKCheckStatus smalldatetime
	DECLARE @WarningCheckStatus smalldatetime
	DECLARE @ErrorCheckStatus smalldatetime

	DECLARE @SqlQuery NVARCHAR(max)
	DECLARE @ParameterDefinition NVARCHAR(max)
	DECLARE @DeviceNameSearchValue nvarchar(256)
	
	DECLARE @SelectSqlQuery nvarchar(max)
	DECLARE @ParameterSelectDefinition NVARCHAR(max)
	
	IF(@CheckTypeI3DList = '')
		BEGIN
			SELECT @CheckTypeI3DList = ValueLargeText FROM dbo.ApplicationSettings WHERE I3D = 50002
		END
	IF(@CheckTypeI3DList <> '')
		BEGIN
			DECLARE @CheckTypeI3D varchar(10), @CheckTypePos int
			SET @CheckTypeI3DList = LTRIM(RTRIM(@CheckTypeI3DList))+ ','
			SET @CheckTypePos = CHARINDEX(',', @CheckTypeI3DList, 1)
			IF REPLACE(@CheckTypeI3DList, ',', '') <> ''
			BEGIN
				WHILE @CheckTypePos > 0
					BEGIN
						SET @CheckTypeI3D = LTRIM(RTRIM(LEFT(@CheckTypeI3DList, @CheckTypePos - 1)))
						IF @CheckTypeI3D <> ''
							BEGIN
								INSERT INTO #CheckTypeIDs (CheckI3D) VALUES (CAST(@CheckTypeI3D AS int)) --Use Appropriate conversion
							END
							SET @CheckTypeI3DList = RIGHT(@CheckTypeI3DList, LEN(@CheckTypeI3DList) - @CheckTypePos)
							SET @CheckTypePos = CHARINDEX(',', @CheckTypeI3DList, 1)
					END
			END
		END

	SELECT @OkLastTransaction = Wert FROM dbo.[Stammdat] WITH (NOLOCK) WHERE I3D = 1639
	SELECT @WarningLastTransaction = Wert FROM dbo.[Stammdat] WITH (NOLOCK) WHERE I3D = 1640
	SELECT @ErrorLastTransaction = Wert FROM dbo.[Stammdat] WITH (NOLOCK) WHERE I3D = 1641
	SET @OKCheckStatus = DATEADD(minute, -@OkLastTransaction, @CurrentDatetime)
	SET @WarningCheckStatus = DATEADD(minute, -@WarningLastTransaction, @CurrentDatetime)
	SET @ErrorCheckStatus = DATEADD(minute, -@ErrorLastTransaction, @CurrentDatetime)
	
	IF(@CustomerI3D > 0)
		BEGIN
			INSERT INTO #CheckResultStatus(DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator) 
				SELECT acr.DeviceI3D DeviceID, isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') LastDate,
				CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	'ok'
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 'warning'
						WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = acr.DeviceI3D) = 0 THEN ''
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 'error'
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN ''
						ELSE 'error'
					END AS LastActionResult,
					CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	1
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 3
						WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = acr.DeviceI3D) = 0 THEN 0
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 2
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN 0
						ELSE 2
					END AS CheckStatusIndicator FROM dbo.AssetManagementCheckStatusReports acr WITH (NOLOCK)
					WHERE acr.CustomerI3D IN (@CustomerI3D)
					GROUP BY acr.DeviceI3D
		END
	ELSE IF(@TechnicianI3D > 0)
		BEGIN
			INSERT INTO #CheckResultStatus(DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator) 
				SELECT acr.DeviceI3D DeviceID, isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') LastDate,
				CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	'ok'
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 'warning'
						WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = acr.DeviceI3D) = 0 THEN ''
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 'error'
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN ''
						ELSE 'error'
					END AS LastActionResult,
					CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	1
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 3
						WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = acr.DeviceI3D) = 0 THEN 0
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 2
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN 0
						ELSE 2
					END AS CheckStatusIndicator FROM dbo.AssetManagementCheckStatusReports acr WITH (NOLOCK)
					WHERE acr.CustomerI3D IN (SELECT I3D FROM dbo.Kunden WITH (NOLOCK) 
											WHERE (TechnikerID = @TechnicianI3D OR Techniker2ID = @TechnicianI3D) 
													AND Status = 1 AND (gesperrt IS NULL OR gesperrt = 0))
					GROUP BY acr.DeviceI3D
		END
	ELSE
		BEGIN
			INSERT INTO #CheckResultStatus(DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator) 
				SELECT acr.DeviceI3D DeviceID, isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') LastDate,
				CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	'ok'
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 'warning'
						WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = acr.DeviceI3D) = 0 THEN ''
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 'error'
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN ''
						ELSE 'error'
					END AS LastActionResult,
					CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	1
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 3
						WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = acr.DeviceI3D) = 0 THEN 0
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 2
						WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN 0
						ELSE 2
					END AS CheckStatusIndicator FROM dbo.AssetManagementCheckStatusReports acr WITH (NOLOCK)
					GROUP BY acr.DeviceI3D
		END

	SELECT	@ParameterDefinition = '
		@I3DParameter INT,
		@DeviceI3DParameter INT,
		@DeviceNameSearchParameter nvarchar(256),
		@CheckStatusIDParameter INT,
		@DeviceClassSearchParameter nvarchar(256),
		@DeviceClassConditionSearchParameter nvarchar(256) = Server,
		@CustomerI3DParameter INT,
		@TechnicianI3DParameter INT
	';
						
	SET @DeviceNameSearchValue = '%' + @SearchValue + '%'	

	SET @SqlQuery = 'SELECT   dbo.AssetManagementCheckStatusReports.I3D, dbo.AssetManagementCheckStatusReports.CheckI3D, dbo.AssetManagementCheckStatusReports.CheckName, 
                         dbo.AssetManagementCheckStatusReports.DisplayCheckName, dbo.AssetManagementCheckStatusReports.CheckStatus, dbo.AssetManagementCheckStatusReports.DriveName, 
                         dbo.AssetManagementCheckStatusReports.CheckConfigurationI3D, dbo.AssetManagementCheckStatusReports.CustomerI3D, dbo.Kunden.Name AS CustomerName, 
                         dbo.AssetManagementCheckStatusReports.DeviceI3D, dbo.AssetManagementDevices.ShortName AS DeviceName, dbo.AssetManagementDevices.DeviceClass, dbo.AssetManagementDevices.IsOnline, 
                         dbo.AssetManagementCheckStatusReports.ServiceName, dbo.AssetManagementCheckStatusReports.TransactionTime, dbo.AssetManagementCheckStatusReports.CheckTypeID, T.LastActionDate, 
                         T.LastActionResult, T.CheckStatusIndicator, dbo.AssetManagementCheckStatusReports.Active, dbo.AssetManagementDevices.SystemCrawlerStatus, dbo.AssetManagementDevices.ServiceWorkStatus
						FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) INNER JOIN
                         dbo.AssetManagementDevices WITH (NOLOCK) ON dbo.AssetManagementCheckStatusReports.DeviceI3D = dbo.AssetManagementDevices.I3D INNER JOIN
                         dbo.Kunden WITH (NOLOCK) ON dbo.AssetManagementDevices.KundenI3D = dbo.Kunden.I3D INNER JOIN #CheckResultStatus AS T ON dbo.AssetManagementDevices.I3D = T.DeviceI3D
							WHERE        (dbo.Kunden.Status = 1) AND (dbo.AssetManagementDevices.IsSystemCralwerInstalled = 1) 
							AND (dbo.Kunden.Gesperrt IS NULL OR dbo.Kunden.Gesperrt = 0)  '
	
	IF(@I3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementCheckStatusReports.I3D = @I3DParameter'

	IF(@CustomerI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementCheckStatusReports.CustomerI3D IN (@CustomerI3DParameter)'
	ELSE IF(@TechnicianI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementCheckStatusReports.CustomerI3D IN (SELECT I3D FROM dbo.Kunden WITH (NOLOCK) 
											WHERE (TechnikerID = @TechnicianI3DParameter OR Techniker2ID = @TechnicianI3DParameter) 
													AND Status = 1 AND (gesperrt IS NULL OR gesperrt = 0))'

	IF((SELECT Count(1) FROM #CheckTypeIDs) > 0)
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementCheckStatusReports.CheckTypeID IN (SELECT CheckI3D FROM #CheckTypeIDs)'

	IF(@DeviceI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementCheckStatusReports.DeviceI3D = @DeviceI3DParameter'

	IF(@IsDeviceOnline = 1)
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementDevices.IsOnline = 1'

	IF(@IsSystemCrawlerStatus = 1)
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementDevices.SystemCrawlerStatus = 1'

	IF(@SearchValue <>  '')
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementDevices.ShortName like @DeviceNameSearchParameter'

	IF(@DeviceClass <>  '')
		SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementDevices.DeviceClass = @DeviceClassSearchParameter'

	IF(@CheckStatusID = 4)
		BEGIN
			IF(@IsCheckStatusValidate = 1 AND @CheckStatusID > 0)
				SET @SqlQuery = @SqlQuery + ' AND (dbo.AssetManagementCheckStatusReports.CheckStatus = 2 OR dbo.AssetManagementCheckStatusReports.CheckStatus = 3 OR dbo.AssetManagementCheckStatusReports.CheckStatus = 5)'
		END
	ELSE IF(@CheckStatusID = 2)
		BEGIN
			IF(@IsCheckStatusValidate = 1 AND @CheckStatusID > 0)
				SET @SqlQuery = @SqlQuery + ' AND (dbo.AssetManagementCheckStatusReports.CheckStatus = 2 OR dbo.AssetManagementCheckStatusReports.CheckStatus = 5)'
		END
	ELSE IF(@CheckStatusID = 5)
		BEGIN
			IF(@IsCheckStatusValidate = 1 AND @CheckStatusID > 0)
				SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementCheckStatusReports.CheckStatus = 4'
		END
	ELSE
		BEGIN
			IF(@IsCheckStatusValidate = 1 AND @CheckStatusID > 0)
				SET @SqlQuery = @SqlQuery + ' AND dbo.AssetManagementCheckStatusReports.CheckStatus = @CheckStatusIDParameter'
		END
	IF(@CheckStatusID = 4)
		BEGIN
			SET @SqlQuery = @SqlQuery + ' OR (LOWER(dbo.AssetManagementDevices.DeviceClass) = LOWER(@DeviceClassConditionSearchParameter) AND (T.CheckStatusIndicator = 3 OR T.CheckStatusIndicator = 2 OR T.CheckStatusIndicator = 0))'
		END
		
	INSERT INTO #CheckStatusReport EXEC sp_executeSQL @SqlQuery, @ParameterDefinition, @I3DParameter = @I3D, @DeviceI3DParameter = @DeviceI3D, 
						@DeviceNameSearchParameter = @DeviceNameSearchValue, @CheckStatusIDParameter = @CheckStatusID, @DeviceClassSearchParameter = @DeviceClass, @CustomerI3DParameter = @CustomerI3D, @TechnicianI3DParameter = @TechnicianI3D

	SELECT @TotalRecordCount = count(1) FROM #CheckStatusReport

	SELECT	@ParameterSelectDefinition = '
		@SortOrderColumnParameter nvarchar(256),
		@PageNoParameter INT,
		@RecordsPerPageParameter INT
	';
	SET @SelectSqlQuery = 'SELECT *, ' + CAST(@TotalRecordCount AS VARCHAR) + ' AS TotalRecordCount FROM #CheckStatusReport '
	IF(@IsPaging = 1)
		BEGIN
			IF(@SortDescending = 1)
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' DESC OFFSET (@PageNoParameter-1)*@RecordsPerPageParameter ROWS FETCH NEXT @RecordsPerPageParameter ROWS ONLY'
				END
			ELSE
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' OFFSET (@PageNoParameter-1)*@RecordsPerPageParameter ROWS FETCH NEXT @RecordsPerPageParameter ROWS ONLY'
				END
		END
	ELSE
		BEGIN
			IF(@SortDescending = 1)
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' DESC'
				END
			ELSE
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ''
				END
		END
	
	EXEC sp_executeSQL @SelectSqlQuery, @ParameterSelectDefinition, @SortOrderColumnParameter = @SortOrderColumn, @PageNoParameter = @PageNo, @RecordsPerPageParameter = @RecordsPerPage

	DROP TABLE #CheckResultStatus 
	DROP TABLE #CheckTypeIDs
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetAssetManagementDeviceOverview]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetAssetManagementDeviceOverview]
	@CustomerI3D int = 0,
	@DeviceI3D int = 0,
	@IsDeviceOnline BIT,
	@IsSystemCrawlerStatus BIT,
	@IsSystemCralwerInstalled BIT,
	@SearchValue nvarchar(256),
	@IsPaging BIT,
	@PageNo INT,
	@RecordsPerPage INT,
	@SortOrderColumn nvarchar(256),
	@SortDescending BIT
AS
BEGIN
	CREATE TABLE #DeviceOverviewResult
	(
		I3D INT NOT NULL,
		CustomerI3D INT NULL,
		CustomerName nvarchar(256) NULL,
		ShortName nvarchar(256) NULL,
		LastUpdate datetime NULL,
		DeviceClass nvarchar(256) NULL,
		IsSystemCralwerInstalled bit NULL,
		SystemCrawlerStatus int NOT NULL,
		IsOnline BIT NULL,
		SystemCrawlerNeedToInstall BIT NULL,
		SystemCrawlerVersion nvarchar(20) NULL,
		SystemCrawlerInstalledDate datetime NULL,
		SystemCrawlerUpdatedDate datetime NULL,
		IsSystemCrawlerInstalling bit NOT NULL,
		SystemCrawlerNeedToUnInstall bit NOT NULL,
		IsSystemCrawlerUnInstalling bit NOT NULL,
		LastActionDate DATETIME NULL,
		LastActionResult nvarchar(256) NULL, 
		CheckStatusIndicator int,
		IsSystemCrawlerRestart bit NOT NULL,
		SystemCrawlerRestartLog nvarchar(max) NULL
	)

	CREATE TABLE  #CheckResultStatus 
	(
		DeviceI3D int, 
		LastActionDate datetime, 
		LastActionResult nvarchar(256), 
		CheckStatusIndicator int
	)
	CREATE TABLE  #CheckResult
	(
		DeviceID int,
		LastActionDate datetime, 
		LastActionResult nvarchar(256), 
		CheckStatusIndicator int
	)
	DECLARE @SqlQuery NVARCHAR(max)
	DECLARE @ParameterDefinition NVARCHAR(max)
	DECLARE @DeviceNameSearchValue nvarchar(256)

	DECLARE @OkLastTransaction int = 0
	DECLARE @WarningLastTransaction int = 0
	DECLARE @ErrorLastTransaction int = 0
	DECLARE @CurrentDatetime datetime = GETDATE()
	DECLARE @OKCheckStatus smalldatetime
	DECLARE @WarningCheckStatus smalldatetime
	DECLARE @ErrorCheckStatus smalldatetime
	
	DECLARE @TotalRecordCount int
	DECLARE @SelectSqlQuery nvarchar(max)
	DECLARE @ParameterSelectDefinition NVARCHAR(max)

	SELECT	@ParameterDefinition = '
	@CustomerI3DParameter INT,
	@DeviceI3DParameter INT,
	@DeviceNameSearchParameter nvarchar(256)
	';

	SET @DeviceNameSearchValue = '%' + @SearchValue + '%'	

	SELECT @OkLastTransaction = Wert FROM dbo.[Stammdat] WITH (NOLOCK) WHERE I3D = 1639
	SELECT @WarningLastTransaction = Wert FROM dbo.[Stammdat] WITH (NOLOCK) WHERE I3D = 1640
	SELECT @ErrorLastTransaction = Wert FROM dbo.[Stammdat] WITH (NOLOCK) WHERE I3D = 1641
	SET @OKCheckStatus = DATEADD(minute, -@OkLastTransaction, @CurrentDatetime)
	SET @WarningCheckStatus = DATEADD(minute, -@WarningLastTransaction, @CurrentDatetime)
	SET @ErrorCheckStatus = DATEADD(minute, -@ErrorLastTransaction, @CurrentDatetime)
 
	IF(@CustomerI3D > 0)
		BEGIN
			INSERT INTO #CheckResultStatus(DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator) 
				SELECT AMD.I3D DeviceID, isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') LastActionDate, 
						CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	'ok'
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 'warning'
							WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = AMD.I3D) = 0 THEN ''
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 'error'
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN ''
							ELSE 'error'
						END AS LastActionResult,
						CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	1
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 3
							WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = AMD.I3D) = 0 THEN 0
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 2
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN 0
							ELSE 2
						END AS CheckStatusIndicator FROM dbo.AssetManagementDevices AMD WITH (NOLOCK) 
						LEFT JOIN dbo.AssetManagementCheckStatusReports acr ON AMD.I3D = ACR.DeviceI3D						
						WHERE AMD.KundenI3D IN (@CustomerI3D)
						GROUP BY AMD.I3D
		END
	ELSE
		BEGIN
			INSERT INTO #CheckResultStatus(DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator) 
				SELECT AMD.I3D DeviceID, isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') LastActionDate, 
						CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	'ok'
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 'warning'
							WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = AMD.I3D) = 0 THEN ''
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 'error'
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN ''
							ELSE 'error'
						END AS LastActionResult,
						CASE WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @OKCheckStatus THEN	1
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @WarningCheckStatus THEN 3
							WHEN (SELECT Count(1) FROM AssetManagementCheckStatusReports WHERE CheckStatus IN (1,2,3) AND DeviceI3D = AMD.I3D) = 0 THEN 0
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') > @ErrorCheckStatus THEN 2
							WHEN isnull(max(acr.TransactionTime),'1900-01-01 00:00:00.000') = '1900-01-01 00:00:00.000' THEN 0
							ELSE 2
						END AS CheckStatusIndicator FROM dbo.AssetManagementDevices AMD WITH (NOLOCK) 
						LEFT JOIN dbo.AssetManagementCheckStatusReports acr ON AMD.I3D = ACR.DeviceI3D
						GROUP BY AMD.I3D
		END


	SET @SqlQuery = 'SELECT Dev.I3D, Dev.KundenI3D AS CustomerI3D, K.Name AS CustomerName, Dev.ShortName, Dev.LastUpdate, Dev.DeviceClass, Dev.IsSystemCralwerInstalled, 
						Dev.SystemCrawlerStatus, dev.IsOnline, Dev.SystemCrawlerNeedToInstall, Dev.SystemCrawlerVersion, Dev.SystemCrawlerInstalledDate, 
						Dev.SystemCrawlerUpdatedDate, Dev.IsSystemCrawlerInstalling, Dev.SystemCrawlerNeedToUnInstall, Dev.IsSystemCrawlerUnInstalling, 
						T.LastActionDate, T.LastActionResult, T.CheckStatusIndicator, Dev.IsSystemCrawlerRestart, Dev.SystemCrawlerRestartLog
					FROM dbo.AssetManagementDevices AS Dev WITH (NOLOCK) INNER JOIN 
						dbo.Kunden AS K WITH (NOLOCK) ON K.I3D = dev.KundenI3D INNER JOIN 
						#CheckResultStatus AS T ON dev.I3D = T.DeviceI3D
					WHERE (K.Status = 1) AND (K.Gesperrt IS NULL OR K.Gesperrt = 0)  '
	
	IF(@CustomerI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND Dev.KundenI3D = @CustomerI3DParameter'

	IF(@DeviceI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND Dev.I3D = @DeviceI3DParameter'
		
	IF(@IsDeviceOnline = 1)
		SET @SqlQuery = @SqlQuery + ' AND Dev.IsOnline = 1'
		
	IF(@IsSystemCrawlerStatus = 1)
		SET @SqlQuery = @SqlQuery + ' AND Dev.SystemCrawlerStatus = 1'

	IF(@IsSystemCralwerInstalled = 1)
		SET @SqlQuery = @SqlQuery + ' AND Dev.IsSystemCralwerInstalled = 1'

	IF(@SearchValue <>  '')
		SET @SqlQuery = @SqlQuery + ' AND Dev.ShortName like @DeviceNameSearchParameter'
		
	INSERT INTO #DeviceOverviewResult EXEC sp_executeSQL @SqlQuery, @ParameterDefinition, @CustomerI3DParameter = @CustomerI3D, @DeviceI3DParameter = @DeviceI3D, 
						@DeviceNameSearchParameter = @DeviceNameSearchValue

	SELECT @TotalRecordCount = count(1) FROM #DeviceOverviewResult

	SELECT	@ParameterSelectDefinition = '
		@SortOrderColumnParameter nvarchar(256),
		@PageNoParameter INT,
		@RecordsPerPageParameter INT
	';
	IF(@SortOrderColumn = 'LastActionResultSummary')
		SET @SortOrderColumn = 'CheckStatusIndicator'

	SET @SelectSqlQuery = 'SELECT *, ' + CAST(@TotalRecordCount AS VARCHAR) + ' AS TotalRecordCount FROM #DeviceOverviewResult '
	IF(@IsPaging = 1)
		BEGIN
			IF(@SortDescending = 1)
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' DESC OFFSET (@PageNoParameter-1)*@RecordsPerPageParameter ROWS FETCH NEXT @RecordsPerPageParameter ROWS ONLY'
				END
			ELSE
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' OFFSET (@PageNoParameter-1)*@RecordsPerPageParameter ROWS FETCH NEXT @RecordsPerPageParameter ROWS ONLY'
				END
		END
	ELSE
		BEGIN
			IF(@SortDescending = 1)
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' DESC'
				END
			ELSE
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ''
				END
		END
	
	EXEC sp_executeSQL @SelectSqlQuery, @ParameterSelectDefinition, @SortOrderColumnParameter = @SortOrderColumn, @PageNoParameter = @PageNo, @RecordsPerPageParameter = @RecordsPerPage

	DROP TABLE #CheckResultStatus 
	DROP TABLE #CheckResult
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetCheckResultNotificationDetail]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetCheckResultNotificationDetail]
	@CustomerI3D INT,
	@DeviceI3D INT,
	@CheckTypeI3D INT
AS
BEGIN
	CREATE TABLE #CheckResultNotificationDetail
	(
		CustomerI3D INT NOT NULL,
		DeviceI3D INT NOT NULL,
		CheckTypeTypeI3D INT NOT NULL,
		CheckName nvarchar(256) NULL,
		ShortDescription nvarchar(512) NULL,
		MessageDescription nvarchar(max) NULL,
		LastExecutionDate Datetime NULL,
		LastExecutionStatus nvarchar(20),
		MonitoringEmailTemplate INT NOT NULL,
		EmailTemplateBody ntext,
		EmailTemplateSubject nvarchar(4000)
	)
	CREATE TABLE #AssetManagementCheckResults
	(
		[I3D] [int] NOT NULL,
		[CheckConfigurationID] [int] NOT NULL,
		[State] [nvarchar](50) NOT NULL,
		[Resolved] [nvarchar](50) NULL,
		[Message] [nvarchar](max) NULL,
		[Date] [datetime] NULL,
		[ActualResultValue] [nvarchar](256) NULL,
		[OriginalValue] [nvarchar](256) NULL
	)
	CREATE TABLE #CheckTypeIDs
	(
		CheckI3D int
	)
	
	DECLARE @CheckConfigurationI3D INT
	DECLARE @CheckStatus INT
	DECLARE @CheckStatusName nvarchar(50) = ''
	DECLARE @LastTransactionTime datetime
	DECLARE @CustomerName nvarchar(256)
	DECLARE @DeviceName nvarchar(256)
	DECLARE @ServiceName nvarchar(256)
	DECLARE @CheckResultMessage nvarchar(max) = ''
	DECLARE @CheckInternalResultMessage nvarchar(max)
	DECLARE @CheckName nvarchar(50)
	DECLARE @CheckTypeCount INT
	DECLARE @CheckTypeIndex INT = 0
	DECLARE @EmailTemplateBody nvarchar(max) = ''
	DECLARE @EmailTemplateSubject nvarchar(4000) = ''

	SELECT @EmailTemplateBody = ValueLargeText FROM dbo.ApplicationSettings WITH (NOLOCK) WHERE I3D = 50003
	SELECT @EmailTemplateSubject = ValueText FROM dbo.ApplicationSettings WITH (NOLOCK) WHERE I3D = 50004
	
	SELECT @CustomerName = Name FROM dbo.Kunden WITH (NOLOCK) WHERE I3D = @CustomerI3D
	SELECT @DeviceName = ShortName FROM dbo.AssetManagementDevices WITH (NOLOCK) WHERE I3D = @DeviceI3D	

	SET @EmailTemplateSubject = REPLACE(@EmailTemplateSubject, '@@AffectedCustomerI3D@@', @CustomerI3D)
	SET @EmailTemplateSubject = REPLACE(@EmailTemplateSubject, '@@AffectedCustomer@@', @CustomerName)
	SET @EmailTemplateSubject = REPLACE(@EmailTemplateSubject, '@@AffectedDeviceI3D@@', @DeviceI3D)
	SET @EmailTemplateSubject = REPLACE(@EmailTemplateSubject, '@@AffectedDevice@@', @DeviceName)

	SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@AffectedCustomerI3D@@', @CustomerI3D)
	SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@AffectedCustomer@@', @CustomerName)
	SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@AffectedDeviceI3D@@', @DeviceI3D)
	SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@AffectedDevice@@', @DeviceName)

	IF(@CheckTypeI3D > 0)
		BEGIN
			SELECT @CheckName = CASE WHEN @CheckTypeI3D = 1 THEN 'HardDriveCheck'
									 WHEN @CheckTypeI3D = 2 THEN 'PatchesCheck'
									 WHEN @CheckTypeI3D = 3 THEN 'WindowsServiceCheck'
									 WHEN @CheckTypeI3D = 4 THEN 'AntivirusCheck'
									 WHEN @CheckTypeI3D = 5 THEN 'PingCheck'
									 WHEN @CheckTypeI3D = 6 THEN 'SnmpBackupCheck'
									 WHEN @CheckTypeI3D = 7 THEN 'SqlCheck'
									 WHEN @CheckTypeI3D = 8 THEN 'EventLogCheck'
									 WHEN @CheckTypeI3D = 9 THEN 'PowerShellCheck'
									 WHEN @CheckTypeI3D = 10 THEN 'VendorWarrantyCheck'
									 WHEN @CheckTypeI3D = 11 THEN 'MSBackupCheck'
									 WHEN @CheckTypeI3D = 12 THEN 'BackupStatusCheck'
									 WHEN @CheckTypeI3D = 13 THEN 'HttpCheck'
									 WHEN @CheckTypeI3D = 14 THEN 'SnmpCheck'
									 WHEN @CheckTypeI3D = 15 THEN 'SslCertificateCheck'
									 WHEN @CheckTypeI3D = 16 THEN 'PerformanceCheck'
									 WHEN @CheckTypeI3D = 17 THEN 'LoginFailedCheck'
									 WHEN @CheckTypeI3D = 18 THEN 'SmartCheck'
									 WHEN @CheckTypeI3D = 19 THEN 'FileSizeCheck'
									 WHEN @CheckTypeI3D = 20 THEN 'VmWareCheck'
									 WHEN @CheckTypeI3D = 21 THEN 'HyperVCheck' END
			
			SET @EmailTemplateSubject = REPLACE(@EmailTemplateSubject, '@@CheckTypeID@@', @CheckTypeI3D)
			SET @EmailTemplateSubject = REPLACE(@EmailTemplateSubject, '@@CheckName@@', @CheckName)

			SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@CheckTypeID@@', @CheckTypeI3D)
			SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@CheckName@@', @CheckName)

			SELECT TOP 1 @CheckConfigurationI3D = CheckConfigurationI3D, @CheckStatus = CheckStatus, @CheckStatusName = CASE @CheckStatus WHEN 1 THEN 'OK'
																														WHEN 2 THEN 'Error'
																														WHEN 3 THEN 'Warning'
																														WHEN 4 THEN 'Not RUn'
																														WHEN 5 THEN 'Other' END, @LastTransactionTime = TransactionTime, @ServiceName = ServiceName
					FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK)
					WHERE CustomerI3D = @CustomerI3D AND DeviceI3D = @DeviceI3D AND CheckTypeID = @CheckTypeI3D AND CheckStatus <> 1
					ORDER BY TransactionTime DESC
			INSERT INTO #AssetManagementCheckResults 
				SELECT I3D, CheckConfigurationID, State, Resolved, Message, Date, ActualResultValue, OriginalValue FROM dbo.AssetManagementCheckResults WITH (NOLOCK) WHERE CheckConfigurationID = @CheckConfigurationI3D
				UNION ALL
				SELECT CheckResultID AS I3D, CheckConfigurationID, State, Resolved, Message, Date, ActualResultValue, OriginalValue FROM dbo.AssetManagementCheckResultsHistory WITH (NOLOCK) WHERE CheckConfigurationID = @CheckConfigurationI3D

			IF(@CheckStatus = 4)
				BEGIN
					SET @CheckResultMessage = '<ul><li><span style="text-decoration: underline;"><strong>' + @CheckName + '</strong></span></li></ul><p style="padding-left: 30px;">&nbsp;Name:' + @ServiceName + '</p><p style="padding-left: 30px;">&nbsp;Status: NOT RUN</p><p>&nbsp;&nbsp;</p>'
					
					SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@CheckStatus@@', @CheckStatusName)
					SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@LastActionDate@@', @LastTransactionTime)
					SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@NonOkCheckDetails@@', @CheckResultMessage)
					INSERT INTO #CheckResultNotificationDetail (CustomerI3D, DeviceI3D, CheckTypeTypeI3D, CheckName, ShortDescription, MessageDescription, LastExecutionDate, LastExecutionStatus, MonitoringEmailTemplate, EmailTemplateBody, EmailTemplateSubject)
					SELECT @CustomerI3D, @DeviceI3D, @CheckTypeI3D, @CheckName, @CustomerName + ' : ' + @DeviceName + ' : ' + @CheckName, @CheckResultMessage, @LastTransactionTime, @CheckStatus, 1, @EmailTemplateBody, @EmailTemplateSubject
				END
			ELSE
				BEGIN
					SELECT TOP 1 @CheckResultMessage = '<ul><li><span style="text-decoration: underline;"><strong>' + @CheckName + '</strong></span></li></ul><p style="padding-left: 30px;">&nbsp;Name:' + @ServiceName + '</p><p style="padding-left: 30px;">&nbsp;Status: ' + [Message] + '</p><p>&nbsp;&nbsp;</p>', @LastTransactionTime = [Date] FROM #AssetManagementCheckResults WHERE CheckConfigurationID = @CheckConfigurationI3D ORDER BY [Date] DESC
					SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@CheckStatus@@', @CheckStatusName)
					SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@LastActionDate@@', @LastTransactionTime)
					SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@NonOkCheckDetails@@', @CheckResultMessage)
					INSERT INTO #CheckResultNotificationDetail (CustomerI3D, DeviceI3D, CheckTypeTypeI3D, CheckName, ShortDescription, MessageDescription, LastExecutionDate, LastExecutionStatus, MonitoringEmailTemplate, EmailTemplateBody, EmailTemplateSubject)
					SELECT @CustomerI3D, @DeviceI3D, @CheckTypeI3D, @CheckName, @CustomerName + ' : ' + @DeviceName + ' : ' + @CheckName, @CheckResultMessage, @LastTransactionTime, @CheckStatus, 1, @EmailTemplateBody, @EmailTemplateSubject
				END
		END
	ELSE
		BEGIN
			INSERT INTO #CheckTypeIDs (CheckI3D) SELECT DISTINCT CheckTypeID FROM AssetManagementCheckStatusReports WHERE CustomerI3D = @CustomerI3D AND DeviceI3D = @DeviceI3D
			SELECT @CheckTypeCount = Count(1) FROM #CheckTypeIDs
			WHILE @CheckTypeIndex < @CheckTypeCount
				BEGIN
					SET @CheckConfigurationI3D = 0
					SET @CheckStatus = 0
					SET @CheckStatusName = ''
					SET @ServiceName = ''
					SET @CheckTypeI3D = 0
					SET @CheckName = ''
					SELECT @CheckTypeI3D = CheckI3D FROM #CheckTypeIDs ORDER BY CheckI3D OFFSET @CheckTypeIndex ROWS FETCH NEXT 1 ROWS ONLY
					SELECT @CheckName = CASE WHEN @CheckTypeI3D = 1 THEN 'HardDriveCheck'
									 WHEN @CheckTypeI3D = 2 THEN 'PatchesCheck'
									 WHEN @CheckTypeI3D = 3 THEN 'WindowsServiceCheck'
									 WHEN @CheckTypeI3D = 4 THEN 'AntivirusCheck'
									 WHEN @CheckTypeI3D = 5 THEN 'PingCheck'
									 WHEN @CheckTypeI3D = 6 THEN 'SnmpBackupCheck'
									 WHEN @CheckTypeI3D = 7 THEN 'SqlCheck'
									 WHEN @CheckTypeI3D = 8 THEN 'EventLogCheck'
									 WHEN @CheckTypeI3D = 9 THEN 'PowerShellCheck'
									 WHEN @CheckTypeI3D = 10 THEN 'VendorWarrantyCheck'
									 WHEN @CheckTypeI3D = 11 THEN 'MSBackupCheck'
									 WHEN @CheckTypeI3D = 12 THEN 'BackupStatusCheck'
									 WHEN @CheckTypeI3D = 13 THEN 'HttpCheck'
									 WHEN @CheckTypeI3D = 14 THEN 'SnmpCheck'
									 WHEN @CheckTypeI3D = 15 THEN 'SslCertificateCheck'
									 WHEN @CheckTypeI3D = 16 THEN 'PerformanceCheck'
									 WHEN @CheckTypeI3D = 17 THEN 'LoginFailedCheck'
									 WHEN @CheckTypeI3D = 18 THEN 'SmartCheck'
									 WHEN @CheckTypeI3D = 19 THEN 'FileSizeCheck'
									 WHEN @CheckTypeI3D = 20 THEN 'VmWareCheck'
									 WHEN @CheckTypeI3D = 21 THEN 'HyperVCheck' END
					
					SELECT TOP 1 @CheckConfigurationI3D = CheckConfigurationI3D, @CheckStatus = CheckStatus, @CheckStatusName = CASE @CheckStatus WHEN 1 THEN 'OK'
																														WHEN 2 THEN 'Error'
																														WHEN 3 THEN 'Warning'
																														WHEN 4 THEN 'Not RUn'
																														WHEN 5 THEN 'Other' END, @LastTransactionTime = TransactionTime, @ServiceName = ServiceName
						FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK)
						WHERE CustomerI3D = @CustomerI3D AND DeviceI3D = @DeviceI3D AND CheckTypeID = @CheckTypeI3D AND CheckStatus <> 1
						ORDER BY TransactionTime DESC
					IF(@CheckConfigurationI3D > 0)
					BEGIN
						INSERT INTO #AssetManagementCheckResults 
					
						SELECT I3D, CheckConfigurationID, State, Resolved, Message, Date, ActualResultValue, OriginalValue FROM dbo.AssetManagementCheckResults WITH (NOLOCK) WHERE CheckConfigurationID = @CheckConfigurationI3D
						UNION ALL
						SELECT CheckResultID AS I3D, CheckConfigurationID, State, Resolved, Message, Date, ActualResultValue, OriginalValue FROM dbo.AssetManagementCheckResultsHistory WITH (NOLOCK) WHERE CheckConfigurationID = @CheckConfigurationI3D
						IF(@CheckStatus = 4)
							BEGIN				
								SET @CheckInternalResultMessage = '<ul><li><span style="text-decoration: underline;"><strong>' + @CheckName + '</strong></span></li></ul><p style="padding-left: 30px;">&nbsp;Name:' + @ServiceName + '</p><p style="padding-left: 30px;">&nbsp;Status: NOT RUN</p><p>&nbsp;&nbsp;</p>'
								SET @CheckResultMessage = @CheckResultMessage + '\r\n' + @CheckInternalResultMessage
							END
						ELSE
							BEGIN
							
								SELECT TOP 1 @CheckInternalResultMessage = '<ul><li><span style="text-decoration: underline;"><strong>' + @CheckName + '</strong></span></li></ul><p style="padding-left: 30px;">&nbsp;Name:' + @ServiceName + '</p><p style="padding-left: 30px;">&nbsp;Status: ' + [Message] + '</p><p>&nbsp;&nbsp;</p>', @LastTransactionTime = [Date] FROM #AssetManagementCheckResults WHERE CheckConfigurationID = @CheckConfigurationI3D ORDER BY [Date] DESC
								SET @CheckResultMessage = @CheckResultMessage + '\r\n' + @CheckInternalResultMessage
							END
					END
					SET @CheckTypeIndex = @CheckTypeIndex + 1
				END
				SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@CheckStatus@@', @CheckStatusName)
				SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@LastActionDate@@', @LastTransactionTime)
				SET @EmailTemplateBody = REPLACE(@EmailTemplateBody, '@@NonOkCheckDetails@@', @CheckResultMessage)
				INSERT INTO #CheckResultNotificationDetail (CustomerI3D, DeviceI3D, CheckTypeTypeI3D, CheckName, ShortDescription, MessageDescription, LastExecutionDate, LastExecutionStatus, MonitoringEmailTemplate, EmailTemplateBody, EmailTemplateSubject)
					SELECT @CustomerI3D, @DeviceI3D, 0, '', @CustomerName + ' : ' + @DeviceName, @CheckResultMessage, @LastTransactionTime, @CheckStatus, 1, @EmailTemplateBody, @EmailTemplateSubject
				
		END

	SELECT * FROM #CheckResultNotificationDetail
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetCheckStatusInformation]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetCheckStatusInformation]
	@DeviceI3D int = 0,
	@CustomerI3D int = 0
AS
BEGIN
	DECLARE @ResultTable Table
	(
		CheckStatusID int,
		CheckStatusName nvarchar(20),
		CheckStatusCount int
	)

	DECLARE @SqlQuery NVARCHAR(4000)
	DECLARE @ParameterDefinition NVARCHAR(4000)

	SELECT	@ParameterDefinition = '
	@CustomerParameter INT,
	@DeviceParameter INT
	';

	SET @SqlQuery = 'SELECT dbo.AssetManagementCheckStatusReports.CheckStatus AS CheckStatusID, 
				CASE dbo.AssetManagementCheckStatusReports.CheckStatus WHEN 1 THEN ''Ok'' 
																	   WHEN 2 THEN ''Error'' 
																	   WHEN 3 THEN ''Warning'' 
																	   ELSE ''Not Run'' 
																	   END AS CheckStatusName, 
				Count(1) AS CheckStatusCount FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) INNER JOIN
							dbo.AssetManagementDevices WITH (NOLOCK) ON dbo.AssetManagementCheckStatusReports.DeviceI3D = dbo.AssetManagementDevices.I3D INNER JOIN
							dbo.Kunden WITH (NOLOCK) ON dbo.AssetManagementDevices.KundenI3D = dbo.Kunden.I3D
				WHERE        (dbo.Kunden.Status = 1) AND dbo.AssetManagementDevices.IsSystemCralwerInstalled = 1 AND (dbo.Kunden.Gesperrt IS NULL OR dbo.Kunden.Gesperrt = 0) '
	IF(@CustomerI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND KundenI3D = @CustomerParameter'

	IF(@DeviceI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND DeviceI3D = @DeviceParameter'

	SET @SqlQuery = @SqlQuery + ' GROUP BY dbo.AssetManagementCheckStatusReports.CheckStatus'

	INSERT INTO @ResultTable EXEC sp_executeSQL @SqlQuery, @ParameterDefinition, @CustomerParameter = @CustomerI3D, @DeviceParameter = @DeviceI3D

	IF((SELECT Count(1) FROM @ResultTable WHERE CheckStatusID = 1) <= 0)
	BEGIN
		INSERT INTO @ResultTable (CheckStatusID, CheckStatusName, CheckStatusCount) VALUES (1, 'Ok', 0)
	END
	IF((SELECT Count(1) FROM @ResultTable WHERE CheckStatusID = 2) <= 0)
	BEGIN
		INSERT INTO @ResultTable (CheckStatusID, CheckStatusName, CheckStatusCount) VALUES (2, 'Error', 0)
	END
	IF((SELECT Count(1) FROM @ResultTable WHERE CheckStatusID = 3) <= 0)
	BEGIN
		INSERT INTO @ResultTable (CheckStatusID, CheckStatusName, CheckStatusCount) VALUES (3, 'Warning', 0)
	END
	IF((SELECT Count(1) FROM @ResultTable WHERE CheckStatusID = 4) <= 0)
	BEGIN
		INSERT INTO @ResultTable (CheckStatusID, CheckStatusName, CheckStatusCount) VALUES (4, 'Not Run', 0)
	END

	SELECT * FROM @ResultTable ORDER By CheckStatusID
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetDeployablePackagesByDeviceId]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

        CREATE PROCEDURE [dbo].[procGetDeployablePackagesByDeviceId] 
	        @DeviceI3D INT,
	        @IsPaging bit = 0,
	        @Skip INT = 0,
	        @Take INT = 10000000,
	        @SortDescending BIT = 1
        AS
        BEGIN
	        DECLARE @TotalCount INT = 0

	        SELECT @TotalCount = Count(1) FROM dbo.DeployablePackages 
	         INNER JOIN dbo.DeployablePackageVersion ON dbo.DeployablePackages.I3D = dbo.DeployablePackageVersion.PackageI3D
	         LEFT OUTER JOIN DeployableJobs ON DeployableJobs.PackageI3D = DeployablePackages.I3D
	         LEFT OUTER JOIN DeployablePackageLogs ON DeployablePackageLogs.DeployableJobI3D = DeployableJobs.I3D
	         WHERE DeployableJobs.DeviceI3D = @DeviceI3D OR DeployableJobs.DeviceI3D IS NULL

	         IF(@IsPaging = 1)
		        BEGIN
			        IF(@SortDescending = 1)
				        BEGIN
					        SELECT dbo.DeployablePackages.I3D, dbo.DeployablePackageVersion.I3D AS PackageVersionI3D, DeployableJobs.I3D AS DeployableJobI3D, 
							        DeployablePackageLogs.I3D AS PackageLogI3D, dbo.DeployablePackages.PackageName, dbo.DeployablePackages.Vendor, 
							        dbo.DeployablePackages.Description, dbo.DeployablePackageVersion.Version, dbo.DeployablePackageVersion.PackageID AS PackageDisplayName, 
							        DeployableJobs.InstallationTime, DeployablePackageLogs.LogType, DeployablePackageLogs.LogDescription, @TotalCount AS TotalRecordCount
						        FROM dbo.DeployablePackages 
							        INNER JOIN dbo.DeployablePackageVersion ON dbo.DeployablePackages.I3D = dbo.DeployablePackageVersion.PackageI3D
							        LEFT OUTER JOIN DeployableJobs ON DeployableJobs.PackageI3D = DeployablePackages.I3D
							        LEFT OUTER JOIN DeployablePackageLogs ON DeployablePackageLogs.DeployableJobI3D = DeployableJobs.I3D
							        WHERE DeployableJobs.DeviceI3D = @DeviceI3D OR DeployableJobs.DeviceI3D IS NULL
							        ORDER BY I3D DESC
						            OFFSET @Skip ROWS
						            FETCH NEXT @Take ROWS ONLY
				        END
			        ELSE
				        BEGIN
					        SELECT dbo.DeployablePackages.I3D, dbo.DeployablePackageVersion.I3D AS PackageVersionI3D, DeployableJobs.I3D AS DeployableJobI3D, 
							        DeployablePackageLogs.I3D AS PackageLogI3D, dbo.DeployablePackages.PackageName, dbo.DeployablePackages.Vendor, 
							        dbo.DeployablePackages.Description, dbo.DeployablePackageVersion.Version, dbo.DeployablePackageVersion.PackageID AS PackageDisplayName, 
							        DeployableJobs.InstallationTime, DeployablePackageLogs.LogType, DeployablePackageLogs.LogDescription, @TotalCount AS TotalRecordCount
						        FROM dbo.DeployablePackages 
							        INNER JOIN dbo.DeployablePackageVersion ON dbo.DeployablePackages.I3D = dbo.DeployablePackageVersion.PackageI3D
							        LEFT OUTER JOIN DeployableJobs ON DeployableJobs.PackageI3D = DeployablePackages.I3D
							        LEFT OUTER JOIN DeployablePackageLogs ON DeployablePackageLogs.DeployableJobI3D = DeployableJobs.I3D
							        WHERE DeployableJobs.DeviceI3D = @DeviceI3D OR DeployableJobs.DeviceI3D IS NULL
							        ORDER BY I3D
						            OFFSET @Skip ROWS
						            FETCH NEXT @Take ROWS ONLY
				        END
		        END
	        ELSE
		        BEGIN
			        IF(@SortDescending = 1)
				        BEGIN
					        SELECT dbo.DeployablePackages.I3D, dbo.DeployablePackageVersion.I3D AS PackageVersionI3D, DeployableJobs.I3D AS DeployableJobI3D, 
							        DeployablePackageLogs.I3D AS PackageLogI3D, dbo.DeployablePackages.PackageName, dbo.DeployablePackages.Vendor, 
							        dbo.DeployablePackages.Description, dbo.DeployablePackageVersion.Version, dbo.DeployablePackageVersion.PackageID AS PackageDisplayName, 
							        DeployableJobs.InstallationTime, DeployablePackageLogs.LogType, DeployablePackageLogs.LogDescription, @TotalCount AS TotalRecordCount
						        FROM dbo.DeployablePackages 
							        INNER JOIN dbo.DeployablePackageVersion ON dbo.DeployablePackages.I3D = dbo.DeployablePackageVersion.PackageI3D
							        LEFT OUTER JOIN DeployableJobs ON DeployableJobs.PackageI3D = DeployablePackages.I3D
							        LEFT OUTER JOIN DeployablePackageLogs ON DeployablePackageLogs.DeployableJobI3D = DeployableJobs.I3D
							        WHERE DeployableJobs.DeviceI3D = @DeviceI3D OR DeployableJobs.DeviceI3D IS NULL
							        ORDER BY I3D DESC
				        END
			        ELSE
				        BEGIN
					        SELECT dbo.DeployablePackages.I3D, dbo.DeployablePackageVersion.I3D AS PackageVersionI3D, DeployableJobs.I3D AS DeployableJobI3D, 
							        DeployablePackageLogs.I3D AS PackageLogI3D, dbo.DeployablePackages.PackageName, dbo.DeployablePackages.Vendor, 
							        dbo.DeployablePackages.Description, dbo.DeployablePackageVersion.Version, dbo.DeployablePackageVersion.PackageID AS PackageDisplayName, 
							        DeployableJobs.InstallationTime, DeployablePackageLogs.LogType, DeployablePackageLogs.LogDescription, @TotalCount AS TotalRecordCount
						        FROM dbo.DeployablePackages 
							        INNER JOIN dbo.DeployablePackageVersion ON dbo.DeployablePackages.I3D = dbo.DeployablePackageVersion.PackageI3D
							        LEFT OUTER JOIN DeployableJobs ON DeployableJobs.PackageI3D = DeployablePackages.I3D
							        LEFT OUTER JOIN DeployablePackageLogs ON DeployablePackageLogs.DeployableJobI3D = DeployableJobs.I3D
							        WHERE DeployableJobs.DeviceI3D = @DeviceI3D OR DeployableJobs.DeviceI3D IS NULL
							        ORDER BY I3D
				        END
		        END
        END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetDeviceClassMappingDetails]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetDeviceClassMappingDetails]
	@CustomerI3D INT = 0,
	@TemplateI3D INT = 0
AS
BEGIN
	CREATE TABLE #ResultTable
	(
		I3D INT NOT NULL,
		DeviceName nvarchar(256) NOT NULL,
		DeviceClass nvarchar(256) NULL,
		IsSystemCralwerInstalled BIT NULL,
		CustomerI3D INT NULL,
		TemplateI3D INT NULL,
		IsMapping BIT NOT NULL,
		TotalRecordCount INT NULL
	)
	DECLARE @SqlQuery NVARCHAR(max)
	DECLARE @ParameterDefinition NVARCHAR(max)

	SELECT	@ParameterDefinition = '
	@CustomerI3DParameter INT,
	@TemplateI3DParameter INT
	';

	SET @SqlQuery = 'SELECT Dev.I3D, Dev.ShortName AS DeviceName, Dev.DeviceClass, Dev.IsSystemCralwerInstalled, Dev.KundenI3D AS CustomerI3D, 
					CASE WHEN (Dev.KundenI3D = DevMaps.CustomerI3D) AND Dev.I3D = DevMaps.DeviceI3D THEN DevMaps.TemplateI3D ELSE NULL END TemplateI3D,
					CASE WHEN (Dev.KundenI3D = DevMaps.CustomerI3D) AND Dev.I3D = DevMaps.DeviceI3D THEN 1 ELSE 0 END IsMapping, 0 AS TotalRecordCount 
					FROM dbo.AssetManagementDevices Dev LEFT OUTER JOIN
					dbo.MonitoringTemplateToDeviceMaps DevMaps ON Dev.I3D = DevMaps.DeviceI3D WHERE (1=1) '

	IF(@CustomerI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND Dev.KundenI3D = @CustomerI3DParameter'

	IF(@TemplateI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND DevMaps.TemplateI3D = @TemplateI3DParameter'

	INSERT INTO #ResultTable EXEC sp_executeSQL @SqlQuery, @ParameterDefinition, @CustomerI3DParameter = @CustomerI3D, @TemplateI3DParameter = @TemplateI3D

	SELECT * FROM #ResultTable
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetDeviceLastConnectData]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetDeviceLastConnectData]
	@CustomerI3D INT,
	@DeviceI3D INT
AS
BEGIN
	CREATE TABLE  #CheckResultStatus 
	(
		DeviceI3D int, 
		LastActionDate datetime, 
		LastActionResult nvarchar(256), 
		CheckStatusIndicator int
	)
	CREATE TABLE  #CheckResult
	(
		DeviceID int,
		LastActionDate datetime, 
		LastActionResult nvarchar(256), 
		CheckStatusIndicator int
	)
	DECLARE @SqlQuery NVARCHAR(4000)
	DECLARE @ParameterDefinition NVARCHAR(4000)

	SELECT	@ParameterDefinition = '
	@CustomerParameter INT,
	@DeviceParameter INT
	';
	DECLARE @OkLastTransaction int = 0
	DECLARE @WarningLastTransaction int = 0
	DECLARE @ErrorLastTransaction int = 0
	DECLARE @CurrentDatetime datetime = GETDATE()

	SELECT @OkLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1639
	SELECT @WarningLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1640
	SELECT @ErrorLastTransaction = Wert FROM [Stammdat] WHERE I3D = 1641

	INSERT INTO #CheckResult(DeviceID ,LastActionDate) 
		SELECT amd.I3D Deviceid, isnull(max(acr.date),'1900-01-01 00:00:00.000') LastDate FROM AssetManagementDevices AMD 
		LEFT JOIN AssetManagementCheckConfigurations acc on amd.I3D= acc.DeviceId 
		LEFT JOIN AssetManagementCheckResults acr on acc.i3d= acr.CheckConfigurationID 
		GROUP BY amd.i3d

	INSERT INTO #CheckResultStatus(DeviceI3D, LastActionDate, LastActionResult, CheckStatusIndicator) SELECT DeviceID, LastActionDate, 
					CASE WHEN LastActionDate > DATEADD(minute, -@OkLastTransaction, @CurrentDatetime) THEN	'ok'
						WHEN LastActionDate > DATEADD(minute, -@WarningLastTransaction, @CurrentDatetime) THEN 'warning'
						WHEN LastActionDate > DATEADD(minute, -@ErrorLastTransaction, @CurrentDatetime) THEN 'error'
						WHEN LastActionDate = '1900-01-01 00:00:00.000' THEN ''
						ELSE 'error'
					END AS LastActionResult,
					CASE WHEN LastActionDate > DATEADD(minute, -@OkLastTransaction, @CurrentDatetime) THEN	1
						WHEN LastActionDate > DATEADD(minute, -@WarningLastTransaction, @CurrentDatetime) THEN 3
						WHEN LastActionDate > DATEADD(minute, -@ErrorLastTransaction, @CurrentDatetime) THEN 2
						WHEN LastActionDate = '1900-01-01 00:00:00.000' THEN 0
						ELSE 2
					END AS CheckStatusIndicator FROM #CheckResult 

	SET @SqlQuery = 'SELECT distinct Dev.I3D, Dev.KundenI3D AS CustomerI3D, Dev.ShortName, dev.IsSystemCralwerInstalled, dev.SystemCrawlerVersion, dev.IsOnline, 
	T.CheckStatusIndicator, T.LastActionDate, T.LastActionResult,
	CASE T.CheckStatusIndicator WHEN 0 THEN ''Checks was not run till now''
								WHEN 1 THEN ''OK''
								WHEN 2 THEN ''Device Last Connect Status - Error and Last runtime was - '' + CONVERT(VARCHAR(16), T.LastActionDate, 120)
								WHEN 3 THEN ''Device Last Connect Status - Warning and Last runtime was - '' + CONVERT(VARCHAR(16), T.LastActionDate, 120)
	END AS HelpdeskDescription FROM dbo.Kunden AS K
	INNER JOIN dbo.AssetManagementDevices AS dev ON K.I3D = dev.KundenI3D
	INNER JOIN dbo.AssetManagementCheckConfigurations AS CC ON Dev.I3D = CC.DeviceId 
	INNER JOIN #CheckResultStatus AS T ON dev.I3D = T.DeviceI3D
	WHERE        (K.Status = 1) AND dev.IsSystemCralwerInstalled = 1 AND T.CheckStatusIndicator <> 1 AND (K.Gesperrt IS NULL OR K.Gesperrt = 0) '
	IF(@CustomerI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND KundenI3D = @CustomerParameter'

	IF(@DeviceI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND DeviceI3D = @DeviceParameter'

	SET @SqlQuery = @SqlQuery + ' ORDER BY Dev.I3D'

    EXEC sp_executeSQL @SqlQuery, @ParameterDefinition, @CustomerParameter = @CustomerI3D, @DeviceParameter = @DeviceI3D

	DROP TABLE #CheckResultStatus 
	DROP TABLE #CheckResult
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetDeviceMappingDetails]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetDeviceMappingDetails]
	@CustomerI3D INT = 0,
	@TemplateI3D INT = 0,
	@DeviceName nvarchar(256) = '',
	@IsPaging BIT,
	@PageNo INT,
	@RecordsPerPage INT,
	@SortOrderColumn nvarchar(256),
	@SortDescending BIT
AS
BEGIN
	CREATE TABLE #ResultTable
	(
		I3D INT NOT NULL,
		DeviceName nvarchar(256) NOT NULL,
		DeviceClass nvarchar(256) NULL,
		IsSystemCralwerInstalled BIT NULL,
		CustomerI3D INT NULL,
		TemplateI3D INT NULL,
		IsMapping BIT NOT NULL
	)

	DECLARE @SqlQuery NVARCHAR(max)
	DECLARE @ParameterDefinition NVARCHAR(max)
	DECLARE @DeviceNameSearchValue nvarchar(256)
	DECLARE @DeviceClassValue nvarchar(256)

	DECLARE @TotalRecordCount int
	DECLARE @SelectSqlQuery nvarchar(max)
	DECLARE @ParameterSelectDefinition NVARCHAR(max)

	SELECT	@ParameterDefinition = '
	@CustomerI3DParameter INT,
	@TemplateI3DParameter INT,
	@DeviceNameSearchParameter nvarchar(256)
	';

	SET @DeviceNameSearchValue = '%' + @DeviceName + '%'	

	SET @SqlQuery = 'SELECT Dev.I3D, Dev.ShortName AS DeviceName, Dev.DeviceClass, Dev.IsSystemCralwerInstalled, Dev.KundenI3D AS CustomerI3D, 0 TemplateI3D, 0 IsMapping 
					FROM dbo.AssetManagementDevices Dev WHERE (1=1) '
	IF(@CustomerI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND Dev.KundenI3D = @CustomerI3DParameter'
		
	IF(@DeviceName <>  '')
		SET @SqlQuery = @SqlQuery + ' AND Dev.ShortName like @DeviceNameSearchParameter'

	INSERT INTO #ResultTable EXEC sp_executeSQL @SqlQuery, @ParameterDefinition, @CustomerI3DParameter = @CustomerI3D, @TemplateI3DParameter = @TemplateI3D, @DeviceNameSearchParameter = @DeviceNameSearchValue
		
	IF(@TemplateI3D > 0)
		BEGIN
			UPDATE #ResultTable SET TemplateI3D = @TemplateI3D, IsMapping = 1 WHERE I3D = (SELECT DeviceI3D FROM dbo.MonitoringTemplateToDeviceMaps WHERE TemplateI3D = @TemplateI3D AND DeviceI3D = #ResultTable.I3D)
		END
	SELECT @TotalRecordCount = count(1) FROM #ResultTable
	
	SELECT	@ParameterSelectDefinition = '
		@SortOrderColumnParameter nvarchar(256),
		@PageNoParameter INT,
		@RecordsPerPageParameter INT
	';
	SET @SelectSqlQuery = 'SELECT *, ' + CAST(@TotalRecordCount AS VARCHAR) + ' AS TotalRecordCount FROM #ResultTable '
	IF(@IsPaging = 1)
		BEGIN
			IF(@SortDescending = 1)
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' DESC OFFSET (@PageNoParameter-1)*@RecordsPerPageParameter ROWS FETCH NEXT @RecordsPerPageParameter ROWS ONLY'
				END
			ELSE
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' OFFSET (@PageNoParameter-1)*@RecordsPerPageParameter ROWS FETCH NEXT @RecordsPerPageParameter ROWS ONLY'
				END
		END
	ELSE
		BEGIN
			IF(@SortDescending = 1)
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ' DESC'
				END
			ELSE
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY ' + @SortOrderColumn + ''
				END
		END
	
	EXEC sp_executeSQL @SelectSqlQuery, @ParameterSelectDefinition, @SortOrderColumnParameter = @SortOrderColumn, @PageNoParameter = @PageNo, @RecordsPerPageParameter = @RecordsPerPage
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetMonitoringUserFilterSettingsByUser]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetMonitoringUserFilterSettingsByUser]
	@UserI3D INT,
	@WebPageI3D INT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	IF((SELECT Count(1) FROM dbo.MonitoringUserFilterSettings WITH (NOLOCK) WHERE UserI3D = @UserI3D AND WebPageI3D = @WebPageI3D) = 0)
		BEGIN
			INSERT INTO dbo.MonitoringUserFilterSettings (UserI3D, WebPageI3D, FilterKeyName, FilterKeyValue, CreatedDate, ModifiedDate, IsActive)
			SELECT @UserI3D, @WebPageI3D, FilterKeyName, FilterKeyValue, CreatedDate, NULL, IsActive FROM dbo.MonitoringUserFilterSettings
			WHERE UserI3D = 0 AND WebPageI3D = @WebPageI3D
		END

    SET NOCOUNT OFF;

	SELECT I3D, UserI3D, WebPageI3D, FilterKeyName, FilterKeyValue, CreatedDate, ModifiedDate, IsActive FROM dbo.MonitoringUserFilterSettings
			WHERE UserI3D = @UserI3D AND WebPageI3D = @WebPageI3D
END
       
GO
/****** Object:  StoredProcedure [dbo].[procGetPatchesOverviewByCustomer]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procGetPatchesOverviewByCustomer]
	@CustomerI3D INT,
	@PageNo INT,
	@RecordsPerPage INT,
	@SortDescending BIT,
	@SearchTitle nvarchar(256)
AS
BEGIN
	SET NOCOUNT ON;
	CREATE TABLE #DistinctPatches
	(
		[Title] [nvarchar](512) NULL,
	)
	CREATE TABLE #AssetManagementPatch
	(
		[I3D] [int] NOT NULL,
		[DeviceI3D] [int] NOT NULL,
		[Title] [nvarchar](512) NULL,
		[InstallationResult] [nvarchar](256) NULL,
		[Category] [nvarchar](max) NULL,
		[InstalledDate] [datetime] NULL,
		[NeedToInstall] [bit] NOT NULL DEFAULT ((0)),
		[InstallMessage] [nvarchar](max) NULL,
		[DeviceName] nvarchar(256),
		[DeviceClass] nvarchar(256),
		[DeviceOnline] bit,
		[IsSystemCrawlerInstalled] bit,
		[IsPatchEnabled] bit NOT NULL DEFAULT ((0))
	)
	CREATE TABLE #AssetManagementPatchesOverview
	(
		[I3D] [int] PRIMARY KEY clustered IDENTITY(1,1) NOT NULL,
		[Title] [nvarchar](512) NULL,
		[InstallationResult] [nvarchar](256) NULL,
		[Category] [nvarchar](max) NULL,
		[InstalledDate] [datetime] NULL,
		[NeedToInstall] [bit] NOT NULL DEFAULT ((0)),
		[InstallMessage] [nvarchar](max) NULL,
		[IsPatchEnabled] bit NOT NULL DEFAULT ((0)),
		[DeviceI3D] int NOT NULL,
		[DeviceName] nvarchar(256),
		[DeviceClass] nvarchar(256),
		[DeviceOnline] bit,
		[IsSystemCrawlerInstalled] bit,
	)
	CREATE TABLE #PagingResultData
	(
		[Title] [nvarchar](512)
	)
	DECLARE @PatchRowCount INT = 0
	DECLARE @PatchIndexCount INT = 0
	DECLARE @PatchTitle nvarchar(512)
	DECLARE @InstallationResult [nvarchar](256)
	DECLARE @Category [nvarchar](max)
	DECLARE @InstalledDate [datetime]
	DECLARE @NeedToInstall [bit]
	DECLARE @InstallMessage [nvarchar](max)
	DECLARE @TotalRecordCount int	

	INSERT INTO #AssetManagementPatch(I3D, DeviceI3D, Title, InstallationResult, Category, InstalledDate, NeedToInstall, InstallMessage, 
									  DeviceName, DeviceClass, DeviceOnline, IsSystemCrawlerInstalled, IsPatchEnabled)
	SELECT P.I3D, P.DeviceI3D, P.Title, P.InstallationResult, P.Category, P.InstalledDate, P.NeedToInstall, P.InstallMessage, 
		   Dev.ShortName AS DeviceName, Dev.DeviceClass, Dev.IsOnline AS DeviceOnline, Dev.IsSystemCralwerInstalled AS IsSystemCrawlerInstalled, 
		   CASE WHEN P.NeedToInstall = 1 THEN 1 ELSE 0 END IsPatchEnabled FROM dbo.AssetManagementPatch AS P WITH (NOLOCK) LEFT OUTER JOIN
		   dbo.AssetManagementDevices AS Dev WITH (NOLOCK) ON P.DeviceI3D = Dev.I3D LEFT OUTER JOIN
		   dbo.Kunden AS K WITH (NOLOCK) ON Dev.KundenI3D = K.I3D
		   WHERE (P.InstallationResult = 'Not Installed') AND (K.Status = 1) AND (K.Gesperrt IS NULL OR K.Gesperrt = 0) AND K.I3D = @CustomerI3D
		   	
	IF(@SearchTitle = '')
		BEGIN
			INSERT INTO #DistinctPatches(Title) SELECT DISTINCT Title FROM #AssetManagementPatch
		END
	ELSE
		BEGIN
			INSERT INTO #DistinctPatches(Title) SELECT DISTINCT Title FROM #AssetManagementPatch WHERE Title like '%' + @SearchTitle + '%'
		END

	SELECT @PatchRowCount = Count(1) FROM #DistinctPatches

	WHILE (@PatchIndexCount < @PatchRowCount)
		BEGIN
			SELECT @PatchTitle = Title FROM #DistinctPatches  ORDER BY Title DESC OFFSET @PatchIndexCount ROWS FETCH NEXT 1 ROWS ONLY

			INSERT INTO #AssetManagementPatchesOverview (Title, InstallationResult, Category, InstalledDate, NeedToInstall, InstallMessage, IsPatchEnabled, DeviceI3D, DeviceName, DeviceClass, DeviceOnline, IsSystemCrawlerInstalled)
			SELECT Title, InstallationResult, Category, InstalledDate, NeedToInstall, InstallMessage, IsPatchEnabled, DeviceI3D, DeviceName, DeviceClass, DeviceOnline, IsSystemCrawlerInstalled FROM #AssetManagementPatch 
					WHERE Title = @PatchTitle
			SET @PatchIndexCount = @PatchIndexCount + 1
		END

	SELECT @TotalRecordCount = count(1) FROM #DistinctPatches
	
	IF(@SortDescending = 1)
		BEGIN
			IF(@SearchTitle = '')
				BEGIN
					INSERT INTO #PagingResultData SELECT DISTINCT Title FROM #AssetManagementPatchesOverview ORDER BY Title DESC OFFSET (@PageNo-1)*@RecordsPerPage 
						ROWS FETCH NEXT @RecordsPerPage ROWS ONLY
				END
			ELSE
				BEGIN
					INSERT INTO #PagingResultData SELECT DISTINCT Title FROM #AssetManagementPatchesOverview WHERE Title like '%' + @SearchTitle + '%' ORDER BY Title DESC OFFSET (@PageNo-1)*@RecordsPerPage 
						ROWS FETCH NEXT @RecordsPerPage ROWS ONLY
				END
		END
	ELSE
		BEGIN
			IF(@SearchTitle = '')
				BEGIN
					INSERT INTO #PagingResultData SELECT DISTINCT Title FROM #AssetManagementPatchesOverview ORDER BY Title OFFSET (@PageNo-1)*@RecordsPerPage 
						ROWS FETCH NEXT @RecordsPerPage ROWS ONLY
				END
			ELSE
				BEGIN
					INSERT INTO #PagingResultData SELECT DISTINCT Title FROM #AssetManagementPatchesOverview WHERE Title like '%' + @SearchTitle + '%' ORDER BY Title OFFSET (@PageNo-1)*@RecordsPerPage 
						ROWS FETCH NEXT @RecordsPerPage ROWS ONLY
				END
		END
	
	SET NOCOUNT OFF;
	
	SELECT *, @TotalRecordCount  as 'TotalRecordCount' FROM #AssetManagementPatchesOverview WHERE Title IN (SELECT Title FROM #PagingResultData)
	DROP TABLE #PagingResultData
	DROP TABLE #AssetManagementPatch
	DROP TABLE #DistinctPatches
END
       
GO
/****** Object:  StoredProcedure [dbo].[procInsertAssetManagementCheckResultsHistory]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procInsertAssetManagementCheckResultsHistory] 
AS
BEGIN
  INSERT INTO AssetManagementCheckResultsHistory (CheckResultID, CheckConfigurationID, [State], Resolved, [Message], [Date], ActualResultValue, OriginalValue, HistoryCreatedDate)
  SELECT I3D, CheckConfigurationID, [State], Resolved, [Message], [Date], ActualResultValue, OriginalValue, GetDate() FROM AssetManagementCheckResults WHERE [Date] < GetDate() - 14
  
  DELETE FROM AssetManagementCheckResults WHERE [Date] < GetDate() - 14
  
  exec procInsertAssetManagementCheckStatusReports 0, 0, '', 'DeviceName', 1, 0
END
       
GO
/****** Object:  StoredProcedure [dbo].[procInsertAssetManagementCheckStatusReports]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procInsertAssetManagementCheckStatusReports]
	@DeviceI3D int = 0,
	@CustomerI3D int = 0,
	@DeviceName nvarchar(256) = '',
	@SortOrderColumnName nvarchar(256),
	@SortDescending bit = 1,
	@CheckStatusType int = 2
AS
BEGIN		
	DECLARE @DeviceI3DCheck0 BIT
	DECLARE @DeviceI3DCheck1 BIT = 1
	DECLARE @CustomerI3DCheck0 BIT
	DECLARE @CustomerI3DCheck1 BIT = 1
	DECLARE @DeviceNameCheck0 BIT
	DECLARE @DeviceNameCheck1 BIT = 1

	DECLARE @I3D int
	DECLARE @CheckI3D int
	DECLARE @CheckName nvarchar(256)
	DECLARE @CheckResult nvarchar(256)
	DECLARE @DriveName nvarchar(256) = ''
	DECLARE @ServiceName nvarchar(256) = ''
	DECLARE @TransactionTime datetime
	DECLARE @Active bit
	DECLARE @CheckConfigurationI3D int
	DECLARE @ResultCustomerI3D int
	DECLARE @ResultCustomerName nvarchar(256)
	DECLARE @ResultDeviceI3D int
	DECLARE @ResultDeviceName nvarchar(256)
	DECLARE @ResultDeviceClass nvarchar(256)
	DECLARE @ResultIsOnline bit		
	DECLARE @CheckTypeVerify int
	DECLARE @DeviceGroupCount int
	DECLARE @CheckDeviceGroupCount int = 0
	DECLARE @CheckResultExistsCount int = 0

	-- FOR Device I3D
	IF(@DeviceI3D <= 0) BEGIN SET @DeviceI3DCheck0 = 1 END
	ELSE BEGIN SET @DeviceI3DCheck0 = 0 END

	-- FOR Customer I3D
	IF(@CustomerI3D <= 0) BEGIN SET @CustomerI3DCheck0 = 1 END 
	ELSE BEGIN SET @CustomerI3DCheck0 = 0 END

	-- FOR DeviceName
	IF(@DeviceName = '') BEGIN SET @DeviceNameCheck0 = 1 END 
	ELSE BEGIN SET @DeviceNameCheck0 = 0 END
		
	CREATE TABLE #TempCheckConfigurationOverview
	(
		I3D int NOT NULL Primary Key,
		CheckID int NOT NULL,
		[Status] bit NOT NULL,
		StartTime datetime NULL,
		IntervalKind int NOT NULL,
		IntervalInMinutes int NULL,
		DeviceId int NOT NULL,
		IsNewCheck bit NOT nULL,
		CheckType int NOT NULL,
		NoAlertFrom datetime NULL,
		NoAlertTo datetime NULL,
		IsPicked bit NOT NULL,
		PickedDateTime datetime NULL,
		CustomerI3D int NULL,
		DeviceName nvarchar(256) NULL,
		DeviceClass nvarchar(256) NULL,
		IsOnline bit NULL,
		CustomerName varchar(240) NULL
	)

	CREATE TABLE #AssetManagementCheckResults
	(
		[I3D] [int] NOT NULL,
		[CheckConfigurationID] [int] NOT NULL,
		[State] [nvarchar](50) NOT NULL,
		[Date] [datetime] NULL
	)

	INSERT INTO #TempCheckConfigurationOverview
			SELECT * FROM cvw_AssetManagementCheckConfigurationsOverview CCV WHERE
			CASE WHEN @DeviceI3DCheck0=1 THEN CASE WHEN @DeviceI3DCheck1=1 THEN 1 ELSE 0 END ELSE CASE WHEN CCV.DeviceId=@DeviceI3D THEN 1 ELSE 0 END END=1 AND-- FOR DeviceI3D
			CASE WHEN @CustomerI3DCheck0=1 THEN CASE WHEN @CustomerI3DCheck1=1 THEN 1 ELSE 0 END ELSE CASE WHEN CCV.CustomerI3D=@CustomerI3D THEN 1 ELSE 0 END END=1 AND-- FOR DeviceI3D
			CASE WHEN @DeviceNameCheck0=1 THEN CASE WHEN @DeviceNameCheck1=1 THEN 1 ELSE 0 END ELSE CASE WHEN lower(CCV.DeviceName) like ('%'+@DeviceName+'%') THEN 1 ELSE 0 END END=1 -- FOR DeviceName			
			
	INSERT INTO #AssetManagementCheckResults (I3D, CheckConfigurationID, [State], [Date])
	SELECT I3D, CheckConfigurationID, [State], [Date] FROM AssetManagementCheckResults WHERE CheckConfigurationID IN (SELECT I3D FROM #TempCheckConfigurationOverview)
		
	SELECT @DeviceGroupCount = Count(1) from #TempCheckConfigurationOverview

	WHILE @CheckDeviceGroupCount < @DeviceGroupCount
		BEGIN
			SET @CheckI3D = 0	
			SET @CheckResultExistsCount = 0
			SELECT @Active = [Status], @CheckI3D = CheckID, @I3D = I3D, @CheckTypeVerify = CheckType, @ResultCustomerI3D = CustomerI3D, @ResultCustomerName = CustomerName, 
					@ResultDeviceI3D = DeviceId, @ResultDeviceName = DeviceName, @ResultDeviceClass = DeviceClass, @ResultIsOnline = IsOnline FROM 
					#TempCheckConfigurationOverview ORDER BY DeviceId DESC OFFSET @CheckDeviceGroupCount ROWS FETCH NEXT 1 ROWS ONLY
			SELECT TOP 1 @CheckResultExistsCount = I3D, @CheckResult = [State], @TransactionTime = [Date] FROM #AssetManagementCheckResults WHERE CheckConfigurationID = @I3D ORDER BY I3D DESC
			IF(@CheckResultExistsCount > 0)
				BEGIN
					IF(@CheckTypeVerify = 1)
						BEGIN
							-- Harddrive Check
							SET @CheckName = 'HardDriveCheck'
							SET @DriveName = (SELECT Drive FROM AssetManagementHardDriveChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Disk ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 2)
						BEGIN
							-- Patches Check
							SET @CheckName = 'PatchesCheck'
							SET @ServiceName = 'Patches'
						END
					ELSE IF(@CheckTypeVerify = 3)
						BEGIN
							-- WindowsService Check
							SET @CheckName = 'WindowsServiceCheck'
							SET @DriveName = (SELECT NameOfServices FROM AssetManagementWindowsServiceChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Windows Service ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 4)
						BEGIN
							-- Antivirus Check
							SET @CheckName = 'AntivirusCheck'
							SET @DriveName = (SELECT PerformCheck FROM AssetManagementAntivirusChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Antivirus ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 5)
						BEGIN
							-- Ping Check
							SET @CheckName = 'PingCheck'
							SET @DriveName = (SELECT IPOrComputerName FROM AssetManagementPingChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Ping ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 6)
						BEGIN
							-- SnmpBackup Check
							SET @CheckName = 'SnmpBackupCheck'
							SET @DriveName = (SELECT JobName FROM AssetManagementSNMPBackupChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'SNMPBackup ' + (SELECT Cast(PortNumber AS NVARCHAR) + ' ' + JobName + ' ' + Cast(ISNULL(CommunityString, '') AS NVARCHAR) FROM AssetManagementSNMPBackupChecks WHERE I3D = @CheckI3D)
						END
					ELSE IF(@CheckTypeVerify = 7)
						BEGIN
							-- Sql Check
							SET @CheckName = 'SqlCheck'
							SET @DriveName = (SELECT SqlDatabaseName FROM AssetManagementSQLServerChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'SQL ' + (SELECT SqlInstanceName + ' ' + SqlDatabaseName FROM AssetManagementSQLServerChecks WHERE I3D = @CheckI3D)
						END
					ELSE IF(@CheckTypeVerify = 8)
						BEGIN
							-- EventLog Check
							SET @CheckName = 'EventLogCheck'
							SET @DriveName = (SELECT ProviderName FROM AssetManagementEventLogChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Event Log ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 9)
						BEGIN
							-- PowerShell Check
							SET @CheckName = 'PowerShellCheck'
							SET @DriveName = (SELECT PowerShellScript FROM AssetManagementPowerShellChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'PowerShell ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 10)
						BEGIN
							-- VendorWarranty Check
							SET @CheckName = 'VendorWarrantyCheck'
							SET @DriveName = (SELECT VendorName FROM AssetManagementVendorWarrantyChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'VendorWarranty ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 11)
						BEGIN
							-- MSBackup Check
							SET @CheckName = 'MSBackupCheck'
							SET @DriveName = (SELECT BackupStatus FROM AssetManagementMSBackupChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'MSBackup ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 12)
						BEGIN
							-- BackupStatus Check
							SET @CheckName = 'BackupStatusCheck'
							SET @ServiceName = 'Vendor Backup ' + (SELECT CASE  WHEN ct.BackupTypeI3D = 0 THEN 'Veeam '+ct.ServerName+' '+ct.DatabaseName WHEN ct.BackupTypeI3D = 1
																	THEN 'Symantec '+ct.ServerName+' '+ct.DatabaseName WHEN ct.BackupTypeI3D = 2 THEN 'Arcserve '+ct.ServerName+' '+ct.DatabaseName
																	END FROM [dbo].[AssetManagementBackupStatusChecks] ct WHERE I3D = @CheckI3D)
						END
					ELSE IF(@CheckTypeVerify = 13)
						BEGIN
							-- Http Check
							SET @CheckName = 'HttpCheck'
							SET @DriveName = (SELECT WebsiteUrl FROM AssetManagementHttpChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Http ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 14)
						BEGIN
							-- Snmp Check
							SET @CheckName = 'SnmpCheck'
							SET @DriveName = (SELECT SystemName FROM AssetManagementSnmpMibChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Snmp ' + (SELECT Cast(ISNULL(SystemName, '') AS NVARCHAR) + ' ' + Cast(ISNULL(CommunityString, '') AS NVARCHAR) FROM AssetManagementSnmpMibChecks WHERE I3D = @CheckI3D)
						END
					ELSE IF(@CheckTypeVerify = 15)
						BEGIN
							-- SslCertificate Check
							SET @CheckName = 'SslCertificateCheck'
							SET @DriveName = (SELECT CertificateName FROM AssetManagementSslCertificateChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'SSL Certificate ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 16)
						BEGIN
							-- Performance Check
							SET @CheckName = 'PerformanceCheck'
							SET @DriveName = (SELECT ServiceName FROM AssetManagementPerformanceChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Performance ' + @DriveName
						END
					ELSE IF(@CheckTypeVerify = 17)
						BEGIN
							-- Performance Check
							SET @CheckName = 'LoginFailedCheck'
							SET @DriveName = (SELECT BackDays FROM AssetManagementLoginFailedChecks WHERE I3D = @CheckI3D)
							SET @ServiceName = 'Login Failed ' + @DriveName
						END
						
					SET @CheckConfigurationI3D = @I3D
				END
			ELSE
				BEGIN
					SET @CheckName = CASE @CheckTypeVerify WHEN 1 THEN 'HardDriveCheck' 
															WHEN 2 THEN 'PatchesCheck'
															WHEN 3 THEN 'WindowsServiceCheck'
															WHEN 4 THEN 'AntivirusCheck'
															WHEN 5 THEN 'PingCheck'
															WHEN 6 THEN 'SnmpBackupCheck'
															WHEN 7 THEN 'SqlCheck'
															WHEN 8 THEN 'EventLogCheck'
															WHEN 9 THEN 'PowerShellCheck'
															WHEN 10 THEN 'VendorWarrantyCheck'
															WHEN 11 THEN 'MSBackupCheck'
															WHEN 12 THEN 'BackupStatusCheck'
															WHEN 13 THEN 'HttpCheck'
															WHEN 14 THEN 'SnmpCheck'
															WHEN 15 THEN 'SslCertificateCheck'
															WHEN 16 THEN 'PerformanceCheck'
															WHEN 17 THEN 'LoginFailedCheck'
															END
					SET @CheckI3D = -1
					SET @CheckResult = 'Not Run'
					SET @DriveName = ''
					SET @Active = 1
					SET @CheckConfigurationI3D = @I3D
					SET @TransactionTime = ''
					SET @ServiceName = ''
				END
			
			IF(@DriveName IS NULL)
				BEGIN
					SET @DriveName = ''
				END
			IF(@ServiceName IS NULL)
				BEGIN
					SET @ServiceName = ''
				END
			DECLARE @CheckReportCount int = -1
			DECLARE @CheckResultI3D  int
			DECLARE @TransactionTimeNew datetime
			IF(@TransactionTime = '')
				BEGIN
					SET @TransactionTimeNew = getdate()
				END
			ELSE					
				BEGIN
					SET @TransactionTimeNew = @TransactionTime
				END
			IF(@CheckResult = 'Not Run')
				BEGIN
					SET @CheckResultI3D = 4
				END
			ELSE IF(LOWER(@CheckResult) = 'ok')
				BEGIN
					SET @CheckResultI3D = 1
				END
			ELSE IF(LOWER(@CheckResult) = 'failed' OR LOWER(@CheckResult) = 'error')
				BEGIN
					SET @CheckResultI3D = 2
				END
			ELSE IF(LOWER(@CheckResult) = 'warning')
				BEGIN
					SET @CheckResultI3D = 3
				END
			IF(@TransactionTimeNew IS NULL)
				BEGIN
					SET @TransactionTimeNew = getdate()
				END
			SELECT @CheckReportCount = Count(1) FROM AssetManagementCheckStatusReports WHERE CustomerI3D = @ResultCustomerI3D AND DeviceI3D = @ResultDeviceI3D AND 
									CheckConfigurationI3D = @CheckConfigurationI3D AND CheckTypeID = @CheckTypeVerify
			IF(@CheckReportCount > 0)
				BEGIN
					-- Update
					UPDATE AssetManagementCheckStatusReports SET CheckStatus = @CheckResultI3D, TransactionTime = @TransactionTimeNew, DriveName = @DriveName, ServiceName = @ServiceName WHERE 
							CustomerI3D = @ResultCustomerI3D AND DeviceI3D = @ResultDeviceI3D AND 
							CheckConfigurationI3D = @CheckConfigurationI3D AND CheckTypeID = @CheckTypeVerify
				END
			ELSE
				BEGIN
					-- Add New Record
					INSERT INTO AssetManagementCheckStatusReports(CustomerI3D, DeviceI3D, CheckConfigurationI3D, CheckI3D, CheckTypeID, CheckName, CheckStatus, TransactionTime, DriveName, ServiceName, Active) VALUES
										(@ResultCustomerI3D, @ResultDeviceI3D, @CheckConfigurationI3D, @CheckI3D, @CheckTypeVerify, @CheckName, @CheckResultI3D, @TransactionTimeNew, @DriveName, @ServiceName, @Active)
					
				END
			SET @CheckDeviceGroupCount = @CheckDeviceGroupCount + 1
		END
	SELECT * FROM cvw_AssetManagementCheckStatusReportsOverview ORDER BY 
			CASE @SortDescending WHEN 1 THEN 
				CASE @SortOrderColumnName WHEN 'DeviceName' THEN DeviceName
				END
			END DESC,
			CASE @SortDescending WHEN 0 THEN
				CASE @SortOrderColumnName WHEN 'DeviceName' THEN DeviceName
										    END
			END
END
       
GO
/****** Object:  StoredProcedure [dbo].[procInsertNotificationResponsibleIssues]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procInsertNotificationResponsibleIssues]
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	DECLARE @NotificationCount INT = 0
	DECLARE @NotificationIndex INT = 0
	DECLARE @CheckConfigurationCount INT = 0
	DECLARE @CheckConfigurationIndex INT = 0
	DECLARE @DeviceI3D INT = 0
	DECLARE @CheckConfigurationI3D INT = 0
	DECLARE @CheckTypeI3D INT = 0
	DECLARE @NotificationI3D INT = 0
	DECLARE @DuplicateValue INT = 0

	CREATE TABLE #AssetManagementCheckConfigurations
	(
		[I3D] [int] NOT NULL,
		[CheckID] [int] NOT NULL,
		[Status] [bit] NOT NULL,
		[StartTime] [datetime] NULL,
		[IntervalKind] [int] NOT NULL,
		[IntervalInMinutes] [int] NULL,
		[DeviceId] [int] NOT NULL,
		[IsNewCheck] [bit] NOT NULL,
		[CheckType] [int] NOT NULL,
		[NoAlertFrom] [datetime] NULL,
		[NoAlertTo] [datetime] NULL,
		[IsPicked] [bit] NOT NULL,
		[PickedDateTime] [datetime] NULL
	)

	CREATE TABLE #AssetManagementNotification
	(
		[I3D] [int] NOT NULL,
		[HelpdeskI3D] [int] NULL,
		[CustomerI3D] [int] NULL,
		[DeviceID] [nvarchar](256) NOT NULL,
		[DeviceName] [nvarchar](256) NULL,
		[DeviceURI] [nvarchar](512) NULL,
		[ProbeURI] [nvarchar](512) NULL,
		[AffectedService] [nvarchar](512) NULL,
		[TaskIdent] [nvarchar](256) NULL,
		[QualitativeOldState] [nvarchar](2000) NULL,
		[QualitativeNewState] [nvarchar](128) NULL,
		[TimeOfNotification] [datetime] NULL,
		[TimeOfStateChange] [datetime] NULL,
		[QuantitativeNewState] [ntext] NULL,
		[QuantitativeOldState] [ntext] NULL,
		[OneWayContactI3D] [int] NULL
	)

	INSERT INTO #AssetManagementNotification SELECT AMN.I3D, AMN.[HelpdeskI3D], AMN.[CustomerI3D], AMN.[DeviceID], AMN.[DeviceName], AMN.[DeviceURI], AMN.[ProbeURI], AMN.[AffectedService],
													AMN.[TaskIdent], AMN.[QualitativeOldState], AMN.[QualitativeNewState], AMN.[TimeOfNotification], AMN.[TimeOfStateChange], 
													AMN.[QuantitativeNewState], AMN.[QuantitativeOldState], AMN.[OneWayContactI3D] FROM dbo.AssetManagementNotification AMN WITH (NOLOCK) 
															INNER JOIN dbo.hlpdsk_requests HDK WITH (NOLOCK) ON HDK.I3D = AMN.HelpdeskI3D 
															WHERE ISNUMERIC(AMN.TaskIdent + '.0e0') = 1 AND HDK.Status <> 2

	SELECT @NotificationCount = Count(1) FROM #AssetManagementNotification
	WHILE (@NotificationIndex < @NotificationCount)
	BEGIN
		SELECT @NotificationI3D = I3D, @DeviceI3D = CAST(DeviceID AS int), @CheckTypeI3D = CASE WHEN ISNUMERIC(TaskIdent + '.0e0') = 1 THEN CAST(TaskIdent AS INT) ELSE 0 END FROM #AssetManagementNotification
				 ORDER BY I3D OFFSET @NotificationIndex ROWS FETCH NEXT 1 ROWS ONLY
				IF(@CheckTypeI3D > 0)
				BEGIN
					DELETE FROM #AssetManagementCheckConfigurations
					INSERT INTO #AssetManagementCheckConfigurations SELECT * FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) WHERE DeviceId = @DeviceI3D AND CheckType = @CheckTypeI3D

					SELECT @CheckConfigurationCount = Count(1) FROM #AssetManagementCheckConfigurations
					WHILE (@CheckConfigurationIndex < @CheckConfigurationCount)
					BEGIN
						SET @DuplicateValue = 0
						SELECT @DuplicateValue = Count(1) FROM dbo.AssetManagementNotificationResponsibleIssues WITH (NOLOCK) WHERE NotificationI3D = @NotificationI3D AND CheckConfigurationI3D = @CheckConfigurationI3D
						IF(@DuplicateValue = 0)
						BEGIN
							SELECT @CheckConfigurationI3D = I3D FROM #AssetManagementCheckConfigurations ORDER BY I3D OFFSET @CheckConfigurationIndex ROWS FETCH NEXT 1 ROWS ONLY
							INSERT INTO dbo.AssetManagementNotificationResponsibleIssues (NotificationI3D, CheckConfigurationI3D, Status, Problem, CreatedBy, CreatedDate, ChangedBy, ChangedDate)
							SELECT TOP 1 @NotificationI3D, @CheckConfigurationI3D, State, ISNULL(Message, ''), 'Administrator', GETDATE(), NULL, NULL 
										FROM dbo.AssetManagementCheckResults WITH (NOLOCK) WHERE CheckConfigurationID = @CheckConfigurationI3D ORDER BY Date DESC
						END
						SET @CheckConfigurationIndex = @CheckConfigurationIndex + 1
				END
				SET @CheckConfigurationIndex = 0
			END
		SET @NotificationIndex = @NotificationIndex + 1
	END
    SET NOCOUNT OFF;
END
       
GO
/****** Object:  StoredProcedure [dbo].[procKontingentRest]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[procKontingentRest] 
@VRZI3D int 
AS 
-- Berechnung von RestWert bei Vertragsabrechnung 
BEGIN
DECLARE 
	@KontingentVertrag INT, 
	@RestMitnehmen INT, 
	@VertragKopfI3D INT, 
	@Gebucht Float, 
	@BerechnungVon DateTime, 
	@BerechnungBis DateTime,
	@BerechnungAnfang DateTime,
	@RestWertStartdatum DateTime,
	@KontingentArt INT,
 @NachberechnungArt INT,
 @Verbraucht Float
	SET NOCOUNT ON

	SELECT @VertragKopfI3D = t.VertragI3D 
			,@RestMitnehmen = t.KontingentRestMitnehmen 
			,@BerechnungAnfang = t.GebuchtVon  
			,@KontingentVertrag = t.KontingentVertrag 
			,@NachberechnungArt = t.NachBerechnung
		FROM  
			(SELECT rz.VertragI3D, rz.KontingentRestMitnehmen, 
					  rz.GebuchtVon, vk.KontingentVertrag, 
					  rz.NachBerechnung 
			  FROM VertragRechKopfZuordnung rz 
			  INNER JOIN VertragKopf vk  ON vk.I3D = rz.VertragI3D 
			  WHERE rz.I3D = @VRZI3D ) t 

 IF  @RestMitnehmen = 0 
		UPDATE  VertragRechKopfZuordnung SET KontingentRestWert = 0 WHERE I3D = @VRZI3D  
	ELSE BEGIN  
		SELECT @BerechnungVon  = t.GebuchtVon,   
				 @BerechnungBis = t.GebuchtBis, 
	--			 @NachberechnungArt = t.Nachberechnung, 
				 @Gebucht = t.Gebucht 
		FROM 
			(SELECT TOP 1 rz.GebuchtVon, 
							rz.GebuchtBis, 
						--	rz.Nachberechnung,  
							CASE rz.KontingentRestMitnehmen WHEN 1 THEN ISNULL(rz.KontingentRestWert,0) ELSE 0 END + rz.KontingentWert AS Gebucht 
				FROM VertragRechKopfZuordnung rz 
				WHERE rz.VertragI3D =  @VertragKopfI3D 
					AND rz.Status = 1 
					AND ISNULL(rz.ZwischenRechnung,0) in (0,2,3) 
					AND (ISNULL(rz.NachBerechnung,0) in  (0,2)) 
					AND rz.I3D < @VRZI3D 
				ORDER BY I3D DESC) t 
		IF ISNULL(@BerechnungVon,-1) = -1 BEGIN 
			SET @BerechnungVon = 0 
			SET @BerechnungBis = @BerechnungAnfang - 1 
			SET @Gebucht = 0 
		END 
		ELSE IF @NachberechnungArt = 2 BEGIN  
				SET @BerechnungBis = (SELECT GebuchtBis FROM  VertragRechKopfZuordnung  WHERE I3D = @VRZI3D )  
		END  

     --Nachberechnung 
		SET @Gebucht = @Gebucht +
				(SELECT ISNULL(SUM(KontingentWert),0) 
					FROM VertragRechKopfZuordnung 
					WHERE VertragI3D = @VertragKopfI3D 
						AND Status = 1 
						AND NachBerechnung =1 
						AND GebuchtVon >= @BerechnungVon 
						AND GebuchtVon < @BerechnungBis + 1) 

      --Verbraucht  
		SET @Verbraucht =  
				(SELECT  ISNULL(CASE WHEN KontingentArt = 0 THEN 
									SUM(AusgleichStk* CASE WHEN AnlageArt >4 THEN -1 ELSE 1 END) 
								ELSE  
									SUM(VKKalk* AusgleichStk* CASE WHEN AnlageArt >4 THEN -1 ELSE 1 END) END,0) 
				FROM VertragKontingentAnlagePositionen  
				WHERE VertragKopfI3D=@VertragKopfI3D  
					AND Status <> 0  
					AND AnlageArt > 2 
					AND Datum >= @BerechnungVon 
					AND Datum <  @BerechnungBis +1  
				GROUP BY KontingentArt)  

   	UPDATE  VertragRechKopfZuordnung 
			SET  KontingentRestWert = @Gebucht - ISNULL(@Verbraucht,0)
		WHERE I3D = @VRZI3D
	END -- @RestMitnehmen 
END
      
GO
/****** Object:  StoredProcedure [dbo].[procLizenzverwaltungADDToDo]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[procLizenzverwaltungADDToDo] 
	@RechPosI3D  int, 
	@RechKopfI3D int, 
	@intError int OUTPUT 
AS 
BEGIN 
	SET NOCOUNT ON 
	SET @intError = -1 
	DECLARE @NewDate DateTime, 
			@Rechnummer int, 
			@KundenI3D int, 
			@Kundenname varchar(250), 
			@PersonalI3D int, 
			@BearbeiterI3D int, 
			@AussendienstID int, 
			@ErstellerI3D int, 
			@PosExistInToDoList int, 
			@ArtikelCode varchar(60), 
			@ArtikBez varchar(5000), 
			@ToDoBeschreibung varchar(8000), 
			@Ablaufdatum DateTime, 
			@AblaufdatumStr varchar(10), 
			@Laufzeit int, 
			@KaufdatumStr varchar(10), 
			@Kaufdatum DateTime, 
			@ToleranzInTagen int, 
			@CurDatetime Datetime, 
			@Stk int, 
			@GutStk int, 
			@ToDoBearbeiter int, 
			@AbwBearbeiterAktiv int, 
			@AbwBearbeiter int, 
			@AbwBearbeiterAngelgtAm Datetime,
			@AbwBearbeiterRuckwirkend int,
			@RKDatum Datetime 
 
	DECLARE @CurNewDate CURSOR 
	SET @CurNewDate = CURSOR SCROLL FOR 
		SELECT DATEADD( DAY, -ISNULL(P.ERINNERUNGTAGE, 0), 
				      (DATEADD( MONTH, ISNULL(P.LAUFZEITMONATE, 0), ISNULL(RP.LizenzDatum, RK.DATUM)))) AS DATUMNEU, 
				(DATEADD( MONTH, ISNULL(P.LAUFZEITMONATE, 0), ISNULL(RP.LizenzDatum, RK.DATUM))) AS Ablaufdatum, 
				RK.Nummer, A.ArtikelCode, RK.KundenID, K.Name, A.Artikelbeschreibung, RK.BearbeiterI3D, RK.ErstellerI3D, 
				RK.AussendienstID, SD.WertMemo, RK.Datum, P.LaufzeitMonate, ISNULL(SD1.Wert, 0) AS ToleranzInTagen, RP.Stk, RK.Datum AS RKDatum, 
				ISNULL(SDAbwBearbeiterAktiv.Wert, 0) AS AbwBearbeiterAktiv, 
				ISNULL(SDAbwBearbeiter.Wert, -1) AS AbwBearbeiter, CONVERT(datetime,ISNULL(SDAbwBearbeiter.WertNum,2) - 2) AS AbwBearbeiterAngelegtAm,   
				ISNULL(SDAbwBearbeiterRuckwirkend.Wert, 0) AS AbwBearbeiterRuckwirkend 
		FROM  RECHPOS RP 
		INNER JOIN RECHKOPF RK ON RK.I3D = RP.RECHKOPFI3D 
		INNER JOIN Kunden K ON K.I3D = RK.KundenID 
		INNER JOIN ARTIK A ON RP.ARTIKELI3D = A.I3D 
		INNER JOIN PRODUKTFAMILIE P ON P.I3D = A.PRODUKTFAMILIEI3D AND P.Status = 1 
		INNER JOIN Stammdat SD ON SD.I3D = 1114    -- Beschreibung 
		INNER JOIN Stammdat SD1 ON SD1.I3D = 1122  -- Toleranz in Tagen 
		INNER JOIN Stammdat SDAbwBearbeiterAktiv ON SDAbwBearbeiterAktiv.I3D = 1509 -- Abweichender Bearbeiter aktiv 
		INNER JOIN Stammdat SDAbwBearbeiter ON SDAbwBearbeiter.I3D = 1510 -- Abweichender Bearbeiter 
		INNER JOIN Stammdat SDAbwBearbeiterRuckwirkend ON SDAbwBearbeiterRuckwirkend.I3D = 1615 --sdwLizenzInToDoErzeugenRueckwirkend 
		WHERE RP.I3D = @RechPosI3D AND RP.RECHKOPFI3D = @RechKopfI3D; 
 
	DECLARE @PosInToDoListe CURSOR 
	SET @PosInToDoListe = CURSOR SCROLL FOR 
		SELECT I3D FROM ToDoListe WHERE PosI3D = @RechPosI3D AND Art = 4 AND ObjektArt = 4; 
	OPEN @PosInToDoListe 
 
	FETCH FROM @PosInToDoListe INTO @PosExistInToDoList 
	IF @@FETCH_STATUS <> 0 BEGIN 
		SET @PosExistInToDoList = -1 
	END 
 
	OPEN @CurNewDate 
	FETCH FROM @CurNewDate INTO @NewDate, @Ablaufdatum, @Rechnummer, @ArtikelCode, @KundenI3D,   @Kundenname, @ArtikBez, @BearbeiterI3D, @ErstellerI3D, @AussendienstID, @ToDoBeschreibung, @Kaufdatum, @Laufzeit, @ToleranzInTagen, @Stk, @RKDatum, 
	@AbwBearbeiterAktiv, @AbwBearbeiter, @AbwBearbeiterAngelgtAm , @AbwBearbeiterRuckwirkend  
	CLOSE @CurNewDate 
	IF @@FETCH_STATUS = 0 BEGIN 
		-- Der Text muss zusammen gefügt werden 
		SET @AblaufdatumStr = CAST(DATEPART(dd, @Ablaufdatum) AS VARCHAR(2)) + '.' + CAST(DATEPART(mm, @Ablaufdatum) AS VARCHAR(2)) + '.' + CAST(DATEPART(yyyy, @Ablaufdatum) AS VARCHAR(4)) 
		SET @KaufdatumStr = CAST(DATEPART(dd, @Kaufdatum) AS VARCHAR(2)) + '.' + CAST(DATEPART(mm, @Kaufdatum) AS VARCHAR(2)) + '.' + CAST(DATEPART(yyyy, @Kaufdatum) AS VARCHAR(4)) 
		SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Artikelcode@@', @ArtikelCode) 
		SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Artikelbeschreibung@@', @ArtikBez) 
		SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Lizenzablaufdatum@@', @AblaufdatumStr) 
		SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Kundennummer@@', @KundenI3D) 
		SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Kundenname@@', @Kundenname) 
		SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@LaufzeitMonate@@', @Laufzeit) 
		SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Kaufdatum@@', @KaufdatumStr) 
 
		SET @NewDate = CAST(ROUND(CAST(@NewDate as float) -.5, 0) AS Datetime) 
		SET @CurDatetime = CAST(ROUND(CAST(Getdate() as float) -.5, 0) AS Datetime) 
 
		SET @PersonalI3D = -1 
		IF @AussendienstID > 0 BEGIN 
			SET @PersonalI3D = @AussendienstID 
		END ELSE BEGIN 
			IF @BearbeiterI3D  > 0 BEGIN 
				SET @PersonalI3D = @BearbeiterI3D 
			END ELSE BEGIN 
				SET @PersonalI3D = @ErstellerI3D 
			END 
		END 
		SET @ToDoBearbeiter = CASE WHEN @AbwBearbeiterAktiv = 1 AND @AbwBearbeiter > 0  AND ( @AbwBearbeiterRuckwirkend = 1 OR  @RKDatum > @AbwBearbeiterAngelgtAm) THEN @AbwBearbeiter ELSE @PersonalI3D END 
 
		-- Insert wenn keine Position in der Todo-Liste ist, sonst Update 
		IF ISNULL(@PosExistInToDoList, -1) = -1 BEGIN 
			IF (@NewDate >= DATEADD( DAY, -@ToleranzInTagen, @CurDatetime)) AND (@Stk > 0) BEGIN 
				INSERT INTO ToDoListe 
					(ErstellDatum, ErstellerPersonalI3D, ErstelltVersion, 
					 BearbeitungsDatum, GeaendertVonI3D, GeaendertVersion, 
					 Art, Nummer, Datum, Termin, KundeI3D, Bereich, Kommentar, 
					 BearbeiterI3D, ObjektArt, ObjectI3D, Text, Beschreibung, 
					 Gelesen, Verworfen, ItemCount, ObjektGruppe, PosI3D) 
				VALUES 
					/* Art| 4 = tdeLizenzverwaltung 
					   ObjektArt|4 = Rechnung 	*/ 
					(GetDate(), @PersonalI3D, '', 
					 GetDate(), -1, '', 
					 4, @Rechnummer, GetDate(), @NewDate, @KundenI3D, 'Lizenzverwaltung', 'Lizenz läuft ab.', 
					 @ToDoBearbeiter, 4, @RechKopfI3D, '', SUBSTRING(@ToDoBeschreibung, 1, 254), 
					0, 0, 1, 0, @RechPosI3D) 
 				SET @intError = 0 
			END 
		END ELSE BEGIN --Update 
			SET @GutStk = (SELECT  ISNULL(SUM(GP.Stk),0)	FROM GutPos GP WHERE  GP.UrsprungArt = 4 AND GP.Ursprung = @RechPosI3D ) 
 
			IF (@Stk - @GutStk = 0) OR (@NewDate < DATEADD( DAY, -@ToleranzInTagen, @CurDatetime)) BEGIN 
				DELETE FROM ToDoListe WHERE I3D = @PosExistInToDoList 
			END ELSE BEGIN 
				UPDATE ToDoListe 
					SET	Gelesen = 0, 
							Verworfen = 0 
				 WHERE I3D = @PosExistInToDoList 
					AND (Termin <> @NewDate OR BearbeiterI3D <> @ToDoBearbeiter)
				UPDATE ToDoListe 
					SET BearbeitungsDatum = GETDATE(), 
						 GeaendertVonI3D = @PersonalI3D, 
						 Termin = @NewDate, 
						 BearbeiterI3D = @ToDoBearbeiter, 
						 Beschreibung = SUBSTRING(@ToDoBeschreibung, 1, 254) 
				 WHERE I3D = @PosExistInToDoList 
			END --Stk=0 
	  END --Insert/Update 
	END -- (@@FETCH_STATUS = 0) 
	DEALLOCATE @PosInToDoListe 
	DEALLOCATE @CurNewDate 
END
GO
/****** Object:  StoredProcedure [dbo].[procLizenzverwaltungDeleteToDo]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[procLizenzverwaltungDeleteToDo] 
	@RechPosI3D int, 
	@Rechnung int 
AS 
BEGIN 
	SET NOCOUNT ON 
	DECLARE @Stk InT 
	-- Cursor Deklarieren um die DB nach Informationen abfragen 
	DECLARE @qryStkDiff CURSOR; 
	SET	@qryStkDiff = CURSOR SCROLL FOR 
		SELECT RP.Stk - SUM(GP.Stk) AS Stk 
			FROM GutPos GP 
			INNER JOIN RechPos RP ON GP.Ursprung = RP.I3D 
			WHERE GP.Ursprung = @RechPosI3D AND GP.UrsprungArt = 4
			GROUP BY RP.Stk 
	SELECT @Stk = 0 
	-- Wenn keine Rechnung dann ist das eine Gutschrift, somit brauchen wir die Differenz der Gutgeschriebenen Menge 
	IF (@Rechnung = 0) BEGIN 
		OPEN @qryStkDiff						-- QRY-Oeffnen um die Daten zu bekommen 
		FETCH FROM @qryStkDiff INTO @Stk	-- Hole die Daten aus der Qry in die Variablen 
		CLOSE @qryStkDiff						-- Qry - Datenmenge freigeben 
	END 
	DEALLOCATE @qryStkDiff					-- Variable freigeben 
	-- Wenn der Datensatz aus der RechPos-Tabelle gelöscht wird oder 
	-- komplett Gutgeschrieben ist wird dieser aus der ToDoListe geloescht 
	IF (@Rechnung = 1) OR (@Rechnung = 0 AND @Stk <= 0) BEGIN 
		DELETE FROM ToDoListe WHERE Art = 4 AND ObjektArt = 4 AND PosI3D = @RechPosI3D 
	END 
END 

GO
/****** Object:  StoredProcedure [dbo].[procLizenzverwaltungStammblattADDToDo]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[procLizenzverwaltungStammblattADDToDo] 
	@GeraetePosI3D  int, 
	@GeraeteKopfI3D int, 
	@intError int OUTPUT 
AS 
BEGIN 
	SET NOCOUNT ON 
	SET @intError = -1 
	DECLARE @NewDate DateTime, 
			@Stammblattnummer int, 
			@KundenI3D int, 
			@Kundenname varchar(250), 
			@PersonalI3D int, 
			@PosExistInToDoList int, 
			@ArtikelCode varchar(60), 
			@ArtikBez varchar(5000), 
			@ToDoBeschreibung varchar(8000), 
			@Ablaufdatum DateTime, 
			@AblaufdatumStr varchar(10), 
			@Laufzeit int, 
			@KaufdatumStr varchar(10), 
			@Kaufdatum DateTime, 
			@ToleranzInTagen int, 
			@CurDatetime Datetime, 
			@AbwBearbeiterAktiv int, 
			@AbwBearbeiter int, 
			@Bearbeiter int 

	DECLARE @CurNewDate CURSOR 
	SET @CurNewDate = CURSOR SCROLL FOR 
		SELECT GP.GeraeteKopfI3D, 
				DATEADD( DAY, -ISNULL(P.ERINNERUNGTAGE, 0), 
					  (DATEADD( MONTH, ISNULL(P.LAUFZEITMONATE, 0), GP.KaufDatum))) AS DATUMNEU, 
				(DATEADD( MONTH, ISNULL(P.LAUFZEITMONATE, 0), GP.KaufDatum)) AS Ablaufdatum, 
				A.Artikelcode, A.Artikelbeschreibung, K.I3D, K.Name, GK.ErstellerPersonalI3D, SD.WertMemo, GP.Kaufdatum, P.LaufzeitMonate, ISNULL(SD1.Wert, 0) AS ToleranzInTagen, 
				ISNULL(SDAbwBearbeiterAktiv.Wert, 0) AS AbwBearbeiterAktiv, 
				ISNULL(SDAbwBearbeiter.Wert, -1) AS AbwBearbeiter 
		FROM GeraetePos GP 
		INNER JOIN GeraeteKopf GK ON GK.I3D = GP.GeraeteKopfI3D 
		INNER JOIN Artik A ON GP.ArtikelI3D = A.I3D 
		INNER JOIN Kunden K ON K.I3D = GK.KundenI3D 
		INNER JOIN PRODUKTFAMILIE P ON P.I3D = A.PRODUKTFAMILIEI3D AND P.Status = 1 
		INNER JOIN Stammdat SD ON SD.I3D = 1114    -- Beschreibung 
		INNER JOIN Stammdat SD1 ON SD1.I3D = 1122  -- Toleranz in Tagen 
		INNER JOIN Stammdat SDAbwBearbeiterAktiv ON SDAbwBearbeiterAktiv.I3D = 1509 -- Abweichender Bearbeiter aktiv 
		INNER JOIN Stammdat SDAbwBearbeiter ON SDAbwBearbeiter.I3D = 1510 -- Abweichender Bearbeiter 
		WHERE ISNULL(GP.RechPosI3D, 0) = 0 
			AND GP.GeraeteKopfI3D = @GeraeteKopfI3D 
			AND GP.I3D = @GeraetePosI3D 

	DECLARE @PosInToDoListe CURSOR 
	SET @PosInToDoListe = CURSOR SCROLL FOR 
		SELECT I3D FROM ToDoListe WHERE PosI3D = @GeraetePosI3D AND Art = 4 AND ObjektArt = 25; 
	OPEN @PosInToDoListe 

	FETCH FROM @PosInToDoListe INTO @PosExistInToDoList 
	IF @@FETCH_STATUS <> 0 BEGIN 
		SET @PosExistInToDoList = -1 
	END 

	-- Nur eintragen wenn keine Position in der Todo-Liste ist 
	OPEN @CurNewDate 
	FETCH FROM @CurNewDate INTO @Stammblattnummer, @NewDate, @Ablaufdatum, @ArtikelCode, @ArtikBez, @KundenI3D, @Kundenname, @PersonalI3D, @ToDoBeschreibung, @Kaufdatum, @Laufzeit, @ToleranzInTagen, @AbwBearbeiterAktiv, @AbwBearbeiter 
	CLOSE @CurNewDate 
	SET @Bearbeiter = CASE WHEN @AbwBearbeiterAktiv = 1 AND @AbwBearbeiter > 0 THEN @AbwBearbeiter ELSE @PersonalI3D END 
	SET @AblaufdatumStr = CAST(DATEPART(dd, @Ablaufdatum) AS VARCHAR(2)) + '.' + CAST(DATEPART(mm, @Ablaufdatum) AS VARCHAR(2)) + '.' + CAST(DATEPART(yyyy, @Ablaufdatum) AS VARCHAR(4)) 
	SET @KaufdatumStr = CAST(DATEPART(dd, @Kaufdatum) AS VARCHAR(2)) + '.' + CAST(DATEPART(mm, @Kaufdatum) AS VARCHAR(2)) + '.' + CAST(DATEPART(yyyy, @Kaufdatum) AS VARCHAR(4)) 
	-- Der Text muss zusammen gefügt werden 
	SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Artikelcode@@', @ArtikelCode) 
	SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Artikelbeschreibung@@', @ArtikBez) 
	SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Lizenzablaufdatum@@', @AblaufdatumStr) 
	SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Kundennummer@@', @KundenI3D) 
	SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Kundenname@@', @Kundenname) 
	SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@LaufzeitMonate@@', @Laufzeit) 
	SET @ToDoBeschreibung = REPLACE(@ToDoBeschreibung, '@@Kaufdatum@@', @KaufdatumStr) 

	SET @NewDate = CAST(ROUND(CAST(@NewDate as float) -.5, 0) AS Datetime) 
	SET @CurDatetime = CAST(ROUND(CAST(Getdate() as float) -.5, 0) AS Datetime) 
	IF ISNULL(@PosExistInToDoList, -1) = -1 BEGIN 
		IF (@@FETCH_STATUS = 0) AND (@NewDate >= DATEADD( DAY, -@ToleranzInTagen, @CurDatetime)) BEGIN 
			INSERT INTO ToDoListe 
				(ErstellDatum, ErstellerPersonalI3D, ErstelltVersion, 
				 BearbeitungsDatum, GeaendertVonI3D, GeaendertVersion, 
				 Art, Nummer, Datum, Termin, KundeI3D, Bereich, Kommentar, 
				 BearbeiterI3D, ObjektArt, ObjectI3D, Text, Beschreibung, 
				 Gelesen, Verworfen, ItemCount, ObjektGruppe, PosI3D) 
			VALUES 
				/* Art| 4 = tdeLizenzverwaltung 
				   ObjektArt|25 = Stammblatt 	*/ 
				(GetDate(), @PersonalI3D, '', 
				 GetDate(), -1, '', 
				 4, @Stammblattnummer, GetDate(), @NewDate, @KundenI3D, 'Lizenzverwaltung', 'Lizenz läuft ab.', 
				 @Bearbeiter, 25, @GeraeteKopfI3D, '', SUBSTRING( @ToDoBeschreibung , 1, 254), 
				0, 0, 1, 0, @GeraetePosI3D) 
 			SET @intError = 0 
		END 
	END ELSE BEGIN 
		IF @PosExistInToDoList > 0 BEGIN 
				UPDATE ToDoListe 
					SET	Gelesen = 0, 
							Verworfen = 0 
				 WHERE I3D = @PosExistInToDoList 
					AND (Termin <> @NewDate OR BearbeiterI3D <> @Bearbeiter)
			UPDATE ToDoListe SET 
				BearbeitungsDatum = GetDate(), 
				Nummer = @Stammblattnummer, 
				Datum = GetDate(), 
				Termin = @NewDate, 
				BearbeiterI3D = @Bearbeiter, 
				Beschreibung = SUBSTRING( @ToDoBeschreibung , 1, 254), 
				ItemCount = 1, 
				ObjektGruppe = 0 
			WHERE I3D = @PosExistInToDoList 

 			SET @intError = 0 
		END 
	END 

	DEALLOCATE @PosInToDoListe 
	DEALLOCATE @CurNewDate 
END

GO
/****** Object:  StoredProcedure [dbo].[procSanktionen]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[procSanktionen] 
@KundeI3d INT, 
@Report VARCHAR(5000) OUT 
AS 
BEGIN 
 
DECLARE 
 
@Kunden_Name VARCHAR(240), 
@Anschrif_I3d INT, 
 
@Personen_Ansprech VARCHAR(60), 
@Personen_AnsprechVorname VARCHAR(60), 
 
@AnzahlGefundeneSaetzte INT = 0, 
@AnzahlGesamtGefundeneSaetzte INT = 0, 
@AusgangText VARCHAR(5000) = '', 
@CRLF CHAR(2) = CHAR(13) + CHAR(10), 
 
@PersonenCursor CURSOR 
 
BEGIN 
 
SELECT @Kunden_Name = ISNULL(Kunden.Name,'') FROM Kunden WHERE Kunden.I3D = @KundeI3d 
 
SELECT @AnzahlGefundeneSaetzte = COUNT(*) FROM SanctionOrganisations WHERE LTRIM(RTRIM(UPPER(ISNULL(Name,'')))) = LTRIM(RTRIM(UPPER('@Kunden_Name'))) 
 
IF @AnzahlGefundeneSaetzte = 0 
SELECT @AnzahlGefundeneSaetzte = COUNT(*) FROM SanctionPersons WHERE LTRIM(RTRIM(UPPER(ISNULL(Firstname,'')))) = LTRIM(RTRIM(UPPER('@Kunden_Name'))) 
 
IF @AnzahlGefundeneSaetzte = 0 
SELECT @AnzahlGefundeneSaetzte = COUNT(*) FROM SanctionPersons WHERE LTRIM(RTRIM(UPPER(ISNULL(Lastname,'')))) = LTRIM(RTRIM(UPPER('@Kunden_Name'))) 
 
SET @AusgangText = 'Kundenname: "' + @Kunden_Name + '"' ; 
 
IF (@AnzahlGefundeneSaetzte > 0) 
SET @AusgangText = @AusgangText + ' ist verdächtig.' 
ELSE 
SET @AusgangText = @AusgangText + ' ist nicht verdächtig.' 
 
SET @AusgangText = @AusgangText + @CRLF 
 
SET @AnzahlGesamtGefundeneSaetzte = @AnzahlGesamtGefundeneSaetzte + @AnzahlGefundeneSaetzte 
 
SET @PersonenCursor = CURSOR SCROLL FOR 
SELECT 
Ansprech, AnsprechVorname 
FROM 
Personen 
WHERE 
(Personen.AnschriftID IN (SELECT I3D FROM Anschrif WHERE (Kunde = @KundeI3d) AND (Status = 1) ) ) AND (Status = 1) 
ORDER BY Ansprech, AnsprechVorname 
 
OPEN @PersonenCursor 
 
FETCH FIRST FROM @PersonenCursor INTO @Personen_Ansprech, @Personen_AnsprechVorname 
 
WHILE (@@FETCH_STATUS = 0) 
BEGIN 
 
SELECT @AnzahlGefundeneSaetzte = COUNT(*) FROM SanctionPersons 
WHERE 
( 
LTRIM(RTRIM(UPPER(ISNULL(SanctionPersons.Firstname,'')))) = LTRIM(RTRIM(UPPER(ISNULL(@Personen_AnsprechVorname,'')))) 
AND 
LTRIM(RTRIM(UPPER(ISNULL(SanctionPersons.Lastname,'')))) = LTRIM(RTRIM(UPPER(ISNULL(@Personen_Ansprech,'')))) 
) 
OR 
( 
LTRIM(RTRIM(UPPER(ISNULL(SanctionPersons.Firstname,'')))) = LTRIM(RTRIM(UPPER(ISNULL(@Personen_Ansprech,'')))) 
AND 
LTRIM(RTRIM(UPPER(ISNULL(SanctionPersons.Lastname,'')))) = LTRIM(RTRIM(UPPER(ISNULL(@Personen_AnsprechVorname,'')))) 
) 
 
SET @AnzahlGesamtGefundeneSaetzte = @AnzahlGesamtGefundeneSaetzte + @AnzahlGefundeneSaetzte 
 
SET @AusgangText = @AusgangText + 'Person: "' + @Personen_AnsprechVorname + '; '+ @Personen_Ansprech +'"' 
 
IF (@AnzahlGefundeneSaetzte > 0) 
SET @AusgangText = @AusgangText + ' ist verdächtig.' 
ELSE 
SET @AusgangText = @AusgangText + ' ist nicht verdächtig.' 
 
SET @AusgangText = @AusgangText + @CRLF 
 
FETCH NEXT FROM @PersonenCursor INTO @Personen_Ansprech, @Personen_AnsprechVorname 
END 
 
 
 
IF @AnzahlGesamtGefundeneSaetzte = 0 
SET @report = '' 
ELSE 
SET @Report = RTRIM(@AusgangText) 
 
 
END 
END 
GO
/****** Object:  StoredProcedure [dbo].[procServiceConnectorLogOverviews]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procServiceConnectorLogOverviews] 
	@I3D INT = 0,
	@DeviceI3D INT = 0,
	@CustomerI3D INT = 0,
	@LogType nvarchar(256) = '',
	@DeviceName nvarchar(256) = '',
	@CustomerName nvarchar(256) = '',
	@IsPaging bit = 0,
	@Skip INT = 10000000,
	@Take INT = 10000000,
	@SortDescending BIT = 1
AS
BEGIN

SET NOCOUNT ON

	CREATE TABLE  #CheckResultStatus 
	(
		I3D INT NOT NULL, 
		DeviceI3D INT NOT NULL,
		CustomerI3D INT NOT NULL, 
		LogType nvarchar(256) NOT NULL, 
		LogMessage nvarchar(max) NOT NULL, 
		Exception nvarchar(max) NULL,
		LogDate nvarchar(256) NOT NULL, 
		CustomerName nvarchar(256) NULL, 
		DeviceName nvarchar(256) NULL,
		TotalRecordCount INT NOT NULL
	)

	DECLARE @TotalRecordCount INT
	DECLARE @SqlQuery NVARCHAR(max)
	DECLARE @ParameterDefinition NVARCHAR(max)
	DECLARE @DeviceNameSearchValue nvarchar(256)
	DECLARE @CustomerNameSearchValue nvarchar(256)
	
	DECLARE @SelectSqlQuery nvarchar(max)
	DECLARE @ParameterSelectDefinition NVARCHAR(max)

	SELECT	@ParameterDefinition = '
		@I3DParameter INT,
		@DeviceI3DParameter INT,
		@CustomerI3DParameter INT,
		@LogTypeParameter nvarchar(256),
		@DeviceNameSearchParameter nvarchar(256),
		@CustomerNameSearchParameter nvarchar(256)
	';
						
	SET @DeviceNameSearchValue = '%' + @DeviceName + '%'
	SET @CustomerNameSearchValue = '%' + @CustomerName + '%'

	SET @SqlQuery = 'SELECT DISTINCT SCL.I3D, SCL.DeviceI3D, SCL.CustomerI3D, SCL.LogType, SCL.LogMessage, SCL.Exception, 
					COALESCE (REPLACE(CONVERT(VARCHAR(16), SCL.LogDate, 120), ''-'' + RIGHT(''0'' + RTRIM(MONTH(SCL.LogDate)), 2) + 
					''-'', '' '' + DATENAME(MM, SCL.LogDate) + '' ''), ''Not Run'') AS LogDate, 
					Cust.Name AS CustomerName, CASE WHEN SCL.DeviceI3D > 0 THEN Device.ShortName ELSE '' '' END AS DeviceName, 0 AS TotalRecordCount 
					FROM dbo.AssetManagementServiceConnectorLogs AS SCL WITH (NOLOCK) INNER JOIN
					dbo.Kunden AS Cust WITH (NOLOCK) ON SCL.CustomerI3D = Cust.I3D INNER JOIN
					dbo.AssetManagementDevices AS Device WITH (NOLOCK) ON SCL.DeviceI3D = Device.I3D WHERE (1=1) '
	IF(@I3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND SCL.I3D = @I3DParameter'

	IF(@CustomerI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND Cust.I3D = @CustomerI3DParameter'

	IF(@DeviceI3D > 0)
		SET @SqlQuery = @SqlQuery + ' AND Device.I3D = @DeviceI3DParameter'

	IF(@LogType <> '')
		SET @SqlQuery = @SqlQuery + ' AND lower(SCL.LogType) = @LogTypeParameter'

	IF(@DeviceName <> '')
		SET @SqlQuery = @SqlQuery + ' AND lower(Device.ShortName) like @DeviceNameSearchValue'

	IF(@CustomerName <> '')
		SET @SqlQuery = @SqlQuery + ' AND lower(Cust.Name) like @CustomerNameSearchParameter'

	INSERT INTO #CheckResultStatus EXEC sp_executeSQL @SqlQuery, @ParameterDefinition, @I3DParameter = @I3D, @DeviceI3DParameter = @DeviceI3D, @CustomerI3DParameter = @CustomerI3D,
							@LogTypeParameter = @LogType, @DeviceNameSearchParameter = @DeviceNameSearchValue, @CustomerNameSearchParameter = @CustomerNameSearchValue

	SELECT @TotalRecordCount = count(1) FROM #CheckResultStatus

	UPDATE #CheckResultStatus SET TotalRecordCount = @TotalRecordCount

	SET NOCOUNT OFF

	SELECT	@ParameterSelectDefinition = '
			@PageNoParameter INT,
			@RecordsPerPageParameter INT
	';
	SET @SelectSqlQuery = 'SELECT *, ' + CAST(@TotalRecordCount AS VARCHAR) + ' AS TotalRecordCount FROM #CheckResultStatus '
	IF(@IsPaging = 1)
		BEGIN
			IF(@SortDescending = 1)
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY I3D DESC OFFSET @PageNoParameter ROWS FETCH NEXT @RecordsPerPageParameter ROWS ONLY'
				END
			ELSE
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY I3D OFFSET @PageNoParameter ROWS FETCH NEXT @RecordsPerPageParameter ROWS ONLY'
				END
		END
	ELSE
		BEGIN
			IF(@SortDescending = 1)
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY I3D DESC'
				END
			ELSE
				BEGIN
					SET @SelectSqlQuery = @SelectSqlQuery + ' ORDER BY I3D'
				END
		END
	
	EXEC sp_executeSQL @SelectSqlQuery, @ParameterSelectDefinition, @PageNoParameter = @Skip, @RecordsPerPageParameter = @Take
END
       
GO
/****** Object:  StoredProcedure [dbo].[procStroreHlpDsk_bearbeiter]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procStroreHlpDsk_bearbeiter] 
	 @RequestI3D  int, 
	 @setBearbeiterI3D varchar(1000), 
  @LogUserI3d int, 
  @Version varchar(50), 
  @oaHelpdesk int = 10, 
	 @Art int = 8 
	AS 
BEGIN 
 	SET NOCOUNT ON; 
	DECLARE @AbgeschlosseneStatus int, 
         @Status int, 
         @KundeI3D int, 
			  @VerantwortlicherI3D int, 
         @Kommentar varchar(500), 
         @Beschreibung varchar(255), 
			  @Nummer int, 
         @Termin datetime, 
         @sSql varchar(1200), 
         @nBearbeiterI3D int, 
         @nKomaPos int,  
         @nToDoI3D int, 
         @bBezitzer int  

  SELECT  @AbgeschlosseneStatus = wert  FROM stammdat WHERE I3D=696	--SDW-Konstante "Abgeschlossene Status" 
-- aus HlpDsk_requests holen 
  SELECT @Status  = ISNULL(Status,0), 
         @KundeI3D = kundeI3D, 
         @VerantwortlicherI3D = VerantwortlicherI3D, 
         @Kommentar = Beschreibung, 
			  @Beschreibung = Problem, 
         @Nummer = nummer, 
         @Termin = Faelligam 
    FROM HlpDsk_requests WHERE I3D = @RequestI3D 

-- für geschlossene ToDoI3d löschen  
  if @Status = @AbgeschlosseneStatus  
     UPDATE hlpdsk_requests  
        SET ToDoI3D = 0 
      WHERE I3D = @RequestI3D 

  IF SUBSTRING(@setBearbeiterI3D,1,1) = ',' SET @setBearbeiterI3D = SUBSTRING(@setBearbeiterI3D,2,LEN(@setBearbeiterI3D)-1) 

--  hlpdsk_request_bearbeiter delete  
  if @Status != @AbgeschlosseneStatus BEGIN
     SET @sSql = 'DELETE FROM hlpdsk_request_bearbeiter 
      					WHERE RequestI3D = ' + LTRIM(STR(@RequestI3D)) + 
                 '	AND NOT PersonalI3D IN ('+ @setBearbeiterI3D + ')' 
      EXECUTE(@sSql) 
 END 
  ELSE 
     UPDATE hlpdsk_request_bearbeiter  
        SET ToDoI3D = 0  
      WHERE RequestI3D = @RequestI3D 
  if @@Error != 0  RAISERROR('procStroreHlpDsk_bearbeiter :  Fehler bei "DELETE FROM hlpdsk_request_bearbeiter"', 16,1) 

    SET @bBezitzer = 0  
  if CHARINDEX(Ltrim(str(@VerantwortlicherI3D)), @setBearbeiterI3D) = 0 
     SET @setBearbeiterI3D =  @setBearbeiterI3D+','+Ltrim(str(@VerantwortlicherI3D)) 
  ELSE SET @bBezitzer = 1 

-- toDoListe delete 
  SET @sSql =  'DELETE FROM ToDoListe 
                 WHERE Objektart = '+LTRIM(STR(@oaHelpdesk)) +  
               ' AND ObjectI3D = '+LTRIM(STR(@RequestI3D))  
  if @Status != @AbgeschlosseneStatus BEGIN 
    SET @sSql = @sSql + ' AND	BearbeiterI3D NOT IN ('+@setBearbeiterI3D+')'  
    SET @sSql = @sSql + ' AND	BearbeiterI3D != '+ LTRIM(STR(@VerantwortlicherI3D))  
  END  
  execute(@sSql) 
  if @@Error != 0  RAISERROR('procStroreHlpDsk_bearbeiter :  Fehler bei "DELETE FROM ToDoListe"', 16,1) 

  SET @nKomaPos = CHARINDEX(',', @setBearbeiterI3D) 
  WHILE @Status != @AbgeschlosseneStatus BEGIN  
    IF @nKomaPos = 0 SET @nBearbeiterI3D = cast(@setBearbeiterI3D as Integer)  
    ELSE BEGIN 
         SET @nBearbeiterI3D   = CAST( SUBSTRING(@setBearbeiterI3D,1,@nKomaPos-1) as Integer) 
         SET @setBearbeiterI3D = SUBSTRING(@setBearbeiterI3D,@nKomaPos+1,LEN(@setBearbeiterI3D)-@nKomaPos) 
    END 
    IF EXISTS (SELECT 1 FROM  ToDoListe 
               WHERE Objecti3d = @RequestI3D AND ObjektArt = @oaHelpdesk AND BearbeiterI3D = @nBearbeiterI3D AND nummer =@Nummer) BEGIN 
         UPDATE ToDoListe SET Kommentar = @Kommentar, 
                              Beschreibung = @Beschreibung, 
                              Termin = @Termin, 
                              GeaendertVonI3D = @LogUserI3d, 
                              BearbeitungsDatum = getdate(), 
                              GeaendertVersion = @Version 
         WHERE Objecti3d = @RequestI3D AND ObjektArt = @oaHelpdesk AND BearbeiterI3D = @nBearbeiterI3D AND nummer =@Nummer 
    if @@Error != 0  RAISERROR('procStroreHlpDsk_bearbeiter :  Fehler bei "Update ToDoListe"', 16,1) 
    END ELSE BEGIN   
      INSERT INTO ToDoListe (ErstellDatum, ErstellerPersonalI3D, ErstelltVersion, 
                             BearbeitungsDatum, GeaendertVonI3D, GeaendertVersion, 
                             Art, Nummer, Datum, Termin, KundeI3D, Bereich, 
                             Kommentar,   BearbeiterI3D, ObjektArt, ObjectI3D,  
                             Beschreibung, Gelesen, Verworfen, ItemCount, ObjektGruppe)  
      VALUES  (getdate(), 
               @LogUserI3d, 
               @Version, 
               getdate(), 
               @LogUserI3d, 
               @Version, 
               @Art, 
               @Nummer, 
               getdate(), 
               @Termin, 
               @KundeI3D, 
               'HelpDesk', 
               @Kommentar, 
               @nBearbeiterI3D, 
               @oaHelpdesk, 
               @RequestI3D, 
               @Beschreibung, 
               0, 
               0, 
               1, 
               0) 
    if @@Error != 0  RAISERROR('procStroreHlpDsk_bearbeiter :  Fehler bei "Insert ToDoListe"', 16,1) 
    END 
    if @nKomaPos = 0 BREAK 
    SET @nKomaPos = CHARINDEX(',', @setBearbeiterI3D) 
  END --While 

  SET @sSql = 'INSERT INTO hlpdsk_request_bearbeiter  
               (RequestI3D, PersonalI3D, PersonalTyp, ToDoI3D, IsAccepted) 
                SELECT Objecti3d,	BearbeiterI3D, 1, I3D, 0 
                  FROM ToDoListe  
                 WHERE Objecti3d =' + LTRIM(STR(@RequestI3D)) + 
                 ' AND ObjektArt = '+ LTRIM(STR(@oaHelpdesk)) +  
                 ' AND nummer = '+LTRIM(STR(@Nummer)) + 
						 ' AND NOT BearbeiterI3D IN (Select PersonalI3D FROM hlpdsk_request_bearbeiter WHERE RequestI3D = ' + LTRIM(STR(@RequestI3D)) + ')' 
  IF  @bBezitzer = 0  
        SET @sSql = @sSql + ' AND BearbeiterI3D !='+LTRIM(STR(@VerantwortlicherI3D)) 
  EXECUTE(@sSql)  
	if @@Error != 0  RAISERROR('procStroreHlpDsk_bearbeiter :  Fehler bei "Insert hlpdsk_request_bearbeiter"', 16,1)  
END
      
GO
/****** Object:  StoredProcedure [dbo].[procUpdateApplicationNotificationSettings]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procUpdateApplicationNotificationSettings]
	@SendWarningNotification BIT,
	@SendTechnicianNotification BIT,
	@SendWorkStationNotification BIT,
	@SendSnmpOtherNotification BIT,
	@IsDeviceIgnoreLastConnectNotificationActive BIT
  
AS
BEGIN
	SET NOCOUNT ON;
	DECLARE @ApplicationNotificationSettings TABLE
	(
		SendWarningNotification BIT NOT NULL,
		SendTechnicianNotification BIT NOT NULL,
		SendWorkStationNotification BIT NOT NULL,
		SendSnmpOtherNotification BIT NOT NULL,
		IsDeviceIgnoreLastConnectNotificationActive BIT NOT NULL
	)

	UPDATE dbo.ApplicationSettings SET ValueBool = @SendWarningNotification WHERE I3D = 10012;
	UPDATE dbo.ApplicationSettings SET ValueBool = @SendTechnicianNotification WHERE I3D = 10013;
	UPDATE dbo.ApplicationSettings SET ValueBool = @SendWorkStationNotification WHERE I3D = 50000;
	UPDATE dbo.ApplicationSettings SET ValueBool = @SendSnmpOtherNotification WHERE I3D = 10023;
	UPDATE dbo.ApplicationSettings SET ValueBool = @IsDeviceIgnoreLastConnectNotificationActive WHERE I3D = 50024;

	INSERT INTO @ApplicationNotificationSettings (SendWarningNotification, SendTechnicianNotification, SendWorkStationNotification, SendSnmpOtherNotification, IsDeviceIgnoreLastConnectNotificationActive)
										VALUES (@SendWarningNotification, @SendTechnicianNotification, @SendWorkStationNotification, @SendSnmpOtherNotification, @IsDeviceIgnoreLastConnectNotificationActive)
	SET NOCOUNT OFF;

	SELECT * FROM @ApplicationNotificationSettings
END
       
GO
/****** Object:  StoredProcedure [dbo].[procUpdateApplicationSmtpSettings]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procUpdateApplicationSmtpSettings]
	@MailSmtpUseAuth INT,
	@MailSmtpUseAuthValue INT,
	@MailSmtpUserName INT,
	@MailSmtpUserNameValue nvarchar(256),
	@MailSmtpPassword INT,
	@MailSmtpPasswordValue nvarchar(256),
	@MailSmtpHost INT,
	@MailSmtpHostValue nvarchar(256),
	@MailSmtpPort INT,
	@MailSmtpPortValue INT,
	@MailSmtpTimeout INT,
	@MailSmtpTimeoutValue INT
AS
BEGIN
	SET NOCOUNT ON;
	DECLARE @SmtpSettings TABLE
	(
		SmtpMailUseAuthentication INT,
		SmtpMailUserName nvarchar(256),
		SmtpMailPassword nvarchar(256),
		SmtpMailHost nvarchar(256),
		SmtpMailPort INT,
		SmtpMailTimeout INT
	)

	UPDATE Stammdat SET Wert = @MailSmtpUseAuthValue WHERE I3D = @MailSmtpUseAuth;
	UPDATE Stammdat SET WertText = @MailSmtpUserNameValue WHERE I3D = @MailSmtpUserName;
	UPDATE Stammdat SET WertText = @MailSmtpPasswordValue WHERE I3D = @MailSmtpPassword;
	UPDATE Stammdat SET WertText = @MailSmtpHostValue WHERE I3D = @MailSmtpHost;
	UPDATE Stammdat SET Wert = @MailSmtpPortValue WHERE I3D = @MailSmtpPort;
	UPDATE Stammdat SET Wert = @MailSmtpTimeoutValue WHERE I3D = @MailSmtpTimeout;

	INSERT INTO @SmtpSettings (SmtpMailUseAuthentication, SmtpMailUserName, SmtpMailPassword, SmtpMailHost, SmtpMailPort, SmtpMailTimeout) VALUES
	(@MailSmtpUseAuthValue, @MailSmtpUserNameValue, @MailSmtpPasswordValue, @MailSmtpHostValue, @MailSmtpPortValue, @MailSmtpTimeoutValue)

	SET NOCOUNT OFF;

	SELECT * FROM @SmtpSettings
END
       
GO
/****** Object:  StoredProcedure [dbo].[procUpdateAssetManagementCheckStatusReport]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procUpdateAssetManagementCheckStatusReport]
AS
BEGIN
	SET NOCOUNT ON;

	UPDATE dbo.AssetManagementCheckStatusReports SET DisplayCheckName = CheckName WHERE CheckTypeID <> 14 AND DisplayCheckName IS NULL

	-- For Harddrive Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 1 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 1)
																WHERE CheckTypeID = 1 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 1 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 1 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(Drive, '') FROM dbo.AssetManagementHardDriveChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 1 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 1 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Disk ' + Drive, '') FROM dbo.AssetManagementHardDriveChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 1 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END Harddrive Check

	-- For Patches Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 2 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 2)
																WHERE CheckTypeID = 2 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 2 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 2 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = 'PatchesCheck' WHERE CheckTypeID = 2 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 2 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = 'Patches' WHERE CheckTypeID = 2 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END Patches Check

	-- For WindowsServiceCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 3 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 3)
																WHERE CheckTypeID = 3 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 3 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 3 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(NameOfServices, '') FROM dbo.AssetManagementWindowsServiceChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 3 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 3 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Windows Service ' + NameOfServices, '') FROM dbo.AssetManagementWindowsServiceChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 3 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END WindowsServiceCheck Check

	-- For Antivirus Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 4 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 4)
																WHERE CheckTypeID = 4 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 4 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 4 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT CASE PerformCheck WHEN 1 THEN 'true' ELSE 'false' END FROM dbo.AssetManagementAntivirusChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 4 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 4 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT CASE PerformCheck WHEN 1 THEN 'Antivirus true' ELSE 'Antivirus false' END FROM dbo.AssetManagementAntivirusChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 4 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END Antivirus Check

	-- For Ping Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 5 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 5)
																WHERE CheckTypeID = 5 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 5 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 5 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(IPOrComputerName, '') FROM dbo.AssetManagementPingChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 5 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 5 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Ping ' + IPOrComputerName, '') FROM dbo.AssetManagementPingChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 5 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END Ping Check

	-- For SnmpBackupCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 6 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 6)
																WHERE CheckTypeID = 6 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 6 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 6 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(JobName, '') FROM dbo.AssetManagementSNMPBackupChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 6 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 6 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('SNMPBackup ' + JobName + ' ' + CommunityString, '') FROM dbo.AssetManagementSNMPBackupChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 6 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END SnmpBackupCheck Check

	-- For SqlCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 7 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 7)
																WHERE CheckTypeID = 7 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 7 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 7 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(SqlDatabaseName, '') FROM dbo.AssetManagementSQLServerChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 7 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 7 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('SQL ' + SqlInstanceName + ' ' + SqlDatabaseName, '') FROM dbo.AssetManagementSQLServerChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 7 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END SqlCheck Check

	-- For EventLogCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 8 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 8)
																WHERE CheckTypeID = 8 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 8 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 8 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(ProviderName, '') FROM dbo.AssetManagementEventLogChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 8 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 8 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Event Log ' + ProviderName, '') FROM dbo.AssetManagementEventLogChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 8 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END EventLogCheck Check

	-- For PowerShellCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 9 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 9)
																WHERE CheckTypeID = 9 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 9 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 9 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(PowerShellScript, '') FROM dbo.AssetManagementPowerShellChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 9 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 9 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('PowerShell ' + PowerShellScript, '') FROM dbo.AssetManagementPowerShellChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 9 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END PowerShellCheck Check

	-- For VendorWarrantyCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 10 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 10)
																WHERE CheckTypeID = 10 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 10 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 10 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(VendorName, '') FROM dbo.AssetManagementVendorWarrantyChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 10 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 10 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('VendorWarranty ' + VendorName, '') FROM dbo.AssetManagementVendorWarrantyChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 10 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END VendorWarrantyCheck Check

	-- For MSBackupCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 11 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 11)
																WHERE CheckTypeID = 11 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 11 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 11 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(BackupStatus, '') FROM dbo.AssetManagementMSBackupChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 11 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 11 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('MSBackup ' + BackupStatus, '') FROM dbo.AssetManagementMSBackupChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 11 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END MSBackupCheck Check

	-- For BackupStatusCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 12 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 12)
																WHERE CheckTypeID = 12 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 12 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 12 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = 'BackupStatusCheck'
				WHERE CheckTypeID = 12 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 12 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT CASE BackupTypeI3D WHEN 0 THEN 'Veeam ' + ServerName + ' ' + DatabaseName 
																								  WHEN 2 THEN 'Symantec ' + ServerName + ' ' + DatabaseName 
																								  WHEN 3 THEN 'Acronis ' + ServerName + ' ' + DatabaseName 
																								  WHEN 4 THEN 'Arcserve ' + ServerName + ' ' + DatabaseName END 
																FROM dbo.AssetManagementBackupStatusChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 12 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END BackupStatusCheck Check

	-- For HttpCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 13 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 13)
																WHERE CheckTypeID = 13 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 13 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 13 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(WebsiteUrl, '') FROM dbo.AssetManagementHttpChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 13 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 13 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Http ' + WebsiteUrl, '') FROM dbo.AssetManagementHttpChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 13 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END HttpCheck Check

	-- For SnmpCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 14 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 14)
																WHERE CheckTypeID = 14 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 14 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 14 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT SystemName FROM dbo.AssetManagementSnmpMibChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 14 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 14 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT 'Snmp - ' + SystemName + ' - ' + CommunityString FROM dbo.AssetManagementSnmpMibChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 14 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END SnmpCheck Check

	-- For SslCertificateCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 15 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 15)
																WHERE CheckTypeID = 15 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 15 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 15 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(CertificateName, '') FROM dbo.AssetManagementSslCertificateChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 15 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 15 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Ssl Certificate ' + CertificateName, '') FROM dbo.AssetManagementSslCertificateChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 15 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END SslCertificateCheck Check

	-- For PerformanceCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 16 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 16)
																WHERE CheckTypeID = 16 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 16 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 16 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(ServiceName, '') FROM dbo.AssetManagementPerformanceChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 16 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 16 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Performance ' + ServiceName, '') FROM dbo.AssetManagementPerformanceChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 16 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END PerformanceCheck Check

	-- For LoginFailedCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 17 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 17)
																WHERE CheckTypeID = 17 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 17 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 17 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(CAST(BackDays AS NVARCHAR), '') FROM dbo.AssetManagementLoginFailedChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 17 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 17 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('LoginFailed ' + CAST(BackDays AS NVARCHAR), '') FROM dbo.AssetManagementLoginFailedChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 17 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END LoginFailedCheck Check

	-- For SmartCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 18 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 18)
																WHERE CheckTypeID = 18 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 18 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 18 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(PhysicalDriveName, '') FROM dbo.AssetManagementSmartChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 18 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 18 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Smart ' + PhysicalDriveName, '') FROM dbo.AssetManagementSmartChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 18 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END SmartCheck Check

	-- For FileSizeCheck Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 19 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 19)
																WHERE CheckTypeID = 19 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 19 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 19 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL([FileName], '') FROM dbo.AssetManagementFileSizeChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 19 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 19 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('FileSize ' + [FileName], '') FROM dbo.AssetManagementFileSizeChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 19 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END FileSizeCheck Check
	-- For VmWare Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 20 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 20)
																WHERE CheckTypeID = 20 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 20 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 20 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = 
														  ((SELECT ISNULL(VMM.VMName + ' - ' + CASE WHEN VMC.CategoryTypeI3D = 3 THEN 'Snapshots' END, '') FROM dbo.AssetManagementVmWareChecks VMC WITH (NOLOCK)
														  INNER JOIN dbo.AssetManagementVMMachines VMM WITH (NOLOCK) ON (VMC.VmMachineI3D = VMM.I3D)
														  WHERE VMC.I3D = AssetManagementCheckStatusReports.CheckI3D)
														  UNION
														  (SELECT ISNULL(CASE WHEN VMC.CategoryTypeI3D = 1 THEN 'CPU' 
																			  WHEN VMC.CategoryTypeI3D = 2 THEN 'Memory'
																			  WHEN VMC.CategoryTypeI3D = 4 THEN 'Luns'
																			  WHEN VMC.CategoryTypeI3D = 5 THEN 'Alarms' END, '') FROM dbo.AssetManagementVmWareChecks VMC WITH (NOLOCK)
														  WHERE VMC.I3D = AssetManagementCheckStatusReports.CheckI3D))
				WHERE CheckTypeID = 20 AND (DriveName IS NULL OR DriveName = '') 

		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 20 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = ((SELECT ISNULL(VMM.VMName + ' - ' + CASE WHEN VMC.CategoryTypeI3D = 3 THEN 'Snapshots' END, '') FROM dbo.AssetManagementVmWareChecks VMC WITH (NOLOCK)
														  INNER JOIN dbo.AssetManagementVMMachines VMM WITH (NOLOCK) ON (VMC.VmMachineI3D = VMM.I3D)
														  WHERE VMC.I3D = AssetManagementCheckStatusReports.CheckI3D)
														  UNION
														  (SELECT ISNULL(CASE WHEN VMC.CategoryTypeI3D = 1 THEN 'CPU' 
																			  WHEN VMC.CategoryTypeI3D = 2 THEN 'Memory'
																			  WHEN VMC.CategoryTypeI3D = 4 THEN 'Luns'
																			  WHEN VMC.CategoryTypeI3D = 5 THEN 'Alarms' END, '') FROM dbo.AssetManagementVmWareChecks VMC WITH (NOLOCK)
														  WHERE VMC.I3D = AssetManagementCheckStatusReports.CheckI3D))
				WHERE CheckTypeID = 20 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END VmWare Check

	-- For HyperV Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 21 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 21)
																WHERE CheckTypeID = 21 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 21 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 21 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(HVCS.ElementName + ' - ' + CASE WHEN HVC.CategoryTypeI3D = 1 THEN 'CPU'
														  WHEN HVC.CategoryTypeI3D = 2 THEN 'Memory'
														  WHEN HVC.CategoryTypeI3D = 3 THEN 'Snapshots'
														  WHEN HVC.CategoryTypeI3D = 4 THEN 'Luns' END, '') FROM dbo.AssetManagementHyperVChecks HVC WITH (NOLOCK)
														  INNER JOIN dbo.AssetManagementHVComputerSystems HVCS WITH (NOLOCK) ON (HVC.ComputerSystemI3D = HVCS.I3D)
														  WHERE HVC.I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 21 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 21 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL(HVCS.ElementName + ' - ' + CASE WHEN HVC.CategoryTypeI3D = 1 THEN 'CPU'
														  WHEN HVC.CategoryTypeI3D = 2 THEN 'Memory'
														  WHEN HVC.CategoryTypeI3D = 3 THEN 'Snapshots'
														  WHEN HVC.CategoryTypeI3D = 4 THEN 'Luns' END, '') FROM dbo.AssetManagementHyperVChecks HVC WITH (NOLOCK)
														  INNER JOIN dbo.AssetManagementHVComputerSystems HVCS WITH (NOLOCK) ON (HVC.ComputerSystemI3D = HVCS.I3D)
														  WHERE HVC.I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 21 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END HyperV Check

	-- For Application Check
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 22 AND CheckI3D = -1) > 0)
	BEGIN
		UPDATE dbo.AssetManagementCheckStatusReports SET CheckI3D = (SELECT CheckID FROM dbo.AssetManagementCheckConfigurations WITH (NOLOCK) 
																WHERE I3D = AssetManagementCheckStatusReports.CheckConfigurationI3D AND CheckType = 22)
																WHERE CheckTypeID = 22 AND CheckI3D = -1
	END
	IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 22 AND CheckI3D = -1) <= 0)
	BEGIN
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 22 AND (DriveName IS NULL OR DriveName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET DriveName = (SELECT ISNULL(ApplicationName, '') FROM dbo.AssetManagementApplicationChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 22 AND (DriveName IS NULL OR DriveName = '') 
		END
		IF((SELECT Count(1) FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE CheckTypeID = 22 AND (ServiceName IS NULL OR ServiceName = '')) > 0)
		BEGIN
			UPDATE dbo.AssetManagementCheckStatusReports SET ServiceName = (SELECT ISNULL('Application ' + [ApplicationName], '') FROM dbo.AssetManagementApplicationChecks WITH (NOLOCK) WHERE I3D = AssetManagementCheckStatusReports.CheckI3D)
				WHERE CheckTypeID = 22 AND (ServiceName IS NULL OR ServiceName = '') 
		END
	END
	-- END Application Check
	
	SET NOCOUNT OFF;

	SELECT * FROM dbo.AssetManagementCheckStatusReports WITH (NOLOCK) WHERE I3D = 1
END
       
GO
/****** Object:  StoredProcedure [dbo].[procUpdateSnmpCheckDisplayName]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procUpdateSnmpCheckDisplayName]
AS
BEGIN
	DECLARE @CheckName VARCHAR(500)
	DECLARE @I3D INT
	
	-- Insert the Check Results data to Temp table:
	SELECT * INTO #TempCheck FROM (SELECT SnmpMibChecks.I3D, 'Snmp - ' + IsNull(ProviderName,'') AS CheckName FROM AssetManagementSnmpMibDetails SnmpMibDetails
	INNER JOIN AssetManagementSnmpMibOidDetails SnmpMibOidDetails ON SnmpMibOidDetails.SnmpMibI3D = SnmpMibDetails.I3D
	INNER JOIN AssetManagementSnmpMibChecks SnmpMibChecks ON SnmpMibChecks.SnmpOidI3D = SnmpMibOidDetails.I3D WHERE SnmpMibChecks.DisplayName = '' OR SnmpMibChecks.DisplayName IS NULL) filteredTable

	DECLARE db_cursor CURSOR FOR SELECT I3D, CheckName FROM #TempCheck
	OPEN db_cursor FETCH NEXT FROM db_cursor INTO @I3D, @CheckName
		WHILE @@FETCH_STATUS = 0
			BEGIN		
				UPDATE AssetManagementSnmpMibChecks SET DisplayName = @CheckName WHERE I3D = @I3D		
				FETCH NEXT FROM db_cursor INTO @I3D, @CheckName
			END
	CLOSE db_cursor
	DEALLOCATE db_cursor

	DROP TABLE #TempCheck
END
       
GO
/****** Object:  StoredProcedure [dbo].[procValidateMonitoringHelpdesk]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[procValidateMonitoringHelpdesk]
	@CheckConfigurationI3D INT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	DECLARE @AssetManagementCheckResults TABLE
	(
		[I3D] [int] NOT NULL,
		[CheckConfigurationID] [int] NOT NULL,
		[State] [nvarchar](50) NOT NULL,
		[Resolved] [nvarchar](50) NULL,
		[Message] [nvarchar](max) NULL,
		[Date] [datetime] NULL,
		[ActualResultValue] [nvarchar](256) NULL,
		[OriginalValue] [nvarchar](256) NULL
	)
    --DECLARE @CheckI3D INT = 0
	DECLARE @BackExecutionTime INT = 0

	SELECT @BackExecutionTime = BackExecutionTimes FROM dbo.AssetManagementPerformanceChecks PC WITH (NOLOCK) INNER JOIN dbo.AssetManagementCheckConfigurations CC WITH (NOLOCK) ON PC.I3D = CC.CheckID
	WHERE CC.I3D = @CheckConfigurationI3D

	INSERT INTO @AssetManagementCheckResults
		SELECT I3D, CheckConfigurationID, State, Resolved, Message, Date, ActualResultValue, OriginalValue FROM dbo.AssetManagementCheckResults WITH (NOLOCK) 
			WHERE CheckConfigurationID = @CheckConfigurationI3D		
		UNION ALL
		SELECT CheckResultID AS I3D, CheckConfigurationID, State, Resolved, Message, Date, ActualResultValue, OriginalValue FROM dbo.AssetManagementCheckResultsHistory WITH (NOLOCK) 
			WHERE CheckConfigurationID = @CheckConfigurationI3D 		
	
	SET NOCOUNT OFF;
	SELECT TOP (@BackExecutionTime) * FROM @AssetManagementCheckResults ORDER BY I3D DESC
END
       
GO
/****** Object:  StoredProcedure [dbo].[spGetRechKopfNegativDB]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE procedure [dbo].[spGetRechKopfNegativDB]

as


select top 100
dbo.Filiale.FilialName,
Personal.Name as ADM,
ROUND(RechKopf.SummeEK, 2) as SummeEK, 
ROUND(RechKopf.Netto, 2) as Netto, 
RechKopf.Netto - RechKopf.SummeEK as DB,
ROUND(RechKopf.Brutto, 2) as Brutto, 
RechKopf.Ansprech, 
RechKopf.Empfanger, 
RechKopf.Nummer, 
RechKopf.KurzZeich, 
RechKopf.ProjNr, 
RechKopf.Datum, RechKopf.*

from RechKopf
inner join Kunden on RechKopf.KundenID = Kunden.I3D
inner join Personal on Kunden.AussendienstID = Personal.I3D
inner join dbo.Filiale on dbo.Personal.FilialI3D = dbo.Filiale.I3D
where (RechKopf.Netto - RechKopf.SummeEK) < 0 and dbo.Filiale.I3D != 11
order by GeaendertDatum desc


--SELECT 

--[I3D],
--[FilialName],
--[ADM],
--[SummeEK],
--[Netto],
--[Brutto],
--[DB],
--[Ansprech],
--[Empfanger],
--[Nummer],
--[KurzZeich],
--[ProjNr],
--[Datum]
-- FROM [RechKopfNegativDB]
-- GROUP BY
--[I3D],
--[FilialName],
--[ADM],
--[SummeEK],
--[Netto],
--[Brutto],
--[DB],
--[Ansprech],
--[Empfanger],
--[Nummer],
--[KurzZeich],
--[ProjNr],
--[Datum]

--EXEC spClearRechKopfNegativDBTable
GO
/****** Object:  StoredProcedure [dbo].[spGetRechKopfNegativDBByToday]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


CREATE procedure [dbo].[spGetRechKopfNegativDBByToday]

as


select top 100
dbo.Filiale.FilialName,
Personal.Name as ADM,
ROUND(RechKopf.SummeEK, 2) as SummeEK, 
ROUND(RechKopf.Netto, 2) as Netto, 
RechKopf.Netto - RechKopf.SummeEK as DB,
ROUND(RechKopf.Brutto, 2) as Brutto, 
RechKopf.Ansprech, 
RechKopf.Empfanger, 
RechKopf.Nummer, 
RechKopf.KurzZeich, 
RechKopf.ProjNr, 
RechKopf.Datum

from RechKopf
inner join Kunden on RechKopf.KundenID = Kunden.I3D
inner join Personal on Kunden.AussendienstID = Personal.I3D
inner join dbo.Filiale on dbo.Personal.FilialI3D = dbo.Filiale.I3D
where (RechKopf.Netto - RechKopf.SummeEK) < 0 and dbo.Filiale.I3D != 11
and DAY(RechKopf.ErstelltDatum) = DAY(GETDATE())
and MONTH(RechKopf.ErstelltDatum) = MONTH(GETDATE())
and YEAR(RechKopf.ErstelltDatum) = YEAR(GETDATE())

order by ErstelltDatum desc



GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaComment]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spr_SocialMediaComment]
	@EmployeeI3D int,
	@SocialMediaI3D int,
	@SocialMediaKind int,
	@Text nvarchar(MAX),
	@Date datetime = null
AS
BEGIN
	SET NOCOUNT ON;

	if LTRIM(ISNULL(@Text,'')) = '' begin
		return 0;
	end;
	if ISNULL(@SocialMediaI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaComment : No Social Media I3D providet', 16,1) 
		return @@ERROR
	end;

	if @EmployeeI3D <= 0
		SET @EmployeeI3D = null;

	DECLARE
		@ActionI3D int = null,
		@StreamI3D int = null

	if @SocialMediaKind = 0 begin
		if not exists(SELECT 1 FROM SocialMediaStream WHERE I3D = @SocialMediaI3D) begin
			RAISERROR('spr_SocialMediaComment : No record found for the stream I3D', 16,1) 
			return @@ERROR
		end;
		SET @StreamI3D = @SocialMediaI3D;
	end else if @SocialMediaKind = 1 begin
		if not exists(SELECT 1 FROM SocialMediaAction WHERE I3D = @SocialMediaI3D) begin
			RAISERROR('spr_SocialMediaComment : No record found for the action I3D', 16,1) 
			return @@ERROR
		end;
		SET @ActionI3D = @SocialMediaI3D;
	end;
	if @ActionI3D IS NOT NULL OR @StreamI3D IS NOT NULL begin
		if @Date IS NULL 
			SET @Date = CURRENT_TIMESTAMP;

		INSERT INTO SocialMediaComment
		(EmployeeI3D, SocialMediaStreamI3D, SocialMediaActionI3D, Text, CreatedDate)
		VALUES
		(@EmployeeI3D, @StreamI3D, @ActionI3D, @Text, @Date)
		if (@@ERROR != 0) begin
			return @@ERROR
		end;
		RETURN SELECT C.* FROM cvw_SocialMediaCommentOverview C WHERE C.I3D = SCOPE_IDENTITY()
	end;
END
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaCreateActionForStream]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spr_SocialMediaCreateActionForStream]
	@StreamI3D int,
	@Text nvarchar(MAX),
	@EmployeeI3D int = null,
	@Date datetime = null
AS
BEGIN
	SET NOCOUNT ON;

	DECLARE
		@ObjectI3D int,
		@ObjectKind int

	if (not exists(SELECT 1 FROM SocialMediaStream WHERE I3D = @StreamI3D)) begin
		DECLARE @TextHelper varchar(512) = 'spr_SocialMediaCreateActionForStream : No record found for the stream I3D ' + CONVERT(varchar(64), @StreamI3D)
		RAISERROR(@textHelper, 16,1) 
		return @@ERROR
	end

	if @Date IS NULL begin
		SET @Date = CURRENT_TIMESTAMP;
	end;

	INSERT INTO SocialMediaAction
	(EmployeeI3D, SocialMediaStreamI3D, Text, CreatedDate)
	VALUES
	(@EmployeeI3D, @StreamI3D, @Text, @Date)
	if (@@ERROR != 0)
		return @@ERROR
	
	DECLARE @ID int = SCOPE_IDENTITY()

	RETURN @ID
END
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaCreateCRMActivityFeed]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Stanislaus Kaaz
-- Create date: 2014-03-24
-- Description:	
-- =============================================
CREATE PROCEDURE [dbo].[spr_SocialMediaCreateCRMActivityFeed]
	@CRMActivityI3D int,
	@Caption varchar(512) = null,
	@Description nvarchar(MAX) = null,
	@ClosedDate datetime = null,
	@CreatedDate datetime = null,
	@CreatedFromEmployeeI3D int = null,
	@CreatedFromEmployeeName varchar(256) = null
AS
BEGIN
	SET NOCOUNT ON;

	if ISNULL(@CRMActivityI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaCreateCRMActivityFeed : No CRM Activity I3D provided', 16,1);
		return @@ERROR;
	end;

	if @Caption IS NULL begin
		SELECT @Caption = T.Name, @Description = T.Text, @ClosedDate = CASE WHEN T.Status <> 0 THEN MAX(TH.GeaendertDatum) ELSE NULL END, 
			@CreatedDate = MIN(TH.GeaendertDatum), @CreatedFromEmployeeI3D = T.ErstellerI3D, @CreatedFromEmployeeName = P.Vorname + ' ' + P.Name
		FROM Taetigkeiten T
		INNER JOIN TaetigkeitenHistory TH ON TH.TaetigkeitsI3D = T.I3D
		LEFT OUTER JOIN Personal P ON P.I3D = T.ErstellerI3D
		WHERE T.I3D = @CRMActivityI3D
		GROUP BY T.Name, T.Text, T.Status, T.ErstellerI3D, P.Vorname, P.Name
	end;

	if @Caption IS NULL begin
		RAISERROR('spr_SocialMediaCreateCRMActivityFeed : No Activity found for the I3D', 16,1);
		return @@ERROR;
	end;

	DECLARE @StreamI3D int,
		@DisplayText nvarchar(MAX);

	SET @DisplayText = 'CRM: ' + @Caption;
	if (LEN(@DisplayText) > 512)
		SET @DisplayText = SUBSTRING(@DisplayText, 1, 512);

	EXEC @StreamI3D = spr_SocialMediaCreateStream @CRMActivityI3D, 6000002, @DisplayText, @Description;
	if @@ERROR != 0 BEGIN
		return @@ERROR;
	END

	if NOT EXISTS(SELECT 1 FROM CSI_SocialMediaComment C WHERE C.SocialMediaStreamI3D = @StreamI3D) begin
		SET @DisplayText = 'CRM Aktivität wurde am ' + CONVERT(varchar, @CreatedDate, 104) + ' von ' + @CreatedFromEmployeeName + ' angelegt.';
		
		EXEC spr_SocialMediaComment
			@EmployeeI3D = @CreatedFromEmployeeI3D,
			@SocialMediaI3D = @StreamI3D,
			@SocialMediaKind = 0,
			@Text = @DisplayText,
			@Date = @CreatedDate;

		if @@ERROR != 0 begin
			return @@ERROR;
		end;

		if @ClosedDate IS NOT NULL AND YEAR(@ClosedDate) > 1980 begin
			SET @DisplayText = 'CRM Aktivität wurde am ' + CONVERT(varchar, @ClosedDate, 104) + ' abgeschlossen.';

			EXEC spr_SocialMediaComment
				@EmployeeI3D = null,
				@SocialmediaI3D = @StreamI3D,
				@SocialMediaKind = 0,
				@Text = @DisplayText,
				@Date = @ClosedDate;

			if @@ERROR != 0 begin
				return @@ERROR;
			end;
		end;
	end;
END

GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaCreateCRMActivityFeedList]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Stanislaus Kaaz
-- Create date: 2014-03-25
-- Description:	
-- =============================================
CREATE PROCEDURE [dbo].[spr_SocialMediaCreateCRMActivityFeedList]
	@DateFrom datetime = null,
	@DateTo datetime = null
AS
BEGIN
	SET NOCOUNT ON;

	DECLARE 
		@CRMActivityQuery CURSOR,
		@DateToFilter datetime,
		@CRMActivityI3D int,
		@Caption varchar(512),
		@Description varchar(MAX),
		@ClosedDate datetime,
		@CreatedDate datetime,
		@CreatedFromEmployeeI3D int,
		@CreatedFromEmployeeName varchar(256);

	if @DateTo IS NOT NULL begin
		SET @DateToFilter = DATEADD(DAY, 1, @DateTo);
	end;

	SET @CRMActivityQuery = CURSOR FOR
		SELECT T.I3D, T.Name, T.Text, CASE WHEN T.Status <> 0 THEN MAX(TH.GeaendertDatum) ELSE NULL END AS ClosedDate, 
			MIN(TH.GeaendertDatum) AS CreatedDate, T.ErstellerI3D, P.Vorname + ' ' + P.Name AS EmployeeName
		FROM Taetigkeiten T
		INNER JOIN TaetigkeitenHistory TH ON TH.TaetigkeitsI3D = T.I3D
		LEFT OUTER JOIN Personal P ON P.I3D = T.ErstellerI3D
		GROUP BY T.I3D, T.Name, T.Text, T.Status, T.ErstellerI3D, P.Vorname, P.Name
		HAVING (@DateFrom IS NULL OR MIN(TH.GeaendertDatum) >= @DateFrom)
		AND (@DateToFilter IS NULL OR MAX(TH.GeaendertDatum) < @DateToFilter)
	OPEN @CRMActivityQuery;
	FETCH NEXT FROM @CRMActivityQuery into @CRMActivityI3D, @Caption, @Description, @ClosedDate, @CreatedDate,
		@CreatedFromEmployeeI3D, @CreatedFromEmployeeName;
	while @@FETCH_STATUS = 0 begin
		EXEC spr_SocialMediaCreateCRMActivityFeed
			@CRMActivityI3D = @CRMActivityI3D,
			@Caption = @Caption,
			@Description = @Description,
			@ClosedDate = @ClosedDate,
			@CreatedDate = @CreatedDate,
			@CreatedFromEmployeeI3D = @CreatedFromEmployeeI3D,
			@CreatedFromEmployeeName = @CreatedFromEmployeeName;

		FETCH NEXT FROM @CRMActivityQuery into @CRMActivityI3D, @Caption, @Description, @ClosedDate, @CreatedDate,
			@CreatedFromEmployeeI3D, @CreatedFromEmployeeName;
	END;
	CLOSE @CRMActivityQuery;
	DEALLOCATE @CRMActivityQuery;
END

GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaCreateFeed]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Stanislaus Kaaz
-- Create date: 2014-03-19
-- Description:	
-- =============================================
CREATE PROCEDURE [dbo].[spr_SocialMediaCreateFeed]
	@DateFrom datetime = null,
	@DateTo datetime = null,
	@ObjectI3D int = null,
	@ObjectKind int = null
AS
BEGIN
	SET NOCOUNT ON;

	if @ObjectKind IS NULL OR @ObjectKind = 10 begin
		-- Helpdesk
		DECLARE @HelpdeskQuery CURSOR,
			@DateToFilter datetime;

		if @DateTo IS NOT NULL begin
			SET @DateToFilter = DATEADD(DAY, 1, @DateTo);
		end;

		SET @HelpdeskQuery = CURSOR FOR
			SELECT hr.I3D, hr.Nummer, hr.Beschreibung, hr.Problem, hr.AbgeschlossenAm, hr.ErfasstAm,
				hr.ErstellerI3D, P.Vorname + ' ' + P.Name AS ErstellerName
			FROM hlpdsk_requests hr
			LEFT OUTER JOIN Personal P ON P.I3D = hr.ErstellerI3D
			WHERE (@DateFrom IS NULL OR hr.ErfasstAm >= @DateFrom)
			AND (@DateToFilter IS NULL OR hr.ErfasstAm < @DateToFilter)
			AND (@ObjectI3D IS NULL OR hr.I3D = @ObjectI3D)
		OPEN @HelpdeskQuery

		DECLARE 
			@HelpdeskI3D int,
			@Number int,
			@Caption varchar(512),
			@Description varchar(MAX),
			@ClosedDate datetime,
			@CreatedDate datetime,
			@CreatedFromI3D int,
			@CreatedFromName varchar(256)
		FETCH NEXT FROM @HelpdeskQuery into @HelpdeskI3D, @Number, @Caption, @Description, @ClosedDate, @CreatedDate,
			@CreatedFromI3D, @CreatedFromName
		while @@FETCH_STATUS = 0 begin
			EXEC spr_SocialMediaCreateHelpdeskFeed
				@HelpdeskI3D = @HelpdeskI3D,
				@Number = @Number,
				@Caption = @Caption,
				@Description = @Description,
				@ClosedDate = @ClosedDate,
				@CreatedDate = @CreatedDate,
				@CreatedFromEmployeeI3D = @CreatedFromI3D,
				@CreatedFromEmployeeName = @CreatedFromName;

			FETCH NEXT FROM @HelpdeskQuery into @HelpdeskI3D, @Number, @Caption, @Description, @ClosedDate, @CreatedDate,
				@CreatedFromI3D, @CreatedFromName;
		END
		CLOSE @HelpdeskQuery
		DEALLOCATE @HelpdeskQuery
	end;
	if @ObjectKind IS NULL OR @ObjectKind = 6000002 begin
		if ISNULL(@ObjectI3D, 0) > 0 begin
			EXEC spr_SocialMediaCreateCRMActivityFeed
				@CRMActivityI3D = @ObjectI3D;
		end else begin
			EXEC spr_SocialMediaCreateCRMActivityFeedList
				@DateFrom = @DateFrom,
				@DateTo = @DateTo;
		end;
	end;
END

GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaCreateHelpdeskFeed]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Stanislaus Kaaz
-- Create date: 2014-03-19
-- Description:	This method created a feed for the helpdesk
-- =============================================
CREATE PROCEDURE [dbo].[spr_SocialMediaCreateHelpdeskFeed]
	@HelpdeskI3D int,
	@Number int = null,
	@Caption varchar(512) = null,
	@Description nvarchar(MAX) = null,
	@ClosedDate datetime = null,
	@CreatedDate datetime = null,
	@CreatedFromEmployeeI3D int = null,
	@CreatedFromEmployeeName varchar(256) = null
AS
BEGIN
	SET NOCOUNT ON;

	if @HelpdeskI3D <= 0 begin
		RAISERROR('spr_SocialMediaCreateHelpdeskFeed : No Helpdesk I3D provided', 16,1);
		return @@ERROR;
	end;

	if @Number IS NULL begin
		SELECT @Number = hr.Nummer, @Caption = hr.Beschreibung, @Description = hr.Problem, @ClosedDate = hr.AbgeschlossenAm, @CreatedDate = hr.ErfasstAm,
		@CreatedFromEmployeeI3D = hr.ErstellerI3D, @CreatedFromEmployeeName = P.Vorname + ' ' + P.Name
		FROM hlpdsk_requests hr
		LEFT OUTER JOIN Personal P ON P.I3D = hr.ErstellerI3D
		WHERE hr.I3D = @HelpdeskI3D
	end;

	if @Number IS NULL begin
		RAISERROR('spr_SocialMediaCreateHelpdeskFeed : Could not load the Helpdesk Informations', 16,1);
		return @@ERROR;
	end;

	DECLARE @StreamI3D int,
		@DisplayText nvarchar(MAX);

	SET @DisplayText = 'Ticket: ' + @Caption;
	if (LEN(@DisplayText) > 512)
		SET @DisplayText = SUBSTRING(@DisplayText, 1, 512);

	EXEC @StreamI3D = spr_SocialMediaCreateStream @HelpdeskI3D, 10, @DisplayText, @Description;
	if @@ERROR != 0 BEGIN
		return @@ERROR;
	END

	if NOT EXISTS(SELECT 1 FROM CSI_SocialMediaComment C WHERE C.SocialMediaStreamI3D = @StreamI3D) begin
		SET @DisplayText = 'Ticket wurde am ' + CONVERT(varchar, @CreatedDate, 104) + ' von ' + @CreatedFromEmployeeName + ' angelegt.';
		
		EXEC spr_SocialMediaComment
			@EmployeeI3D = @CreatedFromEmployeeI3D,
			@SocialMediaI3D = @StreamI3D,
			@SocialMediaKind = 0,
			@Text = @DisplayText,
			@Date = @CreatedDate;

		--EXEC spr_SocialMediaCreateActionForStream 
		--	@StreamI3D = @StreamI3D, 
		--	@Text = @DisplayText, 
		--	@EmployeeI3D = @CreatedFromEmployeeI3D;
		if @@ERROR != 0 begin
			return @@ERROR;
		end;

		if @ClosedDate IS NOT NULL AND YEAR(@ClosedDate) > 1980 begin
			SET @DisplayText = 'Ticket wurde am ' + CONVERT(varchar, @ClosedDate, 104) + ' abgeschlossen.';

			EXEC spr_SocialMediaComment
				@EmployeeI3D = null,
				@SocialmediaI3D = @StreamI3D,
				@SocialMediaKind = 0,
				@Text = @DisplayText,
				@Date = @ClosedDate;

			--EXEC spr_SocialMediaCreateActionForStream 
			--@StreamI3D = @StreamI3D, 
			--@Text = @DisplayText;
			if @@ERROR != 0 begin
				return @@ERROR;
			end;
		end;

		DECLARE 
			@QueryCursor CURSOR,
			@EmployeeI3D int,
			@Date datetime;

		SET @QueryCursor = CURSOR FOR 
			SELECT hh.Bezeichnung, hh.BearbeiterI3D, hh.Datum
			FROM hlpdsk_history hh
			WHERE hh.RequestI3D = @HelpdeskI3D;
		OPEN @QueryCursor;

		FETCH NEXT FROM @QueryCursor into @DisplayText, @EmployeeI3D, @Date;
		while @@FETCH_STATUS = 0 begin
			if LTRIM(ISNULL(@DisplayText, '')) != '' begin
				EXEC spr_SocialMediaComment
					@EmployeeI3D = @EmployeeI3D,
					@SocialMediaI3D = @StreamI3D,
					@SocialMediaKind = 0,
					@Text = @DisplayText,
					@Date = @Date;

				--EXEC spr_SocialMediaCreateActionForStream 
				--	@StreamI3D = @StreamI3D, 
				--	@Text = @DisplayText, 
				--	@EmployeeI3D = @EmployeeI3D, 
				--	@Date = @Date;
				if @@ERROR != 0 begin
					return @@ERROR;
				end;
			end;
			FETCH NEXT FROM @QueryCursor INTO @DisplayText, @EmployeeI3D, @Date;
		end;
		CLOSE @QueryCursor;
		DEALLOCATE @QueryCursor;
	end
END

GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaCreateStream]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spr_SocialMediaCreateStream]
       @ObjectI3D int,
       @ObjectKind int,
       @DisplayText nvarchar(512),
       @Description nvarchar(MAX) = null
AS
BEGIN
       SET NOCOUNT ON;
       if @ObjectI3D <= 0
             RAISERROR('spr_SocialMediaCreateStream : Object I3D <= 0', 16,1) 
       if @ObjectKind <= 0
             RAISERROR('spr_SocialMediaCreateStream : Object Kind <= 0', 16,1) 
       if LTRIM(ISNULL(@DisplayText, '')) = ''
             RAISERROR('spr_SocialMediaCreateStream : Display Text is empty', 16,1) 

       if @@ERROR != 0 begin
             return @@ERROR
       end

       DECLARE @StreamI3D int

       SELECT @StreamI3D = I3D FROM SocialMediaStream WHERE ObjectI3D = @ObjectI3D AND ObjectKind = @ObjectKind
       if @StreamI3D IS NULL begin
             INSERT INTO SocialMediaStream
             (DisplayText, ObjectI3D, ObjectKind, Description, CreatedDate)
             VALUES
             (@DisplayText, @ObjectI3D, @ObjectKind, @Description, CURRENT_TIMESTAMP)
             if @@ERROR != 0 BEGIN
                    RAISERROR('spr_SocialMediaCreateStream : Error at "INSERT INTO SocialMediaStream"', 16,1) 
                    return @@ERROR
             END

             SELECT @StreamI3D = SCOPE_IDENTITY()

             EXEC spr_SocialMediaStreamAccountHelper
                    @StreamI3D = @StreamI3D,
                    @ObjectI3D = @ObjectI3D,
                    @ObjectKind = @ObjectKind

             if @@ERROR != 0 BEGIN
                    return @@ERROR
             END
       end

       RETURN @StreamI3D
END
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaLike]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spr_SocialMediaLike]
	@EmployeeI3D int,
	@SocialMediaI3D int,
	@SocialMediaKind int
AS
BEGIN
	SET NOCOUNT ON;

	if ISNULL(@EmployeeI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaStreamAccountHelper : Employee I3D <= 0', 16,1) 
		return @@ERROR
	end

	if (@SocialMediaKind = 0) begin
		if not exists(SELECT 1 FROM SocialMediaStream WHERE I3D = @SocialMediaI3D) begin
			RAISERROR('spr_SocialMediaLike : There is no stream object for the I3D', 16,1) 
			return @@ERROR
		end
		if exists(SELECT 1 FROM SocialMediaLike WHERE EmployeeI3D = @EmployeeI3D AND SocialMediaStreamI3D = @SocialMediaI3D) begin
			RAISERROR('spr_SocialMediaLike : The user liked the stream already', 16,1) 
			return @@ERROR
		end
		INSERT INTO SocialMediaLike
		(EmployeeI3D, SocialMediaStreamI3D)
		VALUES
		(@EmployeeI3D, @SocialMediaI3D)

	end else if (@SocialMediaKind = 1) begin
		if not exists(SELECT 1 FROM SocialMediaAction WHERE I3D = @SocialMediaI3D) begin
			RAISERROR('spr_SocialMediaLike : There is no action object for the I3D', 16,1) 
			return @@ERROR
		end
		if exists(SELECT 1 FROM SocialMediaLike WHERE EmployeeI3D = @EmployeeI3D AND SocialMediaActionI3D = @SocialMediaI3D) begin
			RAISERROR('spr_SocialMediaLike : The user liked the action already', 16,1) 
			return @@ERROR
		end
		INSERT INTO SocialMediaLike
		(EmployeeI3D, SocialMediaActionI3D)
		VALUES
		(@EmployeeI3D, @SocialMediaI3D)

	end else begin
		RAISERROR('spr_SocialMediaLike : Unknown kind', 16,1) 
		return @@ERROR
	end

	RETURN SELECT L.* FROM cvw_SocialMediaLikeOverview L WHERE L.I3D = SCOPE_IDENTITY()
END
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaRemoveComment]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[spr_SocialMediaRemoveComment]
	@EmployeeI3D int,
	@SocialMediaCommentI3D int
AS
BEGIN
	SET NOCOUNT ON;

	if ISNULL(@EmployeeI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaRemoveComment : No employee I3D passed down', 16,1) 
		return @@ERROR
	end

	DELETE FROM SocialMediaComment
	WHERE EmployeeI3D = @EmployeeI3D
	AND I3D = @SocialMediaCommentI3D
END
      
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaRemoveLike]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[spr_SocialMediaRemoveLike]
	@EmployeeI3D int,
	@SocialMediaI3D int,
	@SocialMediaKind int
AS
BEGIN
	SET NOCOUNT ON;

	if ISNULL(@EmployeeI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaRemoveLike : No employee I3D passed down', 16,1) 
		return @@ERROR
	end
	
	if @SocialMediaKind = 0 begin
		DELETE FROM SocialMediaLike
		WHERE EmployeeI3D = @EmployeeI3D
		AND SocialMediaStreamI3D = @SocialMediaI3D
	end else begin
		DELETE FROM SocialMediaLike
		WHERE EmployeeI3D = @EmployeeI3D
		AND SocialMediaActionI3D = @SocialMediaI3D
	end
END
      
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaStreamAccountHelper]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[spr_SocialMediaStreamAccountHelper]
	@StreamI3D int,
	@ObjectI3D int,
	@ObjectKind int
AS
BEGIN
	SET NOCOUNT ON;

	if ISNULL(@StreamI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaStreamAccountHelper : Stream I3D <= 0', 16,1) 
		return @@ERROR
	end
	if ISNULL(@ObjectI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaStreamAccountHelper : Object I3D <= 0', 16,1) 
		return @@ERROR
	end
	if ISNULL(@ObjectKind,0) <= 0 begin
		RAISERROR('spr_SocialMediaStreamAccountHelper : Object Kind <= 0', 16,1) 
		return @@ERROR
	end

	DECLARE
		@AccountI3D int,
		@AccountKind int,
		@CustomerAccountKind int = 0

	if (@ObjectKind = 6000002) begin
		SELECT @AccountI3D = T.KundeI3D, @AccountKind = @CustomerAccountKind FROM Taetigkeiten T WHERE T.I3D = @ObjectI3D
	end else if (@ObjectKind = 10) begin
		SELECT @AccountI3D = H.KundeI3D, @AccountKind = @CustomerAccountKind FROM hlpdsk_requests h WHERE h.I3D = @ObjectI3D
	end

	if (ISNULL(@AccountI3D,0) > 0) begin
		INSERT INTO SocialMediaStreamAccount
		(SocialMediaStreamI3D, AccountI3D, AccountKind)
		VALUES
		(@StreamI3D, @AccountI3D, @AccountKind)
	end
END
      
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaSubscribe]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spr_SocialMediaSubscribe]
	@EmployeeI3D int,
	@ObjectI3D int,
	@ObjectKind int,
	@DisplayText nvarchar(512)
AS
BEGIN
	SET NOCOUNT ON;

	if @EmployeeI3D <= 0
		RAISERROR('spr_SocialMediaSubscribe : Employee I3D <= 0', 16,1) 
	if @ObjectI3D <= 0
		RAISERROR('spr_SocialMediaSubscribe : Object I3D <= 0', 16,1) 
	if @ObjectKind <= 0
		RAISERROR('spr_SocialMediaSubscribe : Object Kind <= 0', 16,1) 
	if LTRIM(ISNULL(@DisplayText, '')) = ''
		RAISERROR('spr_SocialMediaSubscribe : Display Text is empty', 16,1) 

	if (@@ERROR != 0)
		return @@ERROR

	DECLARE
		@StreamI3D int

	SELECT @StreamI3D = S.I3D FROM SocialMediaStream S WHERE S.ObjectI3D = @ObjectI3D AND S.ObjectKind = @ObjectKind

	IF (@StreamI3D IS NULL) BEGIN
		EXEC @StreamI3D = spr_SocialMediaCreateStream @ObjectI3D, @ObjectKind, @DisplayText
		if @@ERROR != 0 BEGIN
			return @@ERROR
		END
	END ELSE BEGIN
		if EXISTS(SELECT 1 FROM SocialMediaSubscription S WHERE S.SocialMediaStreamI3D = @StreamI3D AND S.EmployeeI3D = @EmployeeI3D) BEGIN
			RAISERROR('spr_SocialMediaSubscribe : User already subscripted to the object', 16,1) 
			return @@ERROR
		END
	END

	INSERT INTO SocialMediaSubscription
	(EmployeeI3D, SocialMediaStreamI3D, SubscriptionDate)
	VALUES
	(@EmployeeI3D, @StreamI3D, CURRENT_TIMESTAMP)
	if @@ERROR != 0 BEGIN 
		RAISERROR('spr_SocialMediaSubscribe : Error at "INSERT INTO SocialMediaSubscription"', 16,1) 
		return @@ERROR
	END

	RETURN @StreamI3D
END
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaSubscribeToCRMActivity]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[spr_SocialMediaSubscribeToCRMActivity]
	@EmployeeI3D int,
	@CRMActivityI3D int
AS
BEGIN
	SET NOCOUNT ON;

	DECLARE
		@DisplayText nvarchar(512)

	SELECT @DisplayText = 'CRM: ' + T.Name FROM Taetigkeiten T WHERE T.I3D = @CRMActivityI3D

	if (LTRIM(ISNULL(@DisplayText, '')) = '') BEGIN
		RAISERROR('spr_SocialMediaSubscribeToCRMActivity : No display text found for the crm activity', 16,1) 
		return @@ERROR
	END

	DECLARE @ReturnValue int

    EXEC @ReturnValue = spr_SocialMediaSubscribe
		@EmployeeI3D = @EmployeeI3D,
		@ObjectI3D = @CRMActivityI3D,
		@ObjectKind = 6000002,
		@DisplayText = @DisplayText

	RETURN @ReturnValue;
END
      
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaSubscribeToHelpdesk]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[spr_SocialMediaSubscribeToHelpdesk]
	@EmployeeI3D int,
	@HelpdeskI3D int
AS
BEGIN
	SET NOCOUNT ON;

	DECLARE
		@DisplayText nvarchar(512),
		@Number int

	SELECT @DisplayText = 'Ticket ' + CONVERT(nvarchar,h.Nummer), @Number = h.Nummer FROM hlpdsk_requests h WHERE h.I3D = @HelpdeskI3D

	if (@Number IS NULL) BEGIN
		RAISERROR('spr_SocialMediaSubscribeToHelpdesk : No Helpdesk found for the Helpdesk I3D', 16,1) 
		return @@ERROR
	END

	DECLARE @ReturnValue int;
    EXEC @ReturnValue = spr_SocialMediaSubscribe
		@EmployeeI3D = @EmployeeI3D,
		@ObjectI3D = @HelpdeskI3D,
		@ObjectKind = 10,
		@DisplayText = @DisplayText
	RETURN @ReturnValue;
END
      
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaUnsubscribe]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spr_SocialMediaUnsubscribe] 
	@EmployeeI3D int,
	@ObjectI3D int,
	@ObjectKind int
AS
BEGIN
	SET NOCOUNT ON;

    if @EmployeeI3D <= 0
		RAISERROR('spr_SocialMediaUnsubscribe : Employee I3D <= 0', 16,1) 
	if @ObjectI3D <= 0
		RAISERROR('spr_SocialMediaUnsubscribe : Object I3D <= 0', 16,1) 
	if @ObjectKind <= 0
		RAISERROR('spr_SocialMediaUnsubscribe : Object Kind <= 0', 16,1) 

	if (@@ERROR != 0)
		return @@ERROR

	DELETE FROM SocialMediaSubscription
	WHERE I3D = 
		(SELECT SS.I3D FROM SocialMediaSubscription SS
		INNER JOIN SocialMediaStream SMS ON SMS.I3D = SS.SocialMediaStreamI3D
		WHERE SMS.ObjectI3D = @ObjectI3D
		AND SMS.ObjectKind = @ObjectKind
		AND SS.EmployeeI3D = @EmployeeI3D)
END
GO
/****** Object:  StoredProcedure [dbo].[spr_SocialMediaUpdateComment]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spr_SocialMediaUpdateComment]
	@EmployeeI3D int,
	@SocialMediaCommentI3D int,
	@Comment nvarchar(MAX)
AS
BEGIN
	SET NOCOUNT ON;

	if ISNULL(@EmployeeI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaUpdateComment : No employee I3D passed down', 16,1) 
		return @@ERROR
	end

	if ISNULL(@SocialMediaCommentI3D,0) <= 0 begin
		RAISERROR('spr_SocialMediaUpdateComment : No comment I3D passed down', 16,1) 
		return @@ERROR
	end

	UPDATE SocialMediaComment
	SET Text = @Comment,
		CreatedDate = CURRENT_TIMESTAMP
	WHERE EmployeeI3D = @EmployeeI3D
	AND I3D = @SocialMediaCommentI3D

	RETURN SELECT C.*
	FROM cvw_SocialMediaCommentOverview C
	WHERE C.I3D = @SocialMediaCommentI3D
	AND C.EmployeeI3D = @EmployeeI3D
END
GO
/****** Object:  StoredProcedure [dbo].[spr_UpdateTerminplannerDisplayText_FromHelpdesk]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 CREATE PROCEDURE [dbo].[spr_UpdateTerminplannerDisplayText_FromHelpdesk] (@hlpdsk_requests_I3D INT, @hlpdsk_timer_I3D INT = 0  )
 AS
 BEGIN
     SET NOCOUNT ON;
     
     IF (@hlpdsk_timer_I3D = 0)
     BEGIN
         IF ((SELECT COUNT(*) FROM hlpdsk_timer WHERE RequestI3D = @hlpdsk_requests_I3D AND Start > CURRENT_TIMESTAMP) = 0)
         BEGIN
             RETURN
         END
     END
     ELSE
     IF ((SELECT COUNT(*) FROM hlpdsk_timer WHERE I3D = @hlpdsk_timer_I3D AND Start > CURRENT_TIMESTAMP ) = 0)
     BEGIN
         RETURN
     END
     
     DECLARE
     
     
     
     @hlpdsk_timer_Bemerkung VARCHAR(8000),
     ------------------------------------------------------------------------------------------
     
     @sdwHlpDeskTimeDisplayKurzbeschreibungInTerminplanner INT = 1561,
     
     @hlpdsk_requests_Beschreibung VARCHAR(8000),
     ------------------------------------------------------------------------------------------
     
     @sdwHlpDeskTimeDisplayKundendatenInTerminplanner INT = 1562 ,
     
     @Kunden_Name VARCHAR(8000),
     @Kunden_Kundennummer  VARCHAR(8000),
     @Kunden_Fon  VARCHAR(8000),
     @Anschrif_Strasse  VARCHAR(8000),
     @Anschrif_Plz  VARCHAR(8000),
     @Anschrif_Ort VARCHAR(8000),
     ------------------------------------------------------------------------------------------
     
     @sdwHlpDeskTimeDisplayAnsprechpartnerInTerminplanner INT = 1563 ,
     
     
     @Anrede_Anrede VARCHAR(8000),
     @Personen_AnsprechVorname VARCHAR(8000),
     @Personen_Ansprech VARCHAR(8000),
     @Personen_Tel1 VARCHAR(8000),
     @Personen_EMail1 VARCHAR(8000),
     @Abteilung_Abteilung VARCHAR(8000),
     
     @hlpdsk_requests_AnsprechAnrede VARCHAR(8000),
     @hlpdsk_requests_AnsprechName VARCHAR(8000),
     @hlpdsk_requests_AnsprechTelefon VARCHAR(8000),
     @hlpdsk_requests_AnsprechEMail VARCHAR(8000),
     ------------------------------------------------------------------------------------------
     
     @sdwHlpDeskTimeDisplayBearbeiterInTerminplanner INT = 1564 ,
     
     @P_Vorname VARCHAR(8000),
     @P_Name VARCHAR(8000),
     @P_KurzZeich VARCHAR(8000),
     @TempStr_R VARCHAR(8000),
     
     @qryData CURSOR	,
     
     ------------------------------------------------------------------------------------------
     
     @sdwHlpDeskTimeDisplayRequestdetaisInTerminplanner INT = 1565 ,
     @DisplayRequestdetaisInTerminplanner INT,
     
     @AnfahrtRemoteStr VARCHAR(8000),
     @hlpdsk_timer_typen_WithAddressSpecialArticle VARCHAR(8000),
     @hlpdsk_timer_typen_WithCustomerSpecialArticle VARCHAR(8000),
     
     @hlpdsk_requests_ErfasstAm VARCHAR(8000),
     
     @PersonalErsteller_KurzZeich  VARCHAR(8000),
     @PersonalErsteller_Vorname  VARCHAR(8000),
     @PersonalErsteller_Name  VARCHAR(8000),
     @hlpdsk_typen_Bezeichnung VARCHAR(8000),
     @hlpdsk_timer_typen_Bezeichnung VARCHAR(8000),
     
     @hlpdsk_kategorienHaupt_Bezeichnung VARCHAR(8000),
     @hlpdsk_kategorienUnterkategorie1_Bezeichnung VARCHAR(8000),
     @hlpdsk_kategorienUnterkategorie2_Bezeichnung VARCHAR(8000),
     @hlpdsk_status_Bezeichnung VARCHAR(8000),
     @hlpdsk_prioritaeten_Bezeichnung VARCHAR(8000),
     @PersonalVerantwortlicher_KurzZeich  VARCHAR(8000),
     @PersonalVerantwortlicher_Vorname  VARCHAR(8000),
     @PersonalVerantwortlicher_Name  VARCHAR(8000),
     
     @sdwHelpdeskZusatztext2  INT,
     @sdwHelpdeskVersion  INT,
     
     @sdwHelpdeskZusatztext2Text INT,
     @sdwHelpdeskVersionText INT,
     
     
     @hlpdsk_requests_Version VARCHAR(8000),
     @hlpdsk_requests_Zusatztext2 VARCHAR(8000),
     ------------------------------------------------------------------------------------------
     
     @sdwHlpDeskTimeDisplayVertragInTerminplanner INT = 1566 ,
     
     @Vertragkopf_nummer INT,
     @vertragsart_bezeichnung VARCHAR(8000),
     @hlpdsk_requests_VertragArt VARCHAR(8000),
     ------------------------------------------------------------------------------------------
     
     @sdwHlpDeskDisplayVertragDerZeit INT					= 1629,
     @sdwHlpDeskDisplayStammblattDerZeit INT		 		= 1630,
     
     @DisplayVertragDerZeit INT,
     @DisplayStammblattDerZeit INT,
     
     
     
     @GeraeteKopf_Text  VARCHAR(8000),
     @GeraeteKopf_Seriennummer  VARCHAR(8000),
     @GeraeteKopf_Standort VARCHAR(8000),
     @GeraeteKopf_Nummer INT,
     
     
     ------------------------------------------------------------------------------------------
     
     
     @sdwHlpDeskTimeDisplayRMAInTerminplanner INT = 1567 ,
     
     @hlpdsk_requests_IstRMAFall VARCHAR(8000),
     ------------------------------------------------------------------------------------------
     
     @sdwHlpDeskDisplayBeschreibungInTerminplanner INT = 1568 ,
     
     @TempStr VARCHAR(8000),
     @hlpdsk_requests_Problem VARCHAR(8000),
     @UmbruchPos INT,
     ------------------------------------------------------------------------------------------
     
     @TerminText  VARCHAR (8000) = '',
     @ResultTerminText  VARCHAR (8000) = '',
     @objektArt INT = 4000056,
     @CRLF CHAR(2) = CHAR(13) + CHAR(10),
     @hlpdsk_timer_i3D_Intern int,
     
     @PlatzHalterBemerkung  CHAR(32)                       = '@@PlatzHalterBemerkung________@@',
     @PlatzHalterZeittyp  CHAR(32)                         = '@@PlatzHalterZeittyp__________@@',
     @PlatzHalterVertragDerZeit CHAR(32)					= '@@PlatzHalterVertragDerZeit___@@',
     @PlatzHalterStammblattDerZeit CHAR(32)		 		= '@@PlatzHalterStammblattDerZeit@@',
     
     @PlatzHalterErsatzVertragDerZeit CHAR(8000),
     @PlatzHalterErsatzStammblattDerZeit CHAR(8000)
     
     
     
     
     SELECT
     
     @hlpdsk_requests_Beschreibung = LTRIM(RTRIM(ISNULL(hlpdsk_requests.Beschreibung,''))),-- KURZBESCHREIBUMNG
     -----------------------------------------------------------------------------------------------------------------------
     @Kunden_Name = LTRIM(RTRIM(isnull(Kunden.Name,''))),
     @Kunden_Kundennummer = LTRIM(RTRIM(isnull(Kunden.Kundennummer,''))) ,
     @Kunden_Fon = LTRIM(RTRIM(isnull(Kunden.Fon,''))),
     @Anschrif_Strasse = LTRIM(RTRIM(isnull(Anschrif.Strasse,''))),
     @Anschrif_Plz = LTRIM(RTRIM(isnull(Anschrif.Plz,''))),
     @Anschrif_Ort = LTRIM(RTRIM(isnull(Anschrif.Ort,''))),
     -----------------------------------------------------------------------------------------------------------------------
     @Anrede_Anrede = LTRIM(RTRIM(isnull(Anrede.Anrede,''))),
     @Personen_AnsprechVorname = LTRIM(RTRIM(isnull(Personen.AnsprechVorname,''))) ,
     @Personen_Ansprech = LTRIM(RTRIM(isnull(Personen.Ansprech,''))), --Name
     @Personen_Tel1 = LTRIM(RTRIM(isnull(Personen.Tel1,''))),
     @Personen_EMail1 = LTRIM(RTRIM(isnull(Personen.EMail1,''))),
     @Abteilung_Abteilung = LTRIM(RTRIM(isnull(Abteilung.Abteilung,''))),
     
     
     @hlpdsk_requests_AnsprechAnrede = LTRIM(RTRIM(isnull(hlpdsk_requests.AnsprechAnrede,''))),
     @hlpdsk_requests_AnsprechName = LTRIM(RTRIM(isnull(hlpdsk_requests.AnsprechName,''))) ,
     @hlpdsk_requests_AnsprechTelefon = LTRIM(RTRIM(isnull(hlpdsk_requests.AnsprechTelefon,''))),
     @hlpdsk_requests_AnsprechEMail = LTRIM(RTRIM(isnull(hlpdsk_requests.AnsprechEMail,''))),
     -----------------------------------------------------------------------------------------------------------------------
     
     @hlpdsk_requests_ErfasstAm = ISNULL(CONVERT(VARCHAR(10),hlpdsk_requests.ErfasstAm,104),'') ,
     
     @PersonalErsteller_Vorname = LTRIM(RTRIM(ISNULL(PersonalErsteller.Vorname,''))),
     @PersonalErsteller_Name = LTRIM(RTRIM(ISNULL(PersonalErsteller.Name ,''))),
     @PersonalErsteller_KurzZeich = LTRIM(RTRIM(ISNULL(PersonalErsteller.KurzZeich ,''))),
     
     @hlpdsk_typen_Bezeichnung = LTRIM(RTRIM(ISNULL(hlpdsk_typen.Bezeichnung ,''))),
     
     
     @hlpdsk_kategorienHaupt_Bezeichnung = LTRIM(RTRIM(ISNULL(hlpdsk_kategorienHaupt.Bezeichnung ,''))),
     @hlpdsk_kategorienUnterkategorie1_Bezeichnung = LTRIM(RTRIM(ISNULL(hlpdsk_kategorienUnterkategorie1.Bezeichnung ,''))) ,
     @hlpdsk_kategorienUnterkategorie2_Bezeichnung = LTRIM(RTRIM(ISNULL(hlpdsk_kategorienUnterkategorie2.Bezeichnung ,''))) ,
     
     @hlpdsk_status_Bezeichnung = LTRIM(RTRIM(ISNULL(hlpdsk_status.Bezeichnung ,''))),
     @hlpdsk_prioritaeten_Bezeichnung = LTRIM(RTRIM(ISNULL(hlpdsk_prioritaeten.Bezeichnung ,''))),
     
     @PersonalVerantwortlicher_Vorname = LTRIM(RTRIM(ISNULL(PersonalVerantwortlicher.Vorname ,''))),
     @PersonalVerantwortlicher_Name = LTRIM(RTRIM(ISNULL(PersonalVerantwortlicher.Name ,''))),
     @PersonalVerantwortlicher_KurzZeich =  LTRIM(RTRIM(ISNULL(PersonalVerantwortlicher.KurzZeich ,''))),
     
     @hlpdsk_requests_Version = LTRIM(RTRIM(ISNULL(hlpdsk_requests.Version,''))),
     @hlpdsk_requests_Zusatztext2 = LTRIM(RTRIM(ISNULL(hlpdsk_requests.Zusatztext2,''))),
     -----------------------------------------------------------------------------------------------------------------------
     @Vertragkopf_nummer = ISNULL(Vertragkopf.nummer,0),
     @vertragsart_bezeichnung = LTRIM(RTRIM(ISNULL(vertragsart.bezeichnung,''))),
     @hlpdsk_requests_VertragArt = CASE when ISNULL(hlpdsk_requests.VertragArt,-1) = 1 THEN 'Eigenvertrag' ELSE CASE when ISNULL(hlpdsk_requests.VertragArt,-1) = 0 THEN 'Fremdvertrag' ELSE 'Nicht Zugeordnet' END END,
     -----------------------------------------------------------------------------------------------------------------------
     @hlpdsk_requests_IstRMAFall = CASE when ISNULL(hlpdsk_requests.IstRMAFall,0) = 1 THEN 'RMA: Ja' ELSE  'RMA: Nein' END ,
     -----------------------------------------------------------------------------------------------------------------------
     @hlpdsk_requests_Problem = LTRIM(RTRIM(ISNULL((CAST ( hlpdsk_requests.Problem AS VARCHAR  ( 8000 )  )),''))) ---------Beschreibung
     -----------------------------------------------------------------------------------------------------------------------
     
     FROM hlpdsk_requests
     
     LEFT OUTER JOIN Personal PersonalErsteller ON hlpdsk_requests.ErstellerI3D = PersonalErsteller.I3D
     LEFT OUTER JOIN hlpdsk_typen ON hlpdsk_requests.hlpdsk_typenI3D = hlpdsk_typen.I3D
     LEFT OUTER JOIN hlpdsk_kategorien hlpdsk_kategorienHaupt  ON hlpdsk_requests.HauptkategorieI3D = hlpdsk_kategorienHaupt.I3D
     LEFT OUTER JOIN hlpdsk_kategorien hlpdsk_kategorienUnterkategorie1  ON hlpdsk_requests.Unterkategorie1I3D = hlpdsk_kategorienUnterkategorie1.I3D
     LEFT OUTER JOIN hlpdsk_kategorien hlpdsk_kategorienUnterkategorie2  ON hlpdsk_requests.Unterkategorie1I3D = hlpdsk_kategorienUnterkategorie2.I3D
     LEFT OUTER JOIN hlpdsk_status ON hlpdsk_requests.Status = hlpdsk_status.I3D
     LEFT OUTER JOIN hlpdsk_prioritaeten ON hlpdsk_requests.Prioritaet = hlpdsk_prioritaeten.I3D
     LEFT OUTER JOIN Personal PersonalVerantwortlicher ON hlpdsk_requests.VerantwortlicherI3D = PersonalVerantwortlicher.I3D
     LEFT OUTER JOIN VertragKopf ON hlpdsk_requests.VertragI3D = VertragKopf.I3D
     LEFT OUTER JOIN VertragsArt ON VertragKopf.VertragsArtI3D = VertragsArt.I3D
     LEFT OUTER JOIN Personen ON hlpdsk_requests.AnsprechpartnerI3D = Personen.I3D
     LEFT OUTER JOIN Anrede ON Anrede.I3D = Personen.AnredeI3D
     LEFT OUTER JOIN Abteilung ON Personen.Abteilung = Abteilung.I3D
     LEFT OUTER JOIN Kunden ON  hlpdsk_requests.KundeI3D = Kunden.I3D
     LEFT OUTER JOIN Anschrif ON  hlpdsk_requests.AnschriftI3D = Anschrif.I3D
     
     WHERE hlpdsk_requests.I3D = @hlpdsk_requests_I3D
     
     SET @TerminText = @PlatzHalterBemerkung ;
     
     IF ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskTimeDisplayKurzbeschreibungInTerminplanner ),0) = 1 --2
     BEGIN
         SET @TerminText = @TerminText + @CRLF + @hlpdsk_requests_Beschreibung
     END
     
     
     IF ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskTimeDisplayKundendatenInTerminplanner ),0) = 1 --3
     BEGIN
         SET @TerminText = @TerminText + @CRLF +
         'Kundendaten:' + 			@CRLF +
         '    ' + 'Name: ' + 			@Kunden_Name + @CRLF +
         '    ' + 'Nummer: ' + 			@Kunden_Kundennummer +  @CRLF +
         '    ' + 'Telefon: ' + 			@Kunden_Fon + @CRLF +
         '    ' + 'Strasse: ' + 		    @Anschrif_Strasse + @CRLF +
         '    ' + 'PLZ: ' + 				@Anschrif_Plz + @CRLF +
         '    ' + 'Ort: ' + 				@Anschrif_Ort
     END
     
     IF ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskTimeDisplayAnsprechpartnerInTerminplanner ),0) = 1 --4
     BEGIN
         IF	(	@Anrede_Anrede + @Personen_AnsprechVorname + @Personen_Ansprech + @Personen_Tel1 + @Personen_EMail1 + @Abteilung_Abteilung ) <> ''
         BEGIN
             SET @TerminText = @TerminText + @CRLF +
             'Ansprechpartner:' + 			@CRLF +
             '    ' + 'Anrede: ' + 			@Anrede_Anrede + @CRLF +
             '    ' + 'Name: ' + 			@Personen_AnsprechVorname + ' ' + @Personen_Ansprech + @CRLF +
             '    ' + 'Telefon: ' + 			@Personen_Tel1 + @CRLF +
             '    ' + 'EMail: ' + 			@Personen_EMail1 + @CRLF +
             '    ' + 'Abteilung: ' + 		@Abteilung_Abteilung
         END
         ELSE
         BEGIN
             SET @TerminText = @TerminText + @CRLF +
             'Ansprechpartner:' + 			@CRLF +
             '    ' + 'Anrede: ' + 			@hlpdsk_requests_AnsprechAnrede + @CRLF +
             '    ' + 'Name: ' + 			@hlpdsk_requests_AnsprechName + @CRLF +
             '    ' + 'Telefon: ' + 			@hlpdsk_requests_AnsprechTelefon + @CRLF +
             '    ' + 'EMail: ' + 			@hlpdsk_requests_AnsprechEMail
         END
     END
     
     IF ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskTimeDisplayBearbeiterInTerminplanner ),0) = 1 --5
     BEGIN
         
         SET @TempStr_R = '' ;
         
         SET @qryData = CURSOR SCROLL FOR
         SELECT
         ISNULL(P.Name,'') AS P_Name,
         ISNULL(P.Vorname,'') AS P_Vorname,
         ISNULL(P.KurzZeich,'') AS P_KurzZeich
         FROM hlpdsk_request_bearbeiter B
         INNER JOIN Personal P ON P.I3D = B.PersonalI3D
         WHERE B.RequestI3D = (SELECT RequestI3D FROM hlpdsk_timer WHERE I3D = @hlpdsk_timer_I3D )
         
         OPEN @qryData
         
         IF @@CURSOR_ROWS > 0
         BEGIN
             FETCH FIRST FROM @qryData INTO
             @P_Vorname,
             @P_Name,
             @P_KurzZeich
             
             WHILE @@FETCH_STATUS = 0
             BEGIN
                 IF @TempStr_R <> ''
                 BEGIN
                     SET @TempStr_R = @TempStr_R + @CRLF
                 END
                 
                 SET @TempStr_R = @TempStr_R + '    ' + LTRIM(RTRIM(@P_KurzZeich)) + ' (' + LTRIM(RTRIM(@P_Vorname)) + ' ' + LTRIM(RTRIM(@P_Name)) + ')'
                 
                 FETCH NEXT FROM @qryData INTO
                 @P_Vorname,
                 @P_Name,
                 @P_KurzZeich
                 
             END
         END
         
         CLOSE @qryData
         DEALLOCATE @qryData
         
         
         IF @TempStr_R <> ''
         BEGIN
             SET @TempStr_R = 'Bearbeiter:' + @CRLF + @TempStr_R
         END
         
         SET  @TerminText = @TerminText + @CRLF + @TempStr_R ;
         
     END
     
     SET @DisplayRequestdetaisInTerminplanner = ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskTimeDisplayRequestdetaisInTerminplanner ),0)
     
     IF @DisplayRequestdetaisInTerminplanner = 1 --6
     BEGIN
         
         SET @TerminText = @TerminText + @CRLF +
         'Ticketdetails:' + @CRLF +
         '    ' + 'Erfasst am: ' + 			@hlpdsk_requests_ErfasstAm + @CRLF +
         '    ' + 'Ersteller: ' + 			    @PersonalErsteller_KurzZeich + ' ('+ @PersonalErsteller_Vorname + ' ' + @PersonalErsteller_Name + ')' + @CRLF +
         '    ' + 'Typ: ' + 					@hlpdsk_typen_Bezeichnung + 	@CRLF +
         '    ' + 'Zeit-Typ: ' + 			    @PlatzHalterZeittyp + @CRLF +
         '    ' + 'Hauptkategorie: ' + 		@hlpdsk_kategorienHaupt_Bezeichnung + @CRLF +
         '    ' + 'Unterkategorie1: ' +		@hlpdsk_kategorienUnterkategorie1_Bezeichnung + @CRLF +
         '    ' + 'Unterkategorie2: ' +		@hlpdsk_kategorienUnterkategorie2_Bezeichnung + @CRLF +
         '    ' + 'Status: ' +				    @hlpdsk_status_Bezeichnung + @CRLF +
         '    ' + 'Priorität: ' +			    @hlpdsk_prioritaeten_Bezeichnung + @CRLF +
         '    ' + 'Verantwortlicher: ' +		@PersonalVerantwortlicher_KurzZeich + ' ('+ @PersonalVerantwortlicher_Vorname + ' ' + @PersonalVerantwortlicher_Name + ')'
         
         
         IF ISNULL((SELECT WERT FROM Stammdat WHERE I3D = @sdwHelpdeskVersion),0) = 1
         BEGIN
             SET @TerminText = @TerminText +  @CRLF + '    ' + ISNULL((SELECT WertText FROM Stammdat WHERE I3D = @sdwHelpdeskVersionText),'') +
             ': ' +  @hlpdsk_requests_Version
         END
         
         IF	 ISNULL((SELECT WERT FROM Stammdat WHERE I3D = @sdwHelpdeskZusatztext2),0) = 1
         BEGIN
             SET @TerminText = @TerminText + @CRLF + '    ' + ISNULL((SELECT WertText FROM Stammdat WHERE I3D = @sdwHelpdeskZusatztext2Text),'') +
             ': ' + @hlpdsk_requests_Zusatztext2
         END
         
     END
     
     IF ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskTimeDisplayVertragInTerminplanner ),0) = 1 --7
     BEGIN
         
         IF @Vertragkopf_nummer <> 0
         BEGIN
             SET @TerminText = @TerminText + @CRLF +
             'Standardvertrag in Ticket:' + 			@CRLF +
             '    ' + 'Vertragsnummer: ' + 	CAST ( @Vertragkopf_nummer  AS varchar)  + @CRLF +
             '    ' + 'Bezeichnung: ' + @vertragsart_bezeichnung + @CRLF +
             '    ' + 'Vertragsart: ' + 	@hlpdsk_requests_VertragArt
         END
         ELSE
         BEGIN
             SET @TerminText = @TerminText + @CRLF +  'Standardvertrag in Ticket: kein'
         END
         
     END
     
     SET @DisplayVertragDerZeit = ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskTimeDisplayVertragInTerminplanner ),0)
     
     IF @DisplayVertragDerZeit = 1 --7
     BEGIN
         SET @TerminText = @TerminText + @CRLF + @PlatzHalterVertragDerZeit
     END
     
     SET @DisplayStammblattDerZeit = ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskDisplayStammblattDerZeit ),0)
     
     IF @DisplayStammblattDerZeit = 1 --7
     BEGIN
         SET @TerminText = @TerminText + @CRLF + @PlatzHalterStammblattDerZeit
     END
     
     IF ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskTimeDisplayRMAInTerminplanner ),0) = 1 --8
     BEGIN
         SET @TerminText = @TerminText + @CRLF + @hlpdsk_requests_IstRMAFall
     END
     
     IF ISNULL((SELECT Wert FROM Stammdat WHERE I3D = @sdwHlpDeskDisplayBeschreibungInTerminplanner ),0) = 1 --9
     BEGIN
         
         SET @TempStr = @hlpdsk_requests_Problem ;
         SET @TempStr_R = ''
         SET @UmbruchPos =  (SELECT PATINDEX('%'+ @CRLF +'%', @TempStr))
         
         
         WHILE (@UmbruchPos > 0 )
         BEGIN
             SET @TempStr_R   = @TempStr_R +  '    ' + RTRIM(LTRIM(REPLACE(REPLACE(LEFT(@TempStr,@UmbruchPos - 1), CHAR(13), '' ),CHAR(10),''))) + @CRLF
             SET @TempStr   = LTRIM(RIGHT(@TempStr, LEN(@TempStr)- @UmbruchPos ))
             SET @UmbruchPos =  (SELECT PATINDEX('%'+ @CRLF +'%', @TempStr))
         END
         
         SET @TempStr_R = @TempStr_R +  '    ' + RTRIM(LTRIM(REPLACE(REPLACE(@TempStr,CHAR(13),''),CHAR(10),'')))
         
         SET @TerminText = @TerminText + @CRLF + 'Beschreibung:' + @CRLF + @TempStr_R ;
         
     END
     
     SET @TerminText = LTRIM(RTRIM(@TerminText))
     
     
     if @hlpdsk_timer_I3D >0
     BEGIN
         SET @qryData = CURSOR SCROLL FOR
         
         SELECT
         hlpdsk_timer.i3D,
         LTRIM(RTRIM(ISNULL(hlpdsk_timer.Bemerkung,''))) , -- BEMERKUNG
         CASE when ISNULL(hlpdsk_timer_typen.WithAddressSpecialArticle,0) = 1 THEN 'mit Anfahrt' ELSE  '' END,
         CASE when ISNULL(hlpdsk_timer_typen.WithCustomerSpecialArticle,0) = 1 THEN 'mit Remote' ELSE  '' END,
         LTRIM(RTRIM(ISNULL(hlpdsk_timer_typen.Bezeichnung,''))),
         
         ISNULL(Vertragkopf.nummer,0),
         LTRIM(RTRIM(ISNULL(vertragsart.bezeichnung,''))),
         
         LTRIM(RTRIM(ISNULL(GeraeteKopf.[Text],''))),
         LTRIM(RTRIM(ISNULL(GeraeteKopf.Seriennummer,''))),
         LTRIM(RTRIM(ISNULL(GeraeteKopf.Standort,''))),
         ISNULL(GeraeteKopf.Nummer,0)
         
         FROM hlpdsk_timer
         LEFT OUTER JOIN hlpdsk_timer_typen ON  hlpdsk_timer.hlpdsk_timer_typenI3D = hlpdsk_timer_typen.I3D
         LEFT OUTER JOIN VertragKopf ON  hlpdsk_timer.ContractI3D = VertragKopf.I3D
         LEFT OUTER JOIN VertragsArt ON VertragKopf.VertragsArtI3D = VertragsArt.I3D
         LEFT OUTER JOIN GeraeteKopf ON  hlpdsk_timer.DeviceI3D = GeraeteKopf.I3D
         
         WHERE hlpdsk_timer.I3D = @hlpdsk_timer_I3D AND hlpdsk_timer.Start > CURRENT_TIMESTAMP
     END
     ELSE
     BEGIN
         SET @qryData = CURSOR SCROLL FOR
         
         
         SELECT
         hlpdsk_timer.i3D,
         LTRIM(RTRIM(ISNULL(hlpdsk_timer.Bemerkung,''))) , -- BEMERKUNG
         CASE when ISNULL(hlpdsk_timer_typen.WithAddressSpecialArticle,0) = 1 THEN 'mit Anfahrt' ELSE  '' END,
         CASE when ISNULL(hlpdsk_timer_typen.WithCustomerSpecialArticle,0) = 1 THEN 'mit Remote' ELSE  '' END,
         LTRIM(RTRIM(ISNULL(hlpdsk_timer_typen.Bezeichnung,''))),
         
         ISNULL(Vertragkopf.nummer,0),
         LTRIM(RTRIM(ISNULL(vertragsart.bezeichnung,''))),
         
         LTRIM(RTRIM(ISNULL(GeraeteKopf.[Text],''))),
         LTRIM(RTRIM(ISNULL(GeraeteKopf.Seriennummer,''))),
         LTRIM(RTRIM(ISNULL(GeraeteKopf.Standort,''))),
         ISNULL(GeraeteKopf.Nummer,0)
         
         FROM hlpdsk_timer
         LEFT OUTER JOIN hlpdsk_timer_typen ON  hlpdsk_timer.hlpdsk_timer_typenI3D = hlpdsk_timer_typen.I3D
         LEFT OUTER JOIN VertragKopf ON  hlpdsk_timer.ContractI3D = VertragKopf.I3D
         LEFT OUTER JOIN VertragsArt ON VertragKopf.VertragsArtI3D = VertragsArt.I3D
         LEFT OUTER JOIN GeraeteKopf ON  hlpdsk_timer.DeviceI3D = GeraeteKopf.I3D
         WHERE hlpdsk_timer.RequestI3D = @hlpdsk_requests_I3D AND hlpdsk_timer.Start > CURRENT_TIMESTAMP
     END
     
     OPEN @qryData
     
     FETCH FIRST FROM @qryData INTO
     @hlpdsk_timer_i3D_Intern,
     @hlpdsk_timer_Bemerkung,
     @hlpdsk_timer_typen_WithAddressSpecialArticle,
     @hlpdsk_timer_typen_WithCustomerSpecialArticle,
     @hlpdsk_timer_typen_Bezeichnung,
     
     @Vertragkopf_nummer,
     @vertragsart_bezeichnung,
     
     @GeraeteKopf_Text,
     @GeraeteKopf_Seriennummer,
     @GeraeteKopf_Standort ,
     @GeraeteKopf_Nummer
     
     WHILE @@FETCH_STATUS = 0
     BEGIN
         
         SET @ResultTerminText = REPLACE(@TerminText, @PlatzHalterBemerkung,  @hlpdsk_timer_Bemerkung)
         
         IF @DisplayRequestdetaisInTerminplanner  = 1 --6
         BEGIN
             
             SET @AnfahrtRemoteStr = @hlpdsk_timer_typen_WithAddressSpecialArticle ;
             
             IF @hlpdsk_timer_typen_WithCustomerSpecialArticle <>''
             BEGIN
                 IF @AnfahrtRemoteStr <> ''
                 BEGIN
                     SET @AnfahrtRemoteStr = @AnfahrtRemoteStr + ','
                 END
                 SET @AnfahrtRemoteStr = @AnfahrtRemoteStr + @hlpdsk_timer_typen_WithCustomerSpecialArticle
             END
             
             IF @AnfahrtRemoteStr <> ''
             BEGIN
                 SET @AnfahrtRemoteStr = '(' + @AnfahrtRemoteStr + ')'
             END
             
             SET @ResultTerminText = REPLACE(@ResultTerminText, @PlatzHalterZeittyp,  @hlpdsk_timer_typen_Bezeichnung + ' ' + @AnfahrtRemoteStr)
             
         END
         
         
         IF @DisplayVertragDerZeit = 1
         BEGIN
             
             IF @Vertragkopf_nummer <> 0
             BEGIN
                 SET @PlatzHalterErsatzVertragDerZeit =
                 'Vertrag der Zeit:' + 			@CRLF +
                 '    ' + 'Vertragsnummer: ' + 	CAST ( @Vertragkopf_nummer  AS varchar)  + @CRLF +
                 '    ' + 'Bezeichnung: ' + @vertragsart_bezeichnung
             END
             ELSE
             BEGIN
                 SET @PlatzHalterErsatzVertragDerZeit = 'Vertrag der Zeit: kein'
             END
             
             SET @ResultTerminText = REPLACE(@ResultTerminText, @PlatzHalterVertragDerZeit,  @PlatzHalterErsatzVertragDerZeit)
             
         END
         
         IF @DisplayStammblattDerZeit = 1
         BEGIN
             
             IF @GeraeteKopf_Nummer <> 0
             BEGIN
                 
                 SET @TempStr = @GeraeteKopf_Text
                 SET @TempStr_R = ''
                 SET @UmbruchPos =  (SELECT PATINDEX('%'+ @CRLF +'%', @TempStr))
                 
                 WHILE (@UmbruchPos > 0 )
                 BEGIN
                     SET @TempStr_R   = @TempStr_R +  '         ' + RTRIM(LTRIM(REPLACE(REPLACE(LEFT(@TempStr,@UmbruchPos - 1), CHAR(13), '' ),CHAR(10),''))) + @CRLF
                     SET @TempStr   = LTRIM(RIGHT(@TempStr, LEN(@TempStr)- @UmbruchPos ))
                     SET @UmbruchPos =  (SELECT PATINDEX('%'+ @CRLF +'%', @TempStr))
                 END
                 
                 SET @TempStr_R = @TempStr_R +  '         ' + RTRIM(LTRIM(REPLACE(REPLACE(@TempStr,CHAR(13),''),CHAR(10),'')))
                 
                 SET @PlatzHalterErsatzStammblattDerZeit =
                 'Stammblatt der Zeit:' + 			@CRLF +
                 '    ' + 'Beschreibung: ' + @CRLF + @TempStr_R + @CRLF +
                 '    ' + 'Seriennummer: ' + @GeraeteKopf_Seriennummer  + @CRLF +
                 '    ' + 'Standort: ' + @GeraeteKopf_Standort  + @CRLF +
                 '    ' + 'Nummer: ' + CAST ( @GeraeteKopf_Nummer  AS varchar)
             END
             ELSE
             BEGIN
                 SET @PlatzHalterErsatzStammblattDerZeit = 'Stammblatt der Zeit: kein'
             END
             
             SET @ResultTerminText = REPLACE(@ResultTerminText, @PlatzHalterStammblattDerZeit,  @PlatzHalterErsatzStammblattDerZeit)
             
         END
         
         
         
         IF LEN(@ResultTerminText) > 5000
         SET @ResultTerminText = LEFT(@ResultTerminText,5000)
         
         UPDATE Terminplanung SET [Text] = @ResultTerminText WHERE ObjektArt = @objektArt AND ObjektI3D = @hlpdsk_timer_i3D_Intern
         --print @TerminText
         
         FETCH NEXT FROM @qryData INTO
         @hlpdsk_timer_i3D_Intern,
         @hlpdsk_timer_Bemerkung,
         @hlpdsk_timer_typen_WithAddressSpecialArticle,
         @hlpdsk_timer_typen_WithCustomerSpecialArticle,
         @hlpdsk_timer_typen_Bezeichnung,
         
         @Vertragkopf_nummer,
         @vertragsart_bezeichnung,
         
         @GeraeteKopf_Text,
         @GeraeteKopf_Seriennummer,
         @GeraeteKopf_Standort ,
         @GeraeteKopf_Nummer
         
     END
     
 END
GO
/****** Object:  StoredProcedure [dbo].[TIMESTAMP]    Script Date: 11.11.2025 11:20:32 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[TIMESTAMP](@Result DATETIME output) 
as 
	set @RESULT = CURRENT_TIMESTAMP

GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'This table functions to earmark a campaign participant for the user.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CampaignMarkers'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0 = Neutral |
	1 = Positve |
	2 = Negative' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CampaignParticipants', @level2type=N'COLUMN',@level2name=N'DecisionKind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0 = geplant, 1 = laufen, 2 = geschlossen' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Campaigns', @level2type=N'COLUMN',@level2name=N'State'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0 = Customer
1 = Supplier
2 = Contact' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CSI_SocialMediaStreamAccount', @level2type=N'COLUMN',@level2name=N'AccountKind'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Diese Tabelle beinhaltet die Info zu welchem Konto eine Stream Entität gehört.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CSI_SocialMediaStreamAccount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "device"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 275
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "K"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 267
               Right = 322
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_AssetManagementDevicesOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_AssetManagementDevicesOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 293
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "LA"
            Begin Extent = 
               Top = 6
               Left = 331
               Bottom = 136
               Right = 553
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "RA"
            Begin Extent = 
               Top = 6
               Left = 591
               Bottom = 136
               Right = 813
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Ansch"
            Begin Extent = 
               Top = 6
               Left = 851
               Bottom = 136
               Right = 1073
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Pers"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 268
               Right = 257
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AP"
            Begin Extent = 
               Top = 138
               Left = 295
               Bottom = 268
               Right = 518
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "K"
            Begin Extent = 
               Top = 138
               Left = 556
               Bottom = 268
               Right = 840
            End
            DisplayFlags = 280
            TopColumn = 0
      ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_CreditVoucherHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'   End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_CreditVoucherHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_CreditVoucherHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "AP"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 323
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 361
               Bottom = 136
               Right = 632
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AR"
            Begin Extent = 
               Top = 6
               Left = 670
               Bottom = 136
               Right = 931
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_CreditVoucherPos'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_CreditVoucherPos'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 309
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "LA"
            Begin Extent = 
               Top = 6
               Left = 347
               Bottom = 135
               Right = 585
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "RA"
            Begin Extent = 
               Top = 6
               Left = 623
               Bottom = 135
               Right = 861
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AP"
            Begin Extent = 
               Top = 6
               Left = 899
               Bottom = 135
               Right = 1190
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AR"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 267
               Right = 299
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "K"
            Begin Extent = 
               Top = 138
               Left = 337
               Bottom = 267
               Right = 637
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
    ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_DeliveryListHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'     Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_DeliveryListHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_DeliveryListHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "AP"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 323
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 361
               Bottom = 135
               Right = 632
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AR"
            Begin Extent = 
               Top = 6
               Left = 670
               Bottom = 135
               Right = 931
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_DeliveryListPos'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_DeliveryListPos'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "PER"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 336
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "TMR"
            Begin Extent = 
               Top = 6
               Left = 374
               Bottom = 135
               Right = 599
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1176
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1356
         SortOrder = 1416
         GroupBy = 1350
         Filter = 1356
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_EmployeeHelpdeskTimerStatistic'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_EmployeeHelpdeskTimerStatistic'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 309
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "LA"
            Begin Extent = 
               Top = 6
               Left = 347
               Bottom = 135
               Right = 585
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "RA"
            Begin Extent = 
               Top = 6
               Left = 623
               Bottom = 135
               Right = 861
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Ansch"
            Begin Extent = 
               Top = 138
               Left = 675
               Bottom = 267
               Right = 913
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Pers"
            Begin Extent = 
               Top = 138
               Left = 951
               Bottom = 267
               Right = 1186
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AP"
            Begin Extent = 
               Top = 6
               Left = 899
               Bottom = 135
               Right = 1190
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AR"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 267
               Right = 299
            End
            DisplayFlags = 280
            TopColumn = 0
    ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_InvoiceHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'     End
         Begin Table = "K"
            Begin Extent = 
               Top = 138
               Left = 337
               Bottom = 267
               Right = 637
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_InvoiceHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_InvoiceHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "RK"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 309
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "K"
            Begin Extent = 
               Top = 6
               Left = 347
               Bottom = 136
               Right = 647
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "IH"
            Begin Extent = 
               Top = 6
               Left = 685
               Bottom = 136
               Right = 949
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Z1"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 268
               Right = 291
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "GP"
            Begin Extent = 
               Top = 138
               Left = 329
               Bottom = 268
               Right = 614
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "CP"
            Begin Extent = 
               Top = 138
               Left = 652
               Bottom = 268
               Right = 891
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "GK"
            Begin Extent = 
               Top = 270
               Left = 38
               Bottom = 400
               Right = 309
            End
            DisplayFlags = 280
            TopColumn = 0
         E' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_InvoicePaymentTransaction'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'nd
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 1440
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_InvoicePaymentTransaction'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_InvoicePaymentTransaction'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "AP"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 323
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 361
               Bottom = 135
               Right = 632
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AR"
            Begin Extent = 
               Top = 6
               Left = 670
               Bottom = 135
               Right = 931
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_InvoicePos'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_InvoicePos'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "HN"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "HH"
            Begin Extent = 
               Top = 6
               Left = 246
               Bottom = 135
               Right = 449
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "HNH"
            Begin Extent = 
               Top = 6
               Left = 487
               Bottom = 135
               Right = 680
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_NotifyHelpdeskHistoryOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_NotifyHelpdeskHistoryOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 309
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "LA"
            Begin Extent = 
               Top = 6
               Left = 347
               Bottom = 135
               Right = 585
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "RA"
            Begin Extent = 
               Top = 6
               Left = 623
               Bottom = 135
               Right = 861
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AP"
            Begin Extent = 
               Top = 6
               Left = 899
               Bottom = 135
               Right = 1190
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AR"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 267
               Right = 299
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "K"
            Begin Extent = 
               Top = 138
               Left = 337
               Bottom = 267
               Right = 637
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
    ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_OrderHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'     Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_OrderHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_OrderHead'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "AP"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 323
            End
            DisplayFlags = 280
            TopColumn = 38
         End
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 361
               Bottom = 135
               Right = 632
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AR"
            Begin Extent = 
               Top = 6
               Left = 670
               Bottom = 135
               Right = 931
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_OrderPos'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_OrderPos'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_ScheduleOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_ScheduleOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 261
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "P"
            Begin Extent = 
               Top = 6
               Left = 299
               Bottom = 136
               Right = 597
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaActionEmployeeInteraction'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaActionEmployeeInteraction'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "C"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 243
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "P"
            Begin Extent = 
               Top = 6
               Left = 281
               Bottom = 136
               Right = 563
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "S"
            Begin Extent = 
               Top = 6
               Left = 846
               Bottom = 136
               Right = 1016
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 601
               Bottom = 136
               Right = 808
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "S2"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 268
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaCommentOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaCommentOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "S"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 226
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 264
               Bottom = 136
               Right = 471
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaCustomerFeed'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaCustomerFeed'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaFeed'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaFeed'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "L"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 245
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "P"
            Begin Extent = 
               Top = 6
               Left = 283
               Bottom = 136
               Right = 565
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "S"
            Begin Extent = 
               Top = 6
               Left = 603
               Bottom = 136
               Right = 773
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "A"
            Begin Extent = 
               Top = 6
               Left = 811
               Bottom = 136
               Right = 1018
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "S2"
            Begin Extent = 
               Top = 6
               Left = 1056
               Bottom = 136
               Right = 1226
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaLikeOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_SocialMediaLikeOverview'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_TelemarketingParticipantEmployees'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_TelemarketingParticipantEmployees'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "SA"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 309
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "SR"
            Begin Extent = 
               Top = 6
               Left = 347
               Bottom = 136
               Right = 529
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "S"
            Begin Extent = 
               Top = 6
               Left = 567
               Bottom = 136
               Right = 737
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "SAV"
            Begin Extent = 
               Top = 6
               Left = 775
               Bottom = 136
               Right = 964
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "T"
            Begin Extent = 
               Top = 6
               Left = 1002
               Bottom = 136
               Right = 1209
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_TelemarketingReferenceActions'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_TelemarketingReferenceActions'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "SR"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 136
               Right = 248
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "K"
            Begin Extent = 
               Top = 6
               Left = 286
               Bottom = 136
               Right = 570
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Kon"
            Begin Extent = 
               Top = 6
               Left = 608
               Bottom = 136
               Right = 830
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "P"
            Begin Extent = 
               Top = 6
               Left = 868
               Bottom = 136
               Right = 1087
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "KonP"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 268
               Right = 252
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AK"
            Begin Extent = 
               Top = 138
               Left = 290
               Bottom = 268
               Right = 545
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "RK"
            Begin Extent = 
               Top = 138
               Left = 583
               Bottom = 268
               Right = 838
            End
            DisplayFlags = 280
            TopColumn = 0
        ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_TelemarketingReferences'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N' End
         Begin Table = "B"
            Begin Extent = 
               Top = 138
               Left = 876
               Bottom = 251
               Right = 1046
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_TelemarketingReferences'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'cvw_TelemarketingReferences'
GO
USE [master]
GO
ALTER DATABASE [CentronVOED2] SET  READ_WRITE 
GO
