Feeds:
Posts
Comments

Archive for March, 2012

Input Table

Output Table



Query 

                                 Declare @rowtot int
                                 Declare @runtot int 


                                 Set @rowtot = 0
                                 Set @runtot = 0


                                Update RunningTotal
                                Set 
                                RowTotal              =      @rowtot,
                                RunningTotal         =      @runtot,
                               @rowtot                =      coalesce(col1,0)+coalesce(col2,0),
                               @runtot                 =      @runtot + @rowtot

                              Select * from RunningTotal

Read Full Post »

Design a site like this with WordPress.com
Get started