USE [DD_ECM]
GO

/****** Object:  Table [dbo].[TBDEX_CFG_PROFILE]    Script Date: 07.12.2025 23:16:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[TBDEX_CFG_PROFILE](
	[GUID] [bigint] IDENTITY(1,1) NOT NULL,
	[ACTIVE] [bit] NOT NULL,
	[PROFILE_NAME] [nvarchar](50) NOT NULL,
	[DESCRIPTION] [nvarchar](250) NULL,
	[MANDANTOR] [nvarchar](50) NOT NULL,
	[EXPORT_TYPE] [nvarchar](50) NOT NULL,
	[EXPORT_NUMBER_SCHEMA] [nvarchar](25) NOT NULL,
	[DEFAULT_DATA_SEPARATOR] [nvarchar](10) NULL,
	[LOG_LEVEL] [nvarchar](5) NOT NULL,
	[LANGUAGE] [nvarchar](10) NOT NULL,
	[ADDED_WHO] [nvarchar](50) NOT NULL,
	[ADDED_WHEN] [datetime] NOT NULL,
	[CHANGED_WHO] [nvarchar](50) NULL,
	[CHANGED_WHEN] [datetime] NULL,
 CONSTRAINT [PK_TBDEX_CFG_PROFILE] PRIMARY KEY CLUSTERED 
(
	[GUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = ON, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] ADD  CONSTRAINT [DF_TBDEX_CFG_PROFILE_ACTIVE]  DEFAULT ((0)) FOR [ACTIVE]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] ADD  CONSTRAINT [DF_TBDEX_CFG_PROFILE_MANDANTOR]  DEFAULT ('DEFAULT') FOR [MANDANTOR]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] ADD  CONSTRAINT [DF_TBDEX_CFG_PROFILE_EXPORT_TYPE]  DEFAULT (N'DB') FOR [EXPORT_TYPE]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] ADD  CONSTRAINT [DF_TBDEX_CFG_PROFILE_LOG_LEVEL]  DEFAULT ('ERROR') FOR [LOG_LEVEL]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] ADD  CONSTRAINT [DF_TBDEX_CFG_PROFILE_LANGUAGE]  DEFAULT ('de_DE') FOR [LANGUAGE]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] ADD  CONSTRAINT [DF_TBDEX_CFG_PROFILE_ADDED_WHO]  DEFAULT ('DEFAULT') FOR [ADDED_WHO]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] ADD  CONSTRAINT [DF_TBDEX_CFG_PROFILE_ADDED_WHEN]  DEFAULT (getdate()) FOR [ADDED_WHEN]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE]  WITH CHECK ADD  CONSTRAINT [CK_TBDEX_CFG_PROFILE_EXPORT_TYPE] CHECK  ((upper([EXPORT_TYPE])='DB' OR upper([EXPORT_TYPE])='CSV_FILE'))
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] CHECK CONSTRAINT [CK_TBDEX_CFG_PROFILE_EXPORT_TYPE]
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE]  WITH CHECK ADD  CONSTRAINT [CK_TBDEX_CFG_PROFILE_LOG_LEVEL] CHECK  ((upper([LOG_LEVEL])='ERROR' OR upper([LOG_LEVEL])='WARN' OR upper([LOG_LEVEL])='INFO'))
GO

ALTER TABLE [dbo].[TBDEX_CFG_PROFILE] CHECK CONSTRAINT [CK_TBDEX_CFG_PROFILE_LOG_LEVEL]
GO


