Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 opening balance 2

Author  Topic 

srisha
Starting Member

38 Posts

Posted - 2013-06-21 : 03:36:03
i want to running total after opening balance


--------------------------
BY
SRISHA

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-21 : 03:46:23
see one approach using APPLY here

http://visakhm.blogspot.com/2010/01/multipurpose-apply-operator.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

srisha
Starting Member

38 Posts

Posted - 2013-06-21 : 03:49:17
numberVar bal;
if(recordnumber = 1)
then bal={@main}+({@Debit}-{@Credit});

else (recordnumber > 1)
then (bal+({@Debit}-{@Credit}));

--------------------------
BY
SRISHA
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-21 : 03:53:19
Are you expecting a t-sql solution? Above posted code is not t-sql

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

srisha
Starting Member

38 Posts

Posted - 2013-06-21 : 03:58:57
no expecting ms sql only


--------------------------
BY
SRISHA
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-21 : 04:03:59
quote:
Originally posted by srisha

no expecting ms sql only


--------------------------
BY
SRISHA


thats what i asked
ms sqls programming standard is transact sql or t-sql

your posted didnt resemble t-sql syntax (use of { etc)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -