how to increment number after inserting new value

Last Reply on May 07, 2012 01:37 AM By Mudassar

Posted on May 07, 2012 01:36 AM

I have a table where i store record of account balance.

i want if user add some balance to it will increase.

for examole if 1000 is already in account and user add 2000 to it.

then it  wiil added in it like 3000.

please provide sagment of code with query.

Posted on May 07, 2012 01:37 AM
declare @amt int
set @amt = 2000
update accounts
set balance = balance + @amt
where accountid=21222