CREATE TABLE [RilPro].[RapQual] (
    [nRapQual]     NUMERIC (6)   NOT NULL,
    [DataRapQual]  NUMERIC (8)   NOT NULL,
    [ProgUDC]      NVARCHAR (10) NOT NULL,
    [CodFor]       NVARCHAR (6)  NOT NULL,
    [DestTerz]     NVARCHAR (6)  NOT NULL,
    [CodLega]      NVARCHAR (15) NOT NULL,
    [DataPrelFus]  NUMERIC (8)   NOT NULL,
    [TurnoPrelFus] NVARCHAR (5)  NOT NULL,
    [Qta]          NUMERIC (5)   NOT NULL,
    [DestLega]     NVARCHAR (3)  NOT NULL,
    [LegaScaric]   NVARCHAR (1)  NOT NULL,
    [BenesQual]    NVARCHAR (1)  NOT NULL,
    [UDC]          NVARCHAR (50) NULL,
    CONSTRAINT [PK_RapQual] PRIMARY KEY CLUSTERED ([ProgUDC] ASC) WITH (FILLFACTOR = 95)
);


GO
CREATE NONCLUSTERED INDEX [i_RapQual_DataPrelFusDataRapQual]
    ON [RilPro].[RapQual]([DataPrelFus] ASC, [DataRapQual] ASC) WITH (FILLFACTOR = 95);


GO
CREATE NONCLUSTERED INDEX [i_dataRap]
    ON [RilPro].[RapQual]([DataRapQual] ASC)
    INCLUDE([BenesQual], [CodFor], [CodLega], [LegaScaric], [nRapQual], [Qta], [UDC]) WITH (FILLFACTOR = 95);


GO
CREATE NONCLUSTERED INDEX [i_RapQual_nRapQual_LegaScaric]
    ON [RilPro].[RapQual]([nRapQual] ASC, [LegaScaric] ASC)
    INCLUDE([UDC]) WITH (FILLFACTOR = 95);


GO
CREATE NONCLUSTERED INDEX [i_RapQual_BenesQual]
    ON [RilPro].[RapQual]([BenesQual] ASC)
    INCLUDE([ProgUDC], [UDC]) WITH (FILLFACTOR = 95);


GO
CREATE NONCLUSTERED INDEX [i_UDC]
    ON [RilPro].[RapQual]([UDC] ASC);

