USE [DD_ECM]
GO

/****** Object:  Table [dbo].[TBDEX_TMP_PROCESS_REFERENCES]    Script Date: 07.12.2025 23:29:37 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[TBDEX_TMP_PROCESS_REFERENCES]
(
	[GUID] [bigint] IDENTITY(1,1) NOT NULL,
	[PROFILE_ID] [bigint] NOT NULL,
	[BATCH_ID] [nvarchar](25) COLLATE Latin1_General_CI_AS NOT NULL,
	[REFERENCE1] [nvarchar](150) COLLATE Latin1_General_CI_AS NULL,
	[REFERENCE2] [nvarchar](150) COLLATE Latin1_General_CI_AS NULL,
	[REFERENCE3] [nvarchar](150) COLLATE Latin1_General_CI_AS NULL,
	[REFERENCE4] [nvarchar](150) COLLATE Latin1_General_CI_AS NULL,
	[REFERENCE5] [nvarchar](150) COLLATE Latin1_General_CI_AS NULL,
	[EXTERNAL_REFERENCE1] [nvarchar](2000) COLLATE Latin1_General_CI_AS NULL,
	[EXTERNAL_REFERENCE2] [nvarchar](2000) COLLATE Latin1_General_CI_AS NULL,
	[EXTERNAL_REFERENCE3] [nvarchar](2000) COLLATE Latin1_General_CI_AS NULL,
	[EXTERNAL_REFERENCE4] [nvarchar](2000) COLLATE Latin1_General_CI_AS NULL,
	[EXTERNAL_REFERENCE5] [nvarchar](2000) COLLATE Latin1_General_CI_AS NULL,
	[EXPORT_NUMBER_COUNTER] [bigint] NULL,
	[EXPORT_NUMBER] [nvarchar](25) COLLATE Latin1_General_CI_AS NULL,
	[COMMENT] [nvarchar](150) COLLATE Latin1_General_CI_AS NULL,
	[ADDED_WHO] [nvarchar](50) COLLATE Latin1_General_CI_AS NOT NULL,
	[ADDED_WHEN] [datetime] NOT NULL,

 CONSTRAINT [PK_TBDEX_TMP_PROCESS_REFERENCES]  PRIMARY KEY NONCLUSTERED 
(
	[GUID] ASC
)
)WITH ( MEMORY_OPTIMIZED = ON , DURABILITY = SCHEMA_ONLY )
GO

ALTER TABLE [dbo].[TBDEX_TMP_PROCESS_REFERENCES] ADD  CONSTRAINT [DF_TBDEX_TMP_PROCESS_REFERENCES_ADDED_WHO]  DEFAULT ('DEFAULT') FOR [ADDED_WHO]
GO

ALTER TABLE [dbo].[TBDEX_TMP_PROCESS_REFERENCES] ADD  CONSTRAINT [DF_TBDEX_TMP_PROCESS_REFERENCES_ADDED_WHEN]  DEFAULT (getdate()) FOR [ADDED_WHEN]
GO

ALTER TABLE [dbo].[TBDEX_TMP_PROCESS_REFERENCES] ADD INDEX [IX_TBDEX_TMP_PROCESS_REFERENCES_PROFILE_BATCH] NONCLUSTERED ([PROFILE_ID],[BATCH_ID]);
GO

ALTER TABLE [dbo].[TBDEX_TMP_PROCESS_REFERENCES] ADD INDEX [IX_TBDEX_TMP_PROCESS_REFERENCES_PROFILE_BATCH_EXPORT] NONCLUSTERED ([PROFILE_ID],[BATCH_ID],[EXPORT_NUMBER]);
GO


