SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[TBREC_OUT_RESULT](
	[GUID] [bigint] IDENTITY(1,1) NOT NULL,
	[ACTION_ID] [bigint] NOT NULL,
	[STATUS_ID] [smallint] NOT NULL,
	[RESULT_TYPE_ID] [tinyint] NOT NULL,
	[RESULT_HEADER] [nvarchar](max) NULL,
	[RESULT_BODY] [nvarchar](max) NULL,
	[RESULT_INFO] [nvarchar](max) NULL,
	[RESULT_ERROR] [nvarchar](max) NULL,
	[ADDED_WHO] [nvarchar](50) NOT NULL,
	[ADDED_WHEN] [datetime] NOT NULL,
	[CHANGED_WHO] [nvarchar](50) NULL,
	[CHANGED_WHEN] [datetime] NULL,
 CONSTRAINT [PK_TBREC_OUT_RESULT_GUID] PRIMARY KEY 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

ALTER TABLE [dbo].[TBREC_OUT_RESULT] ADD  CONSTRAINT [DF_TBREC_OUT_RESULT_ADDED_WHO]  DEFAULT (suser_sname()) FOR [ADDED_WHO]
GO

ALTER TABLE [dbo].[TBREC_OUT_RESULT] ADD  CONSTRAINT [DF_TBREC_OUT_RESULT_ADDED_WHEN]  DEFAULT (sysdatetime()) FOR [ADDED_WHEN]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Primärschlüssel' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'GUID'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Action-Referenz' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'ACTION_ID'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Antwort-Code' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'STATUS_ID'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Antwort von Schritt 1=Pre; 2=Main; 3=Post' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'RESULT_TYPE_ID'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Antwort-Header' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'RESULT_HEADER'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Antwort-Body' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'RESULT_BODY'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Optionaler Antwort Infotext' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'RESULT_INFO'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Optionaler Antwort Fehlertext' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'RESULT_ERROR'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Angelegt von' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'ADDED_WHO'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Angelegt am' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'ADDED_WHEN'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Geaendert von' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'CHANGED_WHO'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Geaendert am' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TBREC_OUT_RESULT', @level2type=N'COLUMN',@level2name=N'CHANGED_WHEN'
GO
