CREATE TABLE [D110-10-1].[DSA_GrupperingTemp](
  [Startdato] [datetime2](3) NULL,
  [Slutdato] [datetime2](3) NULL,
  [F1] [int] NULL,
  [F2] [int] NULL,
  [F3] [int] NULL,
  [DR] [int] NULL,
  [F1F2] [varchar](5) COLLATE Norwegian_100_CI_AS NULL,
  [F1F2F3] [varchar](8) COLLATE Norwegian_100_CI_AS NULL,
  [Hovedkonto] [varchar](60) COLLATE Norwegian_100_CI_AS NULL,
  [Hovedfunktion] [varchar](60) COLLATE Norwegian_100_CI_AS NULL,
  [Funktion] [varchar](80) COLLATE Norwegian_100_CI_AS NULL,
  [Dranst] [varchar](60) COLLATE Norwegian_100_CI_AS NULL,
  [Gr] [varchar](3) COLLATE Norwegian_100_CI_AS NULL,
  [Gruppering] [varchar](300) 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_VersionID] [bigint] NULL,
  [SYS_Checksum] [bigint] NULL,
  [SYS_ExecutionId] [bigint] NULL
) 
ON [DSA]
--with (data_compression = page)
GO

CREATE UNIQUE CLUSTERED INDEX [IDX_CL_D110-10-1_DSA_GrupperingTemp]
On [D110-10-1].[DSA_GrupperingTemp] ([SYS_KommuneId], [SYS_BatchDate], [SYS_RowID])
--with (data_compression = page)
ON [DSA]
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Temp tabel til bearbejdning af gruppering uden angivet Dranst', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'Startdato';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'Slutdato';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'F1';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'F2';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'F3';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'DR';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'F1F2';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'F1F2F3';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'Hovedkonto';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'Hovedfunktion';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'Funktion';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'Dranst';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'Gr';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'Gruppering';
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'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@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'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@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'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@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'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@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'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@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 et versionsnummer for den pågældende række', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@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'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp', 
@level2type = N'COLUMN', @level2name = N'SYS_Checksum';
GO

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

EXEC sys.sp_addextendedproperty 
@name = N'DataArea', 
@value = N'generel', 
@level0type = N'SCHEMA', @level0name = N'D110-10-1', 
@level1type = N'TABLE',  @level1name = N'DSA_GrupperingTemp';
GO

