USE [DD_ECM]
GO

/****** Object:  Table [dbo].[TBDEX_CFG_OUT_FILE]    Script Date: 07.12.2025 23:12:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[TBDEX_CFG_OUT_FILE](
	[GUID] [bigint] IDENTITY(1,1) NOT NULL,
	[PROFILE_ID] [bigint] NOT NULL,
	[ACTIVE] [bit] NOT NULL,
	[EXPORT_HEADER] [bit] NOT NULL,
	[FILE_TYPE] [nvarchar](50) NOT NULL,
	[FILE_NAME_SEPARATOR] [nvarchar](50) NOT NULL,
	[FILE_DATA_SEPARATOR] [nvarchar](50) NOT NULL,
	[FILE_BASE_NAME] [nvarchar](50) NOT NULL,
	[FILE_COUNTER_SCHEMA] [nvarchar](50) NOT NULL,
	[FILE_COUNTER] [bigint] NOT NULL,
	[FILE_EXTENSION] [nvarchar](5) NOT NULL,
	[FILE_PATH_TEMP] [nvarchar](255) NOT NULL,
	[FILE_PATH_EXPORT] [nvarchar](255) NOT NULL,
	[FILE_PATH_ARCHIV] [nvarchar](255) NOT NULL,
	[FILE_PATH_ERROR] [nvarchar](255) 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_OUT_FILE] 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_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_ACTIVE]  DEFAULT ((0)) FOR [ACTIVE]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_EXPORT_HEADER]  DEFAULT ((0)) FOR [EXPORT_HEADER]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_NAME_SEPARATOR]  DEFAULT ('_') FOR [FILE_NAME_SEPARATOR]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_DATA_SEPARATOR]  DEFAULT (';') FOR [FILE_DATA_SEPARATOR]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_BASE_NAME]  DEFAULT ('ExportFile_') FOR [FILE_BASE_NAME]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_COUNTER_SCHEMA]  DEFAULT ('YY00000') FOR [FILE_COUNTER_SCHEMA]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_COUNTER]  DEFAULT ((0)) FOR [FILE_COUNTER]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_EXTENSION]  DEFAULT ('CSV') FOR [FILE_EXTENSION]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_PATH_TEMP]  DEFAULT ('E:\FileProcessing\Temp\File\<ProfileName>') FOR [FILE_PATH_TEMP]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_PATH_EXPORT]  DEFAULT ('E:\FileProcessing\Output\File\<ProfileName>') FOR [FILE_PATH_EXPORT]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_PATH_ARCHIV]  DEFAULT ('E:\FileProcessing\Archive\File\<ProfileName>') FOR [FILE_PATH_ARCHIV]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_PATH_ERROR]  DEFAULT ('E:\FileProcessing\Error\File\<ProfileName>') FOR [FILE_PATH_ERROR]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_ADDED_WHO]  DEFAULT ('DEFAULT') FOR [ADDED_WHO]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] ADD  CONSTRAINT [DF_TBDEX_CFG_OUT_FILE_ADDED_WHEN]  DEFAULT (getdate()) FOR [ADDED_WHEN]
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE]  WITH CHECK ADD  CONSTRAINT [FK_TBDEX_CFG_OUT_FILE_TBDEX_CFG_PROFILE] FOREIGN KEY([PROFILE_ID])
REFERENCES [dbo].[TBDEX_CFG_PROFILE] ([GUID])
GO

ALTER TABLE [dbo].[TBDEX_CFG_OUT_FILE] CHECK CONSTRAINT [FK_TBDEX_CFG_OUT_FILE_TBDEX_CFG_PROFILE]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Link PROFILE_ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBDEX_CFG_OUT_FILE', @level2type=N'CONSTRAINT',@level2name=N'FK_TBDEX_CFG_OUT_FILE_TBDEX_CFG_PROFILE'
GO


