CREATE TABLE [D001-18-1].[DSAHIST_ZD2I3_Normering](
  [TIMESTAMP] [varchar](15) COLLATE Norwegian_100_CI_AS NULL,
  [DATAPAKID] [varchar](6) COLLATE Norwegian_100_CI_AS NULL,
  [PARTNO] [varchar](10) COLLATE Norwegian_100_CI_AS NULL,
  [RECORD] [varchar](10) COLLATE Norwegian_100_CI_AS NULL,
  [ZIKOM] [varchar](5) COLLATE Norwegian_100_CI_AS NULL,
  [CALDAY0] [datetime2](3) NULL,
  [ZIINST] [bigint] NULL,
  [ZIALDFRA] [bigint] NULL,
  [ZIKODPAST] [bigint] NULL,
  [CALYEAR0] [int] NULL,
  [RECORDMODE0] [varchar](1) COLLATE Norwegian_100_CI_AS NULL,
  [CALMONTH0] [int] NULL,
  [CALMONTH20] [int] NULL,
  [FISCPER0] [int] NULL,
  [FISCVARNT0] [varchar](2) COLLATE Norwegian_100_CI_AS NULL,
  [FISCPER30] [int] NULL,
  [FISCYEAR0] [int] NULL,
  [CALQUART10] [int] NULL,
  [HALFYEAR10] [int] NULL,
  [ZIBOFICPE] [varchar](6) COLLATE Norwegian_100_CI_AS NULL,
  [ORGUNIT0] [int] NULL,
  [ZIOU_BO] [int] NULL,
  [ZIADMID] [int] NULL,
  [ZIUDTDATO] [datetime2](3) NULL,
  [ZIALDTIL] [int] NULL,
  [ZIFAKTNOR] [decimal](17,3) NULL,
  [ZIBEVLNOR] [decimal](17,3) NULL,
  [UNIT0] [decimal](3,0) NULL,
  [ZIGPNORM] [decimal](17,3) NULL,
  [ZIBELOBPA] [decimal](17,2) NULL,
  [CURRENCY0] [varchar](5) COLLATE Norwegian_100_CI_AS NULL,
  [ZIBELOBDR] [decimal](17,2) NULL,
  [ZINORMPA] [decimal](17,2) NULL,
  [ZINORMDR] [decimal](17,2) 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([TIMESTAMP],[DATAPAKID],[PARTNO],[RECORD],[ZIKOM],[CALDAY0],[ZIINST],[ZIALDFRA],[ZIKODPAST],[CALYEAR0],[RECORDMODE0],[CALMONTH0],[CALMONTH20],[FISCPER0],[FISCVARNT0],[FISCPER30],[FISCYEAR0],[CALQUART10],[HALFYEAR10],[ZIBOFICPE],[ORGUNIT0],[ZIOU_BO],[ZIADMID],[ZIUDTDATO],[ZIALDTIL],[ZIFAKTNOR],[ZIBEVLNOR],[UNIT0],[ZIGPNORM],[ZIBELOBPA],[CURRENCY0],[ZIBELOBDR],[ZINORMPA],[ZINORMDR])),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-18-1_DSAHIST_ZD2I3_Normering] On [D001-18-1].[DSAHIST_ZD2I3_Normering] (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'Normeringer i daginstitutioner.', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Timestamp', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'TIMESTAMP';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'DatapakkeID', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'DATAPAKID';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Partno', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'PARTNO';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'RecordNO', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'RECORD';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Kunde identifikation', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIKOM';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Kalenderdag', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'CALDAY0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Institution', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIINST';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Fra alder', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIALDFRA';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Pasningsmodul', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIKODPAST';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Kalenderår', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'CALYEAR0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'BW-deltaprocedure: Opdateringsmode', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'RECORDMODE0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Kalenderår/måned', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'CALMONTH0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Kalendermåned', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'CALMONTH20';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Regnskabsår/periode', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'FISCPER0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Regnskabsårsvariant', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'FISCVARNT0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Bogføringsperiode', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'FISCPER30';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Regnskabsår', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'FISCYEAR0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Kvartal', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'CALQUART10';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Halvår', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'HALFYEAR10';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Regnskabsår/måned', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIBOFICPE';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Organisatorisk enhed', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ORGUNIT0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Organisatorisk Enhed til BO', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIOU_BO';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Administrativ Enhed', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIADMID';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Udtræksdato', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIUDTDATO';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Til alder', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIALDTIL';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Normeringsfaktor', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIFAKTNOR';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Normering', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIBEVLNOR';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Mængdeenhed', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'UNIT0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Gæstepladser', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIGPNORM';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Pasningsmodul takst', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIBELOBPA';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Valutanøgle', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'CURRENCY0';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Pasningsmodul driftsudgift', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZIBELOBDR';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Normindtægt', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZINORMPA';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Normudgift', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'ZINORMDR';
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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@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-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering', 
@level2type = N'COLUMN', @level2name = N'SYS_DataDeliveryBatchId_Create';
GO

EXEC sys.sp_addextendedproperty 
@name = N'DataArea', 
@value = N'dagtilbud', 
@level0type = N'SCHEMA', @level0name = N'D001-18-1', 
@level1type = N'TABLE',  @level1name = N'DSAHIST_ZD2I3_Normering';
GO

