CREATE TABLE [DFDG].[FactAktivering](
  [FactAktiveringID] [bigint] NULL,
  [CPRNummer] [varchar](10) COLLATE Norwegian_100_CI_AS NULL,
  [DimBorger] [bigint] NULL,
  [DimAktivering] [bigint] NULL,
  [DimOrganisationAnsvarlig] [bigint] NULL,
  [DimOrganisationAktiv] [bigint] NULL,
  [DimJobType] [bigint] NULL,
  [DimStatsligtJob] [bigint] NULL,
  [DimAMU] [bigint] NULL,
  [DimKursus] [bigint] NULL,
  [DimHjaelpemiddel] [bigint] NULL,
  [DimPersonligAssistent] [bigint] NULL,
  [KursusTitel] [varchar](100) COLLATE Norwegian_100_CI_AS NULL,
  [DimTidStart] [bigint] NULL,
  [DimTidSlut] [bigint] NULL,
  [DimKommune] [bigint] NULL,
  [TimerPerUge] [bigint] NULL,
  [MinutterPerUge] [bigint] NULL,
  [HjaelpemiddelPris] [decimal](28,18) NULL,
  [PersonligAssistentTimepris] [decimal](28,18) NULL,
  [PersonligAssistentAndenUdgift] [decimal](28,18) NULL,
  [AntalDageAktiveret] [bigint] NULL,
  [SYS_KommuneId] [int] NULL,
  [SYS_BatchDate] [datetime2](3) NULL,
  [SYS_RowID] [bigint] identity(1,1) NOT NULL,
  [SYS_ExtractDate] [datetime2](3) NULL,
  [SYS_ExecutionId] [bigint] NULL
) 
ON [PRIMARY]
--with (data_compression = page)
GO

CREATE UNIQUE CLUSTERED INDEX [IDX_CL_DFDG_FactAktivering]
On [DFDG].[FactAktivering] ([SYS_KommuneId], [SYS_RowID])
--with (data_compression = page)
ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Facttabel indeholdende aktiveringsforløb', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Id', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'FactAktiveringID';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver borgerens CPR-nummer.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'CPRNummer';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver borgerens id.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimBorger';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver aktiverings id, som relaterer sig til DimAktivering.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimAktivering';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Koden som identificerer organisationen.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimOrganisationAnsvarlig';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Koden som identificerer organisationen brugeren udgiver sig for.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimOrganisationAktiv';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver aktivitets jobtype.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimJobType';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver om aktiviteten er et statsligt job.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimStatsligtJob';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver aktivitetens AMU kursus.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimAMU';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver aktivitetens kursus.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimKursus';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver aktivitetens hjælpemiddel.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimHjaelpemiddel';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver aktivitetens personligt assistent.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimPersonligAssistent';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver kursustitlen.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'KursusTitel';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver startdatoen for aktiviteten.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimTidStart';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver slutdatoen for aktiviteten.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimTidSlut';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver kommunen.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'DimKommune';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver antallet af timer pr. uge den givne aktivitet er registreret med', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'TimerPerUge';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver antallet af minutter pr. uge den givne aktivitet er registreret med', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'MinutterPerUge';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver prisen på aktivitetens tilknyttede hjælpemiddel.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'HjaelpemiddelPris';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver timeprisen på aktivitetens tilknyttede personlige assistent.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'PersonligAssistentTimepris';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver andre udgifter på aktivitetens tilknyttede personligt assistent.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'PersonligAssistentAndenUdgift';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Angiver differerencen mellem DimTidStart og DimTidSlut i dage.', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'AntalDageAktiveret';
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'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@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'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@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'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@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'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'SYS_ExtractDate';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'SysExecutionId', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering', 
@level2type = N'COLUMN', @level2name = N'SYS_ExecutionId';
GO

EXEC sys.sp_addextendedproperty 
@name = N'DataArea', 
@value = N'dfdg', 
@level0type = N'SCHEMA', @level0name = N'DFDG', 
@level1type = N'TABLE',  @level1name = N'FactAktivering';
GO

