﻿CREATE TABLE [dbo].[CostList] (
    [DateList]        SMALLDATETIME   CONSTRAINT [DF_CostList_DataList] DEFAULT (CONVERT([date],getdate(),0)) NOT NULL,
    [CodItem]         NVARCHAR (50)   NOT NULL,
    [RawMat]          NVARCHAR (50)   NOT NULL,
    [RawMatCost]      DECIMAL (18, 6) NOT NULL,
    [RawMatExtraCost] DECIMAL (18, 6) NULL,
    [batchQty]        INT             NOT NULL,
    [CodInco]         NVARCHAR (5)    NOT NULL,
    [QuoteType]       CHAR (1)        CONSTRAINT [DF_CostList_QuoteType] DEFAULT ('C') NOT NULL,
    [CodQuote]        BIGINT          CONSTRAINT [DF_CostList_CodQuote] DEFAULT ((0)) NOT NULL,
    [QuoteRev]        INT             CONSTRAINT [DF_CostList_QuoteRev] DEFAULT ((0)) NOT NULL,
    [EndCalc]         DATETIME        NULL,
    CONSTRAINT [PK_CostList_1] PRIMARY KEY CLUSTERED ([DateList] ASC, [CodItem] ASC, [RawMat] ASC)
);


GO
CREATE NONCLUSTERED INDEX [ix_CostList_QuoteType_CodQuote]
    ON [dbo].[CostList]([QuoteType] ASC, [CodQuote] ASC);

