MS SQL Convert Positive Value in Negative

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
MehramAsked:
Who is Participating?
 
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
select file_job, d='0'+expensecode, headsub, -1*credit, expensedate  
from cargoinvoicedetail where expensecode='0437' and credit > '0' order by 5

0
 
Aneesh RetnakaranDatabase AdministratorCommented:
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
 
MehramAuthor Commented:
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
 
MehramAuthor Commented:
Tks it is excellent
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.