﻿CREATE TABLE [dbo].[CRT_Data_LiveChart] (
    [CRTD_ID]              INT          IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
    [CRTD_TargetName]      VARCHAR (50) NOT NULL,
    [CRTD_CreationDate]          DATETIME     NOT NULL,
    [CRTD_FirstQuote]      DATETIME     NOT NULL,
    [CRTD_LastQuote]       DATETIME     NOT NULL,
    [CRTD_PairSymbol]      VARCHAR (50) NOT NULL,
    [CRTD_BidOpeningValue] FLOAT (53)   NOT NULL,
    [CRTD_BidClosingValue] FLOAT (53)   NOT NULL,
    [CRTD_BidLowValue]     FLOAT (53)   NOT NULL,
    [CRTD_BidHighValue]    FLOAT (53)   NOT NULL,
    [CRTD_MidOpeningValue] FLOAT (53)   NOT NULL,
    [CRTD_MidClosingValue] FLOAT (53)   NOT NULL,
    [CRTD_MidLowValue]     FLOAT (53)   NOT NULL,
    [CRTD_MidHighValue]    FLOAT (53)   NOT NULL,
    [CRTD_DateModified]    DATETIME     CONSTRAINT [DF_CRT_Data_LiveChart_CRTD_DateModified] DEFAULT (getdate()) NOT NULL,
    [CRTD_Rows]            INT          NULL,
    [ExchangeId] INT NOT NULL, 
    CONSTRAINT [PK_NC_CRT_Data_LiveChart_#CRTD_ID] PRIMARY KEY NONCLUSTERED ([CRTD_ID] ASC)
);


GO
CREATE NONCLUSTERED INDEX [IX_CRT_Data_LiveChart_PairSymbol_TargetName_INC]
    ON [dbo].[CRT_Data_LiveChart]([CRTD_PairSymbol] ASC, [CRTD_TargetName] ASC)
    INCLUDE([CRTD_CreationDate], [CRTD_BidOpeningValue], [CRTD_BidClosingValue], [CRTD_BidLowValue], [CRTD_BidHighValue], [CRTD_MidOpeningValue], [CRTD_MidClosingValue], [CRTD_MidLowValue], [CRTD_MidHighValue]);

