Skip to content
Advertisement

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?

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
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement