﻿CREATE TABLE [dbo].[MagRic] (
    [idxItem]      INT            NOT NULL,
    [CodLocazione] NVARCHAR (50)  CONSTRAINT [DF__MagRicamb__CodLo__041093DD] DEFAULT ('') NOT NULL,
    [Giacenza]     INT            CONSTRAINT [DF__MagRicambi__Qta__031C6FA4] DEFAULT ((0)) NOT NULL,
    [Note]         NVARCHAR (MAX) CONSTRAINT [DF__MagRicambi__Note__0504B816] DEFAULT ('') NOT NULL,
    [dtLastUpd]    DATETIME       NULL,
    CONSTRAINT [PK__MagRicam__51E8426210504E93] PRIMARY KEY CLUSTERED ([idxItem] ASC, [CodLocazione] ASC),
    CONSTRAINT [FK_MagRic_AnagItems] FOREIGN KEY ([idxItem]) REFERENCES [dbo].[AnagItems] ([idxItem]) ON UPDATE CASCADE,
    CONSTRAINT [FK_MagRic_AnagLocazioni] FOREIGN KEY ([CodLocazione]) REFERENCES [dbo].[AnagLocazioni] ([CodLocazione]) ON UPDATE CASCADE
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'data-ora ultimo aggiornamento', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'MagRic', @level2type = N'COLUMN', @level2name = N'dtLastUpd';

