USE [DD_ECM]
GO

/****** Object:  Table [dbo].[TBDEX_TMP_QUERY]    Script Date: 07.12.2025 23:30:22 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[TBDEX_TMP_QUERY]
(
	[GUID] [bigint] IDENTITY(1,1) NOT NULL,
	[PROFILE_ID] [bigint] NOT NULL,
	[BATCH_ID] [nvarchar](25) COLLATE Latin1_General_CI_AS NOT NULL,
	[QUERY] [nvarchar](max) COLLATE Latin1_General_CI_AS NOT 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_QUERY]  PRIMARY KEY NONCLUSTERED 
(
	[GUID] ASC
)
)WITH ( MEMORY_OPTIMIZED = ON , DURABILITY = SCHEMA_ONLY )
GO

ALTER TABLE [dbo].[TBDEX_TMP_QUERY] ADD  CONSTRAINT [DF_TBDEX_TMP_QUERY_ADDED_WHO]  DEFAULT ('DEFAULT') FOR [ADDED_WHO]
GO

ALTER TABLE [dbo].[TBDEX_TMP_QUERY] ADD  CONSTRAINT [DF_TBDEX_TMP_QUERY_ADDED_WHEN]  DEFAULT (getdate()) FOR [ADDED_WHEN]
GO

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


