[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

MS SQL Convert Positive Value in Negative

Posted on 2006-07-15
4
Medium Priority
?
749 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

650 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