Create Table Portfolio_FundAccounts(
                                  PFA_Sequence integer Identity(1,1) NOT NULL,
                                  PFA_PortfolioId Varchar(20) NOT NULL,
                                  PFA_Date datetime NOT NULL,
			          PFA_FAccountNum Varchar(20) NOT NULL,  
                                  PFA_LinkedAccount Varchar(20) Null,
                                  PFA_AcctTaxId Varchar(20) Null,
                                  PFA_AcctType Varchar(6) Null,
                                  PFA_AcctClass Varchar(6) Null,
                                  PFA_AcctName Varchar(120) Null,
                                  PFA_NetContrib money Null,
                                  PFA_CurValue money Null,
                                  PFA_CumProfit money Null,
                                  PFA_AllowedLvrg real Null,
                                  PFA_TaxRateClass Varchar(8) Null,
                                  PFA_TaxWithHoldRate real Null,
                                  PFA_OverrideFundRates bit null,
                                  PFA_ProfitConMethod tinyint Null,
                                  PFA_ProfitConBasePct real Null,
                                  PFA_ProfitConPct real Null,
                                  PFA_MgmtFeeMethod tinyint Null,
                                  PFA_MgmtFeePct real Null,
                                  PFA_ExpenseFactor real Null,
                                  PFA_RepAccount Varchar(20) Null,
                                  PFA_RepPctOfConcession real Null,
                                  PFA_RepPctOfFees real Null,
                                  PFA_RepPctOfCommis real Null,
                                  PFA_TrustMFeePctOfPrincip float Null,
                                  PFA_TrustAdmFeePctofPrincip float Null,
                                  PFA_TrustExpensePctofPrincip float Null,
                                  PFA_OverrideAddress tinyint Null default 0,
                                  PFA_OverridePhone tinyint Null default 0,
                                  PFA_OverrideFax tinyint Null default 0,
                                  PFA_OverrideEmail tinyint Null default 0,
                                  PFA_Codes Varchar(30) Null,
                                  PFA_LinkedToAcct bit null default 0,
                                  PFA_DivReinvest bit null default 0,
                                  PFA_STCGReinvest bit null default 0,
                                  PFA_LTCGReinvest bit null default 0,
                                  PFA_IntReinvest bit null default 0,
                                  PFA_OtherReinvest bit null default 0,
                                  PFA_HotIssuesNotOk bit null default 0,
                                  PFA_MarginNotOk bit null default 0,
                                  PFA_IsMgmtOrRep bit null default 0,
                                  PFA_TrustPandIbyShares bit null default 0,
                                  PFA_ProgCtrlBits integer null default 0,
                                  PFA_TempRecord bit null default 0,
                                  PFA_IsFrozen bit null default 0,
                                  PFA_ValueDate datetime null,
                                  PFA_CurShares real Null,
                                  PFA_PctOfFund real Null,
                                  PFA_OpenDate datetime null,
                                  PFA_CloseDate datetime null,
				  PFA_NextRedemptDate datetime null,
				  PFA_NextMaxRedemptAmt money null,
                                  CONSTRAINT PK_Portfolio_FundAccounts PRIMARY KEY CLUSTERED (PFA_FAccountNum)
                                  );

ALTER TABLE [dbo].[Portfolio_FundAccounts] ADD
	CONSTRAINT [FK_Portfolio_FundAccounts_Account_Details] FOREIGN KEY
	(
		[PFA_PortfolioId]
	) REFERENCES [dbo].[Account_Details] (
		[ADT_ClientAccountNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE
