﻿CREATE TABLE [dbo].[MovMagRic] (
    [idxItem]     INT      NOT NULL,
    [numIntMtz]   INT      NOT NULL,
    [dtMov]       DATETIME NOT NULL,
    [Qta]         INT      CONSTRAINT [DF_MovMagRic_Qta] DEFAULT ((0)) NOT NULL,
    [idxMacchina] INT      NOT NULL,
    [dtExport]    DATETIME NULL,
    CONSTRAINT [PK_MovMagRic] PRIMARY KEY CLUSTERED ([idxItem] ASC, [numIntMtz] ASC, [dtMov] ASC),
    CONSTRAINT [FK_MovMagRic_AnagItems] FOREIGN KEY ([idxItem]) REFERENCES [dbo].[AnagItems] ([idxItem]) ON UPDATE CASCADE,
    CONSTRAINT [FK_MovMagRic_InterventiMtz] FOREIGN KEY ([numIntMtz]) REFERENCES [dbo].[InterventiMtz] ([numIntMtz]) ON UPDATE CASCADE
);




GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'data export verso ERP', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'MovMagRic', @level2type = N'COLUMN', @level2name = N'dtExport';

