title: Accounts database design
body: <p>Hello everyone i am developing an accounts package for my company using Sql Server 2008 and VB.Net.</p>
  
  <p>I need some help regarding the database design.</p>
  
  <p>I have the following tables</p>
  
  <pre><code>AccountsGroupMaster
  
  GroupId int
  GroupName nvarchar(50)
  ParentGroupId int
  CatId int
  PrimaryGroup bit
  CreatedByUser nvarchar(50)
  CreatedOn datetime
  </code></pre>
  
  <p>The above table will store the Groups for the accounts eg: Current Assets etc.</p>
  
  <pre><code>Accounts Table
  
  AccCode nvarchar(6)
  AccountName nvarchar(30)
  ParentAcc nvarchar(6)
  GroupId int
  </code></pre>
  
  <p>The above table stores the Accounts/Ledgers .</p>
  
  <pre><code>VoucherMain
  
  VoucherNo bigint
  VoucherDate datetime
  DebitCredit int (0 for Credit 1 for Debit)
  AccCode nvarchar(6) (Account Code to be debited/Credited)
  UserID nvarchar(30)
  
  VoucherDetails
  
  VoucherNo bigint
  SlNo int
  AccCode nvarchar(6) (Debit this account if account in VoucherMain credited/ Credit this account if account in VoucherMain Debited)
  Amount decimal(18, 2)
  Narration nvarchar(MAX)
  </code></pre>
  
  <p>The above two tables store the transactions.The above two tables linked by the VoucherNo columns</p>
  
  <p>Now my question is whether i should maintain all the bank accounts in the accounts table or should i have a separate table for the bank accounts.
  As each bank account should have its respective ledgers.</p>
  
  <p>Please help me in the design of this database.
  thanks</p>