Jes Sie

Jes Sie

  • 668
  • 1.2k
  • 265.3k

Select and Insert using One stored procedure in SQL server

Apr 4 2017 5:47 AM
I needed help once more.
 
I have a select the query below from 1 table (CashierSalesDetails)
  1.  select TransactionNumber, sum(c.ConvertedNetPremium + c.ConvertedVAT + c.ConvertedRegistryFee) as AR
  2. from CashierSalesDetails c  
  3. where c.TransactionNumber = '000000017'  
  4. group by TransactionNumber  
Now, I want to the  insert the AR and TransactionNumber fields into table tblAccountsReceivables in the TransactionNumber and AccountsReceivable field together with some other fields: 
  1. @TransactionNumber nvarchar(50),  
  2. @CashierID nvarchar(50),  
  3. @AccountsReceivable decimal(18,2),  
  4. @AgentID nvarchar(50))  
 Thanks in advance

Answers (3)