CREATE TABLE [D001-11-8].[DSAHIST_OØ_SL_0WBS_ELEMT_ATTR](
  [ZIKOM] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [WBS_ELEMT0] [nvarchar](100) COLLATE Norwegian_100_CI_AS NULL,
  [PROJECT0] [nvarchar](100) COLLATE Norwegian_100_CI_AS NULL,
  [PS_RESPNO0] [int] NULL,
  [ZISLWID] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIUSR00] [nvarchar](100) COLLATE Norwegian_100_CI_AS NULL,
  [ZIUSR01] [nvarchar](100) COLLATE Norwegian_100_CI_AS NULL,
  [ZIUSR02] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIUSR03] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIUSR04] [bigint] NULL,
  [ZIUSR05] [bigint] NULL,
  [ZIUSR06] [bigint] NULL,
  [ZIUSR07] [bigint] NULL,
  [ZIUSR08] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIUSR09] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIUSR10] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIUSR11] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZISPAER] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIPLSP] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIKTSP] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIPLANOK] [nvarchar](50) COLLATE Norwegian_100_CI_AS NULL,
  [ZIWBS_5] [nvarchar](50) 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([ZIKOM],[WBS_ELEMT0],[PROJECT0],[PS_RESPNO0],[ZISLWID],[ZIUSR00],[ZIUSR01],[ZIUSR02],[ZIUSR03],[ZIUSR04],[ZIUSR05],[ZIUSR06],[ZIUSR07],[ZIUSR08],[ZIUSR09],[ZIUSR10],[ZIUSR11],[ZISPAER],[ZIPLSP],[ZIKTSP],[ZIPLANOK],[ZIWBS_5])),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_D001-11-8_DSAHIST_OØ_SL_0WBS_ELEMT_ATTR] On [D001-11-8].[DSAHIST_OØ_SL_0WBS_ELEMT_ATTR] (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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Kommuneidentifikation - unik nummer pr. kommune. Antager 3 karakterer.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIKOM';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Samler indtægter og specifikke udgifter på PSP-elementer. Anvendes sammen med Artskonto til budgettering og kontering på laveste niveau. F.eks. er PSP-element XG-3240010010-10045: Beboeres betaling (§163). Medtager fra laveste databærende niveau.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'WBS_ELEMT0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Indenfor projektstyring (sagsstyring) opsamles de PSP-elementer, som er oprettet i relation til projektet. F.eks. vil PSP-element XG-5000010000-01020 være tilknyttet Projekt XG-5000010000-01000.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'PROJECT0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Viser Ansvarlig for givent PSP-element i de tilfældet, hvor det er anført', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'PS_RESPNO0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'viser data afgrænset efter kundespecifik definition. Har relation til PSP-element', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZISLWID';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR00';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR01';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR02';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR03';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR04';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR05';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR06';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR07';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR08';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR09';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR10';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Anvendes til specifikke formål i kommunen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIUSR11';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Viser data over spærret PSP-elementer. Anvendes i budgetprocessen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZISPAER';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Viser om PSP-element er planlagt spærret (X/ja, #/nej)', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIPLSP';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Viser om PSP-element er spærret for kontering', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIKTSP';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Viser data for planlægning og spærring. Anvendes i budgetprocessen.', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIPLANOK';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Viser PSP-element fordelt på deres 5 cifret løbenummer', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'ZIWBS_5';
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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@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'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'SYS_Checksum';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'SysExecutionId', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'SYS_ExecutionId';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'SysDataDeliveryBatchIdCreate', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR', 
@level2type = N'COLUMN', @level2name = N'SYS_DataDeliveryBatchId_Create';
GO

EXEC sys.sp_addextendedproperty 
@name = N'DataArea', 
@value = N'oekonomi', 
@level0type = N'SCHEMA', @level0name = N'D001-11-8', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_OØ_SL_0WBS_ELEMT_ATTR';
GO

