﻿CREATE TABLE [tmp].[ProductionLogRaw_KO] (
    [EventStart]  NVARCHAR (50)  NOT NULL,
    [EventEnd]    NVARCHAR (50)  NOT NULL,
    [CodPlant]    NVARCHAR (50)  NOT NULL,
    [ProcessNum]  NVARCHAR (50)  NOT NULL,
    [NrPos]       NVARCHAR (50)  CONSTRAINT [DF_ProductionLogRaw_NrPos_KO] DEFAULT ('') NOT NULL,
    [CodDies]     NVARCHAR (50)  NOT NULL,
    [CodClient]   NVARCHAR (50)  NOT NULL,
    [OrderNum]    NVARCHAR (50)  NOT NULL,
    [BatchNum]    NVARCHAR (50)  NOT NULL,
    [ProcessType] NVARCHAR (50)  NOT NULL,
    [EventType]   NVARCHAR (50)  NOT NULL,
    [RawMat]      NVARCHAR (50)  NOT NULL,
    [CodPackag]   NVARCHAR (50)  NOT NULL,
    [QtyIN]       NVARCHAR (50)  NOT NULL,
    [QtyOUT]      NVARCHAR (50)  NOT NULL,
    [QtyEXT]      NVARCHAR (50)  NOT NULL,
    [NumIN]       NVARCHAR (50)  NOT NULL,
    [NumOUT]      NVARCHAR (50)  NOT NULL,
    [QuotaPlant]  NVARCHAR (50)  NOT NULL,
    [QuotaMan]    NVARCHAR (50)  NOT NULL,
    [Tags]        NVARCHAR (250) NOT NULL,
    [okPr]        BIT            CONSTRAINT [DF_ProductionLogRaw_KO_okPr] DEFAULT ((1)) NOT NULL,
    [okQM]        BIT            CONSTRAINT [DF_ProductionLogRaw_KO_okQM] DEFAULT ((1)) NOT NULL,
    [okSc]        BIT            CONSTRAINT [DF_ProductionLogRaw_KO_okSc] DEFAULT ((1)) NOT NULL,
    [okDi]        BIT            CONSTRAINT [DF_ProductionLogRaw_KO_okDi] DEFAULT ((1)) NOT NULL,
    [ImportDate]  DATETIME       CONSTRAINT [DF_ProductionLogRaw_KO_ImportDate] DEFAULT (getdate()) NULL
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'validazione riga x calcolo produttività', @level0type = N'SCHEMA', @level0name = N'tmp', @level1type = N'TABLE', @level1name = N'ProductionLogRaw_KO', @level2type = N'COLUMN', @level2name = N'okPr';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'validazione riga x calcolo quota MAN', @level0type = N'SCHEMA', @level0name = N'tmp', @level1type = N'TABLE', @level1name = N'ProductionLogRaw_KO', @level2type = N'COLUMN', @level2name = N'okQM';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'validazione riga x calcolo scarti', @level0type = N'SCHEMA', @level0name = N'tmp', @level1type = N'TABLE', @level1name = N'ProductionLogRaw_KO', @level2type = N'COLUMN', @level2name = N'okSc';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'validazione riga x calcolo difettosità', @level0type = N'SCHEMA', @level0name = N'tmp', @level1type = N'TABLE', @level1name = N'ProductionLogRaw_KO', @level2type = N'COLUMN', @level2name = N'okDi';

