Am Using Query Like this
insert into BalanceSheet (Balance) select @Balance FROM OrderBill WHERE CustomerID=@CustomerID and InvoiceID=@InvoiceID
Getting Error Like
Cannot insert the value NULL into column 'CustID', table 'BillingAndAccounts.dbo.BalanceSheet'; column does not allow nulls. INSERT fails.
The statement has been terminated.

ShehzadRank #2,660 · 522 reputationPosted Apr 29, 2014, 12:29 AM EDT
insert into BalanceSheet (CustID,Balance) select CustomerID,@Balance FROM OrderBill WHERE CustomerID=@CustomerID and InvoiceID=@InvoiceID
This should workKhan Abrar AhmedRank #778 · 3K reputationPosted May 6, 2014, 1:19 AM EDT
you have to make CustID as nullable column or add in the column in insert statement to insert the CustID.
Jignesh TrivediRank #16 · 50.3K reputationPosted May 6, 2014, 1:28 AM EDT
Hi,
I think you are doing something wrong with requirement.
you are inserting only Balance data into BalanceSheet table what about other reference data like customer id, transaction type (credit/ debit) etc...
agree with above two answer