CREATE TABLE [DREAM].[DimDreamBranche](
  [DimDreamBrancheID] [bigint] identity(1,1) NOT NULL,
  [BrancheKode] [bigint] NULL,
  [Branche] [varchar](150) COLLATE Norwegian_100_CI_AS NULL,
  [Branche127] [varchar](150) COLLATE Norwegian_100_CI_AS NULL,
  [Branche38] [varchar](150) COLLATE Norwegian_100_CI_AS NULL,
  [Branche21] [varchar](150) COLLATE Norwegian_100_CI_AS NULL,
  [Branche10] [varchar](150) COLLATE Norwegian_100_CI_AS NULL,
  [SYS_KommuneId] [int] NULL,
  [SYS_BatchDate] [datetime2](3) NULL,
  [SYS_RowID] AS ([DimDreamBrancheID]) ,
  [SYS_ExtractDate] [datetime2](3) NULL,
  [SYS_ExecutionId] [bigint] NULL,
  CONSTRAINT PK_DimDreamBranche PRIMARY KEY CLUSTERED (DimDreamBrancheID)
) 
ON [PRIMARY]
--with (data_compression = page)
GO

CREATE INDEX [IDX_Kommune_DREAM_DimDreamBranche]
On [DREAM].[DimDreamBranche] ([SYS_KommuneId], [SYS_ExecutionId])
--with (data_compression = page)
ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Indeholder beskrivelse af en branchekode registreret i DREAM (Evt. crossjoin med Virksomhedsform?)', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'ID', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@level2type = N'COLUMN', @level2name = N'DimDreamBrancheID';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Den naturlige nøgle', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@level2type = N'COLUMN', @level2name = N'BrancheKode';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Brancheens branche', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@level2type = N'COLUMN', @level2name = N'Branche';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Brancheens branche127', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@level2type = N'COLUMN', @level2name = N'Branche127';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Brancheens branche38', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@level2type = N'COLUMN', @level2name = N'Branche38';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Brancheens branche21', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@level2type = N'COLUMN', @level2name = N'Branche21';
GO

EXEC sys.sp_addextendedproperty 
@name = N'MS_Description', 
@value = N'Brancheens branche10', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@level2type = N'COLUMN', @level2name = N'Branche10';
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'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@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'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@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'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@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'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche', 
@level2type = N'COLUMN', @level2name = N'SYS_ExtractDate';
GO

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

EXEC sys.sp_addextendedproperty 
@name = N'DataArea', 
@value = N'dream', 
@level0type = N'SCHEMA', @level0name = N'DREAM', 
@level1type = N'TABLE',  @level1name = N'DimDreamBranche';
GO

