﻿CREATE TABLE [dbo].[Package2Item] (
    [CodItem]   NVARCHAR (50)   NOT NULL,
    [CodPackag] NVARCHAR (50)   NOT NULL,
    [TotQta]    DECIMAL (18, 3) CONSTRAINT [DF_Package2Item_TotQty] DEFAULT ((0)) NOT NULL,
    [Weight]    DECIMAL (9, 4)  CONSTRAINT [DF_Package2Item_Weight] DEFAULT ((0)) NOT NULL,
    [Tare]      DECIMAL (9, 4)  CONSTRAINT [DF_Package2Item_Tare] DEFAULT ((0)) NOT NULL,
    [NumImb]    DECIMAL (9, 6)  CONSTRAINT [DF_Package2Item_NumImb] DEFAULT ((0)) NOT NULL,
    [Durata]    DECIMAL (18, 6) CONSTRAINT [DF_Package2Item_Durata] DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_Package2Item] PRIMARY KEY CLUSTERED ([CodItem] ASC, [CodPackag] ASC),
    CONSTRAINT [FK_Package2Item_ItemDet] FOREIGN KEY ([CodItem]) REFERENCES [dbo].[ItemDet] ([CodItem]) ON UPDATE CASCADE,
    CONSTRAINT [FK_Package2Item_PackagDet] FOREIGN KEY ([CodPackag]) REFERENCES [dbo].[PackagDet] ([CodPackag]) ON UPDATE CASCADE
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'codice articolo', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Package2Item', @level2type = N'COLUMN', @level2name = N'CodItem';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Quantità totale lavorata', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Package2Item', @level2type = N'COLUMN', @level2name = N'TotQta';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Peso medio', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Package2Item', @level2type = N'COLUMN', @level2name = N'Weight';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Tara', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Package2Item', @level2type = N'COLUMN', @level2name = N'Tare';

