Results 1 to 8 of 8

Thread: Table column update.

Threaded View

  1. #3
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Table column update.

    As I understand you'll need to add a new record to the table, not update the first one:
    Date....Desc...............Debit...........Credit........Balance
    31/12....Outstanding Balance..............................7000

    To do this you can create a stored procedure, something like this
    Code:
    DECLARE @StartBal Money,
            @TurnOver Money,
    	@EndBal Money;
    
        Select @StartBal = SUM(Balance) FROM [CASH BOOK] WHERE Date='1/1/2011';
        Select @Turnover = SUM(Debit) - SUM(Credit) FROM [CASH BOOK];
        Select @EndBal = @StartBal + @TurnOver;
        Insert Into [CASH BOOK] ([Date], [Desc], [Balance]) VALUES ('12/31/2011','Outstanding balance', @EndBal);
    	
        RETURN

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width