CREATE TABLE [dbo].[Attr2UDC] (
    [idxAttr]     INT           IDENTITY (1, 1) NOT NULL,
    [UDC]         NVARCHAR (50) NOT NULL,
    [CodAttr]     NVARCHAR (2)  CONSTRAINT [DF_Attr2UDC_CodAttr] DEFAULT ('') NOT NULL,
    [ValAttr]     NVARCHAR (50) CONSTRAINT [DF_Attr2UDC_ValAttr] DEFAULT ('') NOT NULL,
    [DateAttr]    DATETIME      CONSTRAINT [DF_Attr2UDC_DateAttr] DEFAULT (getdate()) NOT NULL,
    [CodSoggetto] NCHAR (17)    NULL,
    CONSTRAINT [PK_Attr2UDC] PRIMARY KEY CLUSTERED ([idxAttr] ASC),
    CONSTRAINT [FK_Attr2UDC_AnagAttributi] FOREIGN KEY ([CodAttr]) REFERENCES [dbo].[AnagAttributi] ([CodAttr]) ON UPDATE CASCADE,
    CONSTRAINT [FK_Attr2UDC_ElencoCartellini] FOREIGN KEY ([UDC]) REFERENCES [dbo].[ElencoCartellini] ([UDC]) ON UPDATE CASCADE
);




GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'NON MODIFICARE: nel codice si usano questi campi x chiamate...', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Attr2UDC', @level2type = N'COLUMN', @level2name = N'CodAttr';


GO
CREATE NONCLUSTERED INDEX [ix_Attr2UDC_UDC]
    ON [dbo].[Attr2UDC]([UDC] ASC);

