Solved

MS SQL Convert Positive Value in Negative

Posted on 2006-07-15
4
702 Views
Last Modified: 2008-02-01
Sir, we are using abs function for converting negative value in positive. I want to convert positive value in Negative. please help if is there any function for converting positive value in negative.

Rgds.
Mehram
0
Comment
Question by:Mehram
  • 2
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17114855
Use something like this

If  @urintValue > 0
  SEt urIntValue =  0 - @urInteValue


There is no ssystem function for this purpose , you can write ur own function to do this with the above logic
0
 

Author Comment

by:Mehram
ID: 17114869
Sir I am using following statement and I want to convert credit column in negative.

select file_job, d='0'+expensecode, headsub, credit, expensedate  
from cargoinvoicedetail where expensecode='0437' and credit > '0' order by 5

In this can i use if, if yes please help how?
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 17114877
select file_job, d='0'+expensecode, headsub, -1*credit, expensedate  
from cargoinvoicedetail where expensecode='0437' and credit > '0' order by 5

0
 

Author Comment

by:Mehram
ID: 17114881
Tks it is excellent
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question