Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multipy column by -1 to convert numbers to negatives 1

Status
Not open for further replies.

soutener

IS-IT--Management
Jul 12, 2006
56
US
here's the story:
have a providex database that i suck data out of and into a sql server (using ssis and odbc) to create reports, the invoice detail table there are a couple of types of invoices, in short some return to stock and credit the customer where and some send out stock and bill the customer (returns and invoices in the same table)
problem is that they are all positive numbers, the database itselfe uses the "IV_TYP" field to determin wether it added or took away from the inventory, what i need to be able to do is multiply all "IV_TYP" invoice types that are returns by -1 so that if its a return for 100 units for $1000, my report treats it as -100 units and -$1000

i dont know how to accomplish this.
 
You couldn't do something like this?
Code:
UPDATE t_Invoices
SET Units = -1 * Units,
Price = -1 * Price
WHERE INV_TYP = 'Return'


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
sample data is like:

IVD_CONTROL, IVD_TYPE, IVD_SKU, IVD_PRICE, IVD_COST, IVD_QTY
1234325, R, TS234, 19.95, 10, 1

i think:
UPDATE t_Invoices
SET Units = -1 * Units,
Price = -1 * Price
WHERE INV_TYP = 'Return'
should do it, 'll try it monday

thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top