CREATE TABLE [D030-10-2].[DSAHIST_TEA_K_Header](
  [Linjetype] [int] NULL,
  [Header_1] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_2] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_3] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_4] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_5] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_6] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_7] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_8] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_9] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_10] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_11] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_12] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_13] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_14] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [Header_15] [varchar](200) COLLATE Norwegian_100_CI_AS NULL,
  [SYS_KommuneId] [int] NULL,
  [SYS_BatchDate] [datetime2](3) NULL,
  [SYS_RowID] [bigint] identity(1,1) NOT NULL,
  [SYS_ExtractDate] [datetime2](3) NULL,
  [SYS_SourceFileID] [varchar](80) COLLATE Norwegian_100_CI_AS NULL,
  [SYS_RettelserTidAngivelse] [datetime2](3) NULL,
  [SYS_VersionID] [bigint] NULL,
  [SYS_Checksum] AS (CONVERT([bigint],hashbytes('SHA2_256',concat([Linjetype],[Header_1],[Header_2],[Header_3],[Header_4],[Header_5],[Header_6],[Header_7],[Header_8],[Header_9],[Header_10],[Header_11],[Header_12],[Header_13],[Header_14],[Header_15])),0)) PERSISTED,
  [SYS_ExecutionId] [bigint] NULL,
  [SYS_DataDeliveryBatchId_Create] [bigint] NULL
) 
on sys_batch_date_sc(SYS_BatchDate)
GO

CREATE UNIQUE CLUSTERED INDEX [IDX_CL_D030-10-2_DSAHIST_TEA_K_Header] On [D030-10-2].[DSAHIST_TEA_K_Header] (SYS_BatchDate, SYS_KommuneId, SYS_RowID) with (data_compression = page, STATISTICS_INCREMENTAL = ON) on sys_batch_date_sc(SYS_BatchDate);
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Har værdien 2', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Linjetype';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_1';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_2';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_3';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_4';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_5';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_6';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_7';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_8';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_9';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_10';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_11';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_12';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_13';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_14';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'Header_15';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Dette er en teknisk Kolonne i FLIS. Indeholder nummeret på den kommune, som rækken tilhører', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_KommuneId';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Dette er en teknisk Kolonne i FLIS. Indeholder information om, hvilken batch rækken er indlæst i', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_BatchDate';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Dette er en teknisk Kolonne i FLIS. Indeholder et fortløbende nummer, så alle rækker i tabellen har et unikt nummer', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_RowID';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Dette er en teknisk Kolonne i FLIS. Indeholder det dato stempel, som kildefilen er markeret med', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_ExtractDate';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Dette er en teknisk Kolonne i FLIS. Indeholder ID for den primære snitflade, hvor data i rækken stammer fra', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_SourceFileID';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Dette er en teknisk Kolonne i FLIS. Indeholder den forretningsmæssige tidsangivelse for rækken. Denne bruges hvis data skal slettes med tidsangivelse', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_RettelserTidAngivelse';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Dette er en teknisk Kolonne i FLIS. Indeholder et versionsnummer for den pågældende række', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_VersionID';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Dette er en teknisk Kolonne i FLIS. Indeholder cheksum info', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_Checksum';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'SysExecutionId', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_ExecutionId';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'SysDataDeliveryBatchIdCreate', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header', 
@level2type = N'COLUMN', @level2name = N'SYS_DataDeliveryBatchId_Create';
GO

EXEC sys.sp_addextendedproperty 
@name = N'DataArea', 
@value = N'skole', 
@level0type = N'SCHEMA', @level0name = N'D030-10-2', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_TEA_K_Header';
GO

