Last post Nov 11, 2010 03:45 PM by capjlp
Nov 11, 2010 02:48 PM|capjlp|LINK
I have a insert into statement thats inserting my numbers from a numeric text box on my aspx page. I am choosing the Amount Type then putting in a a number.
So i have a drop down that i select example Direct Charge then i enter 600.00 and click add it puts that in to the databse for me woot..
I then put in say Misc Credit and enter 200.00 it inserts in that into the database woot.
The look up table that has my amount types has a field called numeric opperator which is either + or - the Credit being a - and the Charge being a + then my stored procedure takes all my + numbers and adds them up and subtracts all the - numbers.
I want to change that so that it actuall be inserted into the table as a - number form the start. So I want choose Misc Credit enter 200.00 and click add then my event says o yea thats a credit insert 200.00 as -200.00
How can I do that?
Example My AmountTypes
Misc Charge +
Misc Credit -
I am inserting into a ReqDetailTable
Misc Charge 600.00
Misc Credit -200.00
Thank you for your help
insert into negitive value
Nov 11, 2010 03:45 PM|capjlp|LINK
I got it woot....
insert into TempReqDetail (SessionID, AmountType, Amount)
select @SessionIDNo, @AmountType, case when NumericOpperator = '-' then -1 else 1 end *@Amount
from tblReqAmountTypes where AmountType = @AmountType