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.
x
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?
Advertisement
Answer
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