Click here to Skip to main content
15,916,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below table account trans :

TransID	TransDate	LedgerID	vid	debitamt	creditamt	vouchertype
1	05-Apr-12	3	1	0	1474	SALES INVOICE
2	05-Apr-12	4	1	0	369	SALES INVOICE
3	05-Apr-12	13	1	38703	0	SALES INVOICE
4	05-Apr-12	8	1	0	36860	SALES INVOICE
5	02-Apr-12	70	1	0	8715	PURCHASE VOUCHER
6	02-Apr-12	4	1	8715	0	PURCHASE VOUCHER
7	07-Feb-13	1	1	0	2000	QUICK PAYMENT VOUCHER


How to get closing balance using stored procedure in sql server?
Posted
Updated 8-Mar-13 6:42am
v2
Comments
ZurdoDev 8-Mar-13 8:46am    
Where are you stuck? Wouldn't it just be the sum of debitamt - sum of creditamt for each day?
[no name] 8-Mar-13 9:08am    
To get the closing balance from a stored procedure, write a stored procedure that returns the balance on the account at the time the customer closed the account.
Maciej Los 8-Mar-13 14:35pm    
Please, be more specific and provide more data (example output data).

1 solution

Write the Store Proc, that returns the output paramenter. Read this parameter to read in your application.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900