Create Table Portfolio_Valuations(
                              PVL_Sequence integer Identity(1,1) NOT NULL,
                              PVL_ClientAccountNumber Varchar(20) NOT NULL,
                              PVL_Date datetime NOT NULL,
                              PVL_Value money NULL,
                              PVL_Cost money NULL,
                              PVL_TaxableGain money NULL,
                              PVL_GainP money NULL,
                              PVL_NetInvestment money NULL,
                              PVL_InvGain money NULL,
                              PVL_InvGainP money NULL,
                              PVL_PeriodGain money NULL,
                              PVL_PeriodGainP money NULL,
                              PVL_PeriodEstTaxes money NULL,
				PVL_MarginInterest money NULL,
				PVL_CashAvail money NULL,
               			PVL_MarginAvail money NULL,
                		PVL_MarginUsed money NULL,
                		PVL_MarginRemaining money NULL,
                		PVL_GrossValue money NULL,
                		PVL_Leverage real NULL,
                		PVL_XRate real NULL default 1,
                		PVL_GlobalValue money NULL,
         			PVL_NAVShares float NULL,
                		PVL_MarginProfit money NULL,
                		PVL_NonMarginProfit money NULL,
                		PVL_NAV float NULL,
				PVL_CumAdditions money NULL,
                		PVL_CumRemovals money NULL,
                              	PVL_IntraDayGain real NULL,
			        PVL_BefMrgnAndFeePrdROI real NULL,
                              	PVL_BefFeePrdROI real NULL,
                              	PVL_AftFeePrdROI real NULL,
                              	PVL_AftTaxPrdROI real NULL,
                              	PVL_MissingPrices bit null default 0,
                              	PVL_ExcludePeriodFromROI bit null default 0,
                              	PVL_Perturbed bit null default 0,
                              	PVL_ValuationOnly bit null default 0,
                              	PVL_TempRecord bit null default 0,
                              	PVL_IsFrozen bit null default 0,
				PVL_BrkrCashBal money null,
				PVL_CalcDate datetime null,
                              	PVL_CalcRelVerDate datetime null,
                              	PVL_ProgCtrlBits integer null default 0,
				PVL_AccruedDividends money null,	
				PVL_ValueWoAccrual money null,
				PVL_EstIncentiveFee integer null,
                              CONSTRAINT PK_Portfolio_Valuations PRIMARY KEY NONCLUSTERED (PVL_Sequence)
                             );

ALTER TABLE [dbo].[Portfolio_Valuations] ADD
	CONSTRAINT [FK_Portfolio_Valuations_Account_Details] FOREIGN KEY
	(
		[PVL_ClientAccountNumber]
	) REFERENCES [dbo].[Account_Details] (
		[ADT_ClientAccountNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE

ALTER TABLE [dbo].[Portfolio_Valuations] ADD
	CONSTRAINT [IX_Portfolio_Valuations] UNIQUE
	(
		[PVL_ClientAccountNumber],[PVL_Date]
	) 

