Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass Minus Values for a SP

I need to pass a value for a SP by multiply it by -1.

This is my query and I want pass the quantity by multiply it by -1.

SELECT top 1 @partid=partid, @unitCostU=unit_cost, @Quantity=qty
FROM parts_table

Exec ins_exusage @partid, 4, @Quantity, @unitCost

Is there any way to do this?

like image 966
Pramodi Samaratunga Avatar asked Sep 13 '25 13:09

Pramodi Samaratunga


1 Answers

change your fist query to negate the sign @Quantity = -qty

SELECT top 1 
       @partid = partid ,
       @unitCostU = unit_cost, 
       @Quantity = -qty 
FROM  @partstable

OR multiply it by -1

@Quantity = qty * -1
like image 126
Squirrel Avatar answered Sep 16 '25 03:09

Squirrel