CREATE TABLE Account_Details(
            ADT_ClientAccountNumber varchar(20) NOT NULL, 
            ADT_TaxIdentifier varchar(20) NOT NULL,
	    ADT_AccountGroup varchar(16) NULL,
            ADT_AccountInActive bit null default 0,
	    ADT_UseAcctPfSettings bit null default 0, 	
            ADT_ShortAccountName varchar(30) Null,  
            ADT_DateOpened datetime Null,
            ADT_DateClosed datetime Null,
            ADT_AccountTitle varchar(80) Null,
	    ADT_ValueDate datetime Null,
	    ADT_Value money Null,
	    ADT_NetContributions money Null,
	    ADT_AvailCash money Null,
	    ADT_MinimumCash money Null,
  	    ADT_RemainingMargin money Null,
            ADT_InvestmentStyle varchar(20) Null,
            ADT_ShortAccountNotes varchar(512) Null,
            ADT_CashEquivSymbols varchar(30) null,
            ADT_MiscUserFields1 varchar(30) Null,
            ADT_MiscUserFields2 varchar(30) Null,
            ADT_MiscUserFields3 varchar(30) Null,
            ADT_AccountType  varchar(10) Null,
	    ADT_AccountCode  varChar(3) Null,
	    ADT_IsTaxDeferred bit null default 0,	    
            ADT_MaxMarginPct real Null,
            ADT_MaxShortsPct real Null, 
     	    ADT_MgmtFeeDiscountPct  real Null, 
    	    ADT_TaxWithholdPct real Null, 
    	    ADT_IRATaxWHPct real Null, 
            ADT_TransferCode tinyint Null default 0,
            ADT_Discretionary tinyint Null default 0,
            ADT_SalesProceeds tinyint Null default 0,
            ADT_DivProceeds tinyint Null,
            ADT_SecurityDelivery tinyint Null,
	    ADT_TaxWitholding bit null default 0,
            ADT_Custodian varchar(8) Null,
            ADT_IntClass  varchar(1) Null,
	    ADT_FeeClass  varchar(20) Null,
            ADT_BillingSymbol  varchar(15) Null,
            ADT_FeeExcludedValue float null,
            ADT_FeesDue  money Null,
            ADT_RptMergeBy tinyint null default 0,
            ADT_NoBatch bit null default 0,
            ADT_TaxIDMStr bit null default 0,
            ADT_FamilyMStr bit null default 0,
            ADT_FeeMstr bit null default 0,
            ADT_NoReports bit null default 0,
            ADT_ReportConsolidation tinyint Null default 0,
	    ADT_BaseCurrency varchar(5) Null,
	    ADT_FiscalYE datetime Null,
	    ADT_TaxAdjust bit null default 0,
	    ADT_LossCarryover bit null default 0,
	    ADT_CGIndex bit null default 0,
	    ADT_PrimaryMarketIndex varchar(15) Null,
      	    ADT_SecondaryIndex1 varchar(15) Null,
     	    ADT_SecondaryIndex2 varchar(15) Null,
     	    ADT_SecondaryIndex3 varchar(15) Null,
     	    ADT_SecondaryIndex4 varchar(15) Null,
     	    ADT_SecondaryIndex5 varchar(15) Null,
     	    ADT_SecondaryIndex6 varchar(15) Null,
     	    ADT_SecondaryIndex7 varchar(15) Null,
     	    ADT_SecondaryIndex8 varchar(15) Null,
      	    ADT_NoTaxComputations bit null default 0,
            ADT_NoValueAccruals bit null default 0,
            ADT_DoAccrueDiv bit null default 0,
            ADT_ForeignCashAcctg bit null default 0,
            ADT_AcctIDActive bit null default 0,
            ADT_CashMarginActive bit null default 0,
            ADT_TrustAccounting bit null default 0,
            ADT_FundAccounting bit null default 0,
            ADT_ShortAcctg bit null default 0,
            ADT_WashLossAdj bit null default 0,
            ADT_StrategyActive bit null default 0,
            ADT_TaxQualified bit null default 0,
            ADT_DefaultTaxLot tinyint Null default 0,
            ADT_FundAcctgNAVdecimal tinyint Null,
            ADT_FundAcctgQtydecimal tinyint Null,
	    ADT_FundAcctgParticipants smallint Null,
            ADT_UseAcctIndices bit null default 0,
            ADT_UseAcctSchedRpts bit null default 0,
            ADT_OverrideAddressType bit null default 0,
	    ADT_UseAddressType tinyint null default 0,
            ADT_OverrideFaxType bit null default 0,
	    ADT_SendRptToHomeFax bit null default 0,
   	    ADT_SendRptToWorkFax bit null default 0,
	    ADT_SendRptToOtherFax bit null default 0,
            ADT_OverrideEMailType bit null default 0,
	    ADT_SendRptToEmailA bit null default 0,
	    ADT_SendRptToEmailB bit null default 0,
            ADT_SendRptToPrinter bit null default 0,
            ADT_SendRptToEMail bit null default 0,
            ADT_SendRptToFax bit null default 0,
            ADT_OverridePrices bit null default 0,
            ADT_ProgCtrlFlags int null,
            ADT_AllocMergeBy tinyint null default 0,
            ADT_BillingAcctNum varchar(20) null,
   	    ADT_TempRecord bit null default 0,
            ADT_IsFrozen  bit null default 0,
	    ADT_ROIStartDate datetime null,
            ADT_UserDefined1 varchar(50) null,
            ADT_UserDefined2 varchar(50) null,
            ADT_UserDefined3 varchar(50) null,
            ADT_UserDefined4 varchar(50) null,
            ADT_UserDefined5 varchar(50) null,
            ADT_CustodianId VarChar(30) null,
            ADT_OptionCashAcctg  bit null default 0,
            ADT_ROIEndDate     Datetime  null,
            ADT_BaseCurTaxWH   bit  null,
            ADT_PerturbedDate  Datetime  null,
            ADT_GrossValue money  null,
            ADT_SuppressPricing bit null,
    	    ADT_UseFeeGrpOverride bit null default 0,
            ADT_AccountFeeGrp tinyint null default 0,
            ADT_FeeAssetMethod tinyint null default 0,
    	    ADT_IntraDayDate DateTime null,
    	    ADT_IntraDayValue money null,
    	    ADT_IntraDayGain real null,

            CONSTRAINT PK_Account_Details PRIMARY KEY CLUSTERED (ADT_ClientAccountNumber)
	);

ALTER TABLE [dbo].[Account_Details] ADD 
	CONSTRAINT [FK_Account_Details_Client_Details] FOREIGN KEY 
	(
		[ADT_TaxIdentifier]
	) REFERENCES [dbo].[Client_Details] (
		[CDT_TaxIdentifier]
	) ON DELETE CASCADE  ON UPDATE CASCADE
