sql 2000

i have this sql stored procedure i want the last coloumn fAcc_Total to be updated when a record is inserted.

the value in the fBill_Amount should be add to the value of the fAcc_Total in the same time the record is inserted if there is a value in the previous row of the fAcc_Total the fBill_Amount should be added to that value and update the new row

if any one know can you show me how please
****************************************************************************************

create procedure InsertPayment(@bn NChar(10),@un NChar(60),@ba float,@ccn NChar(20),@cct NChar(10),@at float)
as
insert into
Payment_Info(cBill_No,cUser_Name,fBill_Amount,cCC_Number,cCC_Type,fAcc_Total)

values(@bn,@un ,@ba ,@ccn ,@cct,@at)

Recommended Answers

All 5 Replies

i don't what do you want. but i can think you want like this type of query
create procedure InsertPayment(@bn NChar(10),@un NChar(60),@ba float,@ccn NChar(20),@cct NChar(10),@at float)
as
insert into
Payment_Info(cBill_No,cUser_Name,fBill_Amount,cCC_Number,cCC_Type,fAcc_Total)

values(@bn,@un ,@ba ,@ccn ,@cct,@at=@at+@ba)
if you want this then you can this from frontend.
very confustion... in question.:(

when i im inserting a values in to the table i want the fAcc_Total to get updated by the fBill_Amount (fAcc_Total=fAcc_Total+fBill_Amount)

and im not providing the fAcc_Total it's the balance which is increased by using fBill_Amount

and the way u said gives an eroor

Server: Msg 170, Level 15, State 1, Procedure InsertPayment, Line 6
Line 6: Incorrect syntax near '='.

yse it's sure it will give you error actually i'm just showing you that what do you want.

and buy the way if you want to increase the fAcc_total every time then you can use trigger after every insert of that table. for e.g.
here and here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.