CREATE TABLE [dbo].[Blocchi] (
    [IdxBlocco]  INT           NOT NULL,
    [CodMag]     NVARCHAR (50) NULL,
    [CodCS]      NCHAR (2)     NULL,
    [CodBlocco]  NVARCHAR (3)  NOT NULL,
    [DescBlocco] NVARCHAR (50) NULL,
    [NumX]       INT           NULL,
    [NumY]       INT           NULL,
    [NumZ]       INT           NULL,
    CONSTRAINT [PK_Blocchi] PRIMARY KEY CLUSTERED ([IdxBlocco] ASC),
    CONSTRAINT [FK_Blocchi_AnagMag] FOREIGN KEY ([CodMag], [CodCS]) REFERENCES [dbo].[AnagMag] ([CodMag], [CodCS]) ON UPDATE CASCADE,
    CONSTRAINT [i_CodBlocco] UNIQUE NONCLUSTERED ([CodBlocco] ASC)
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'numero elementi X (colonne)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Blocchi', @level2type = N'COLUMN', @level2name = N'NumX';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'numero elementi Y (livelli/ripiani)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Blocchi', @level2type = N'COLUMN', @level2name = N'NumY';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'numero elementi Z (profondita)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Blocchi', @level2type = N'COLUMN', @level2name = N'NumZ';

