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.
Jignesh TrivediPosted May 6, 2014, 5:28 AM
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
Khan Abrar AhmedPosted May 6, 2014, 5:19 AM
you have to make CustID as nullable column or add in the column in insert statement to insert the CustID.
ShehzadPosted Apr 29, 2014, 4:29 AM
insert into BalanceSheet (CustID,Balance) select CustomerID,@Balance FROM OrderBill WHERE CustomerID=@CustomerID and InvoiceID=@InvoiceID
This should work